logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
davedruid  
#1 Posted : Saturday, July 11, 2009 1:09:49 PM(UTC)
davedruid

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
johnl  
#2 Posted : Saturday, July 11, 2009 8:23:24 PM(UTC)
johnl

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.

davedruid  
#3 Posted : Sunday, July 12, 2009 8:56:55 AM(UTC)
davedruid

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

johnl  
#4 Posted : Monday, July 13, 2009 8:28:47 AM(UTC)
johnl

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.



davedruid  
#5 Posted : Tuesday, July 21, 2009 7:32:00 AM(UTC)
davedruid

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.