Book Appointment Now

Multicharts圖表上顯示淨值損益
分享一個簡單好用的功能,如何在Multicharts圖表上顯示該筆交易的損益
如下圖

程式碼如下
//Show Profit
var:MP(0),NP(0),OP(0);
MP=i_marketposition ;
NP=i_ClosedEquity ;
OP=i_OpenEquity ;
if NP<>NP[1] and NP[1]<>0 then begin
text_new(d,t,H,numtostr((NP-NP[1])/NP[1]*100,2)+” %”);
text_new(d,t,L,”$”+numtostr((NP-NP[1]),0));
end;
if MP<>0 and NP[1]<>0 and LastBarOnChart then begin
text_new(d,t,H,numtostr((OP-NP[1])/NP[1]*100,2)+” %”);
text_new(d,t,L,”$”+numtostr((OP-NP[1]),0));
end;
把最近的淨值損益 用圖表呈現出來
如下圖

程式碼如下
value1 = i_ClosedEquity;
value2 = i_OpenEquity;
plot1(value1,”closeprofit”);
plot2(value2,”nowprofit”);
建議可以放在圖表副圖 方便策略管理