Rank:: Newbie
Groups: Registered, Registered Users Joined: 5/10/2009(UTC) Posts: 5
|
Hi
I am trying to find some kind of of formula that allows me to determine whether previous trades / positions within a market in a testing simulation were profitable or not. E.g. if previous trade is profitable then continue with existing strategy else ...
Any pointers gratefully received.
Dave
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
I usually turn the buy/sell signals into 1s or 0s then use the ValueWhen function to calculate the profit/loss, then go from there.
|
|
|
|
Rank:: Newbie
Groups: Registered, Registered Users Joined: 5/10/2009(UTC) Posts: 5
|
Hey John, thanks for the pointer but I am stil a bit unsure of this - could you please give me a little more information on the formula.
Thanks Again
Dave
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
Try something like: When you have hit your buy signal and you want the last profit/loss : ValueWhen(1,sell signal true,C)-ValueWhen(2,buy signal true,C) will give you the last signal.
Play around with the "1","2" in the ValueWhen to grab the correct signal. Refer to manual for more info. I code like:
b1:=buy signal; s1:=sell signal; pl1:= ValueWhen(1,s1=1,C)-ValueWhen(2,b1=1,C); d1:=If((pl1>0),do this, otherwise do this); d1
You may or may not need BarsSince() to confirm the correct buyy/sell signals for calc.
|
|
|
|
Rank:: Newbie
Groups: Registered, Registered Users Joined: 5/10/2009(UTC) Posts: 5
|
Thanks a lot for that.
I will give it a go.
Dave
|
|
|
|
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.