Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/27/2006(UTC) Posts: 135
|
Hi,
The code below plot the individual trade return at exit bar.
How to plot the individual trade return at entry bar instead?
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);
Entry:=ValueWhen(1,entry,Ref(C,0)*(1+cost)); Profit:=Ref(C,0)*(1-cost)/EntryVal-1; ProfitPer:=(flag*(-Profit)+Cum(exit*(-Profit)))*100;
Ret:=exit*Profit*100; Ret;
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Flexi
Can you possibly provide a formula that actually works.
Roy
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/27/2006(UTC) Posts: 135
|
There are some bugs on the previous code. This one definitely would wk. 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 https://www.yousendit.com/download/ MzZGcHBKYUk1aVpFQlE9PQhttps://www.yousendit.com/download/ MzZGcHBKYUk5NVZjR0E9PQhttps://www.yousendit.com/download/ MzZGcHBKYUlvQUkwTVE9PQentry:=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;
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.