Plotting trade pnl

Estrend

Junior member
Messages
26
Likes
0
This one plot the individual trade return on the exit bars on the 2 jpg. On 1 jpg there are the entry bars for the individual trade. Trying to plot the individual trade return on the entry bar rather than on the exit bar. Anyone know how to tweak the code to plot the trade pnl on entry bar rather than on exit bar?

https://www.yousendit.com/download/ MzZGcHBKYUk1aVpFQlE9PQ

https://www.yousendit.com/download/ MzZGcHBKYUk5NVZjR0E9PQ

https://www.yousendit.com/download/ MzZGcHBKYUlvQUkwTVE9PQ

entry:=Cross(Mov(C,10,S),Mov(C,30,S));
exit:=Cross(Mov(C,30,S),Mov(C,10,S));

init:=Cum(IsDefined(entry+exit))=1;
flag:=ValueWhen(1,entry-exit<>0 OR init,entry);
entry:=flag*(Alert(flag=0,2)
OR entry*Cum(entry)=1);
exit:=(flag=0)*(Alert(flag,2)
OR exit*Cum(exit)=1);

EntryVal:=ValueWhen(1,entry,Ref(C,0));
Profit:=Ref(C,0)/EntryVal-1;
ProfitPer:=(flag*(-Profit)+Cum(exit*(-Profit)))*100;

Ret:=exit*Profit*100;
Ret;
 
Top