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

Notification

Icon
Error

Options
Go to last post Go to first unread
supremeinfo  
#1 Posted : Tuesday, December 4, 2012 9:23:30 PM(UTC)
supremeinfo

Rank: Member

Groups: Registered, Registered Users
Joined: 8/8/2012(UTC)
Posts: 15

Hi could anyone plz help me to test a system with the following test rules 1:BUY, when price crosses the high of previous two days 2:SELL,when price crosses the low of previous two days 3:EXIT LONG:when price crosses previous day low 4:EXIT SHORT:when price crosses previous day high 5:on opening the long position,if price closes below previous day close price,long should be closed same day,do just opposite for short position. thanks & regards
wabbit  
#2 Posted : Tuesday, December 4, 2012 10:08:05 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,106
Location: Perth, Western Australia

Was thanked: 12 time(s) in 12 post(s)
Read the manual. Do the exercises in the free Formula Primer.

No slaves here, just people willing to help you after you do your homework first.



wabbit [:D]

supremeinfo  
#3 Posted : Wednesday, December 5, 2012 2:12:33 AM(UTC)
supremeinfo

Rank: Member

Groups: Registered, Registered Users
Joined: 8/8/2012(UTC)
Posts: 15

Hi Wabbit The code which i tested does not give the desired results for buy
Code:

value:=hhv(h,2);
entry:=cross(h,value);
reset:=entry;
buy:=entry
sell order cross(ref(c,-1),l) or C <( ref(c,-1)) sell short order
Code:

value:=llv(l,2);
entry:=cross(l,value);
reset:=entry;

sell:=entry
buy to cover order
Code:

cross(h,ref(h,-1)) or c > ref(c,-1)
problem is i do not know how to reset the counter since the system shows only 1 trade.. warm regards supremeinfo
supremeinfo  
#4 Posted : Wednesday, December 5, 2012 2:31:51 AM(UTC)
supremeinfo

Rank: Member

Groups: Registered, Registered Users
Joined: 8/8/2012(UTC)
Posts: 15

supremeinfo wrote:
Hi Wabbit The code which i tested does not give the desired results for buy
Code:

value:=hhv(h,2);
entry:=cross(h,value);
reset:=entry;
buy:=entry
sell order
Code:

cross(ref(c,-1),l) or c< ref(c,-1)
sell short order
Code:

value:=llv(l,2);
entry:=cross(l,value);
reset:=entry;

sell:=entry
buy to cover order
Code:

cross(h,ref(h,-1)) or c > ref(c,-1)
problem is i do not know how to reset the counter since the system shows only 1 trade.. warm regards supremeinfo
wabbit  
#5 Posted : Wednesday, December 5, 2012 2:53:17 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,106
Location: Perth, Western Australia

Was thanked: 12 time(s) in 12 post(s)
Just looking at the very first part of the BUY signal:

Code:

value:=hhv(h,2);

entry:=cross(h,value);



does not compute!

How can the HIGH price cross the HHV(H,2)? It cannot.

I think you will have more success with something like this:

Code:

{BUY}
H>Ref(HHV(H,2),-1);


Armed with this knowledge, see how you go with the rest of the signals.


wabbit [:D]


wabbit  
#6 Posted : Wednesday, December 5, 2012 2:58:10 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,106
Location: Perth, Western Australia

Was thanked: 12 time(s) in 12 post(s)
Admin,

Seems the textbox control is still stripping code as HTML, the OP tried to post:

Code:

{sell order}
cross(ref(c,-1),l) or C <( ref(c,-1))





Still some work to do??

wabbit [:D]

supremeinfo  
#7 Posted : Wednesday, December 5, 2012 7:56:17 AM(UTC)
supremeinfo

Rank: Member

Groups: Registered, Registered Users
Joined: 8/8/2012(UTC)
Posts: 15

Hi Wabbit Thanks for your help....can manage the buy & sell signals....what i do not know is how to reset the counter..the current code is showing just 1 trade when tested on 2000 bars of data loaded in chart Warm regards supremeinfo
wabbit  
#8 Posted : Wednesday, December 5, 2012 4:26:05 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,106
Location: Perth, Western Australia

Was thanked: 12 time(s) in 12 post(s)
You haven't given enough information about the exit criteria.

supremeinfo wrote:
3:EXIT LONG:when price crosses previous day low
4:EXIT SHORT:when price crosses previous day high


Are you exiting immediately at the previous bar's LOW/HIGH price, or are you exiting at the CLOSE price of the latest bar if the threshold is broken? If the first, then use a pending order to close the trade at the previous bar LOW/HIGH. If the second case, use "normal code" for the latest bar extreme price compared to the previous bar extreme price.

supremeinfo wrote:
5:on opening the long position,if price closes below previous day close price,long should be closed same day,do just opposite for short position.

If this criteria only exists on the bar on which the trade is opened, you're going to have to call the Simulation function library to determine the current position age and apply the exit criteria only for the required bar(s).


On another note, how do you expect to exit at the CLOSE price of the bar? The bar is closed which means the price is finalised, which means there are no more trades on that bar, which means you cannot trade. In real life, if you determine your entry/exit criteria based on CLOSE price, the next opportunity you have to trade is on the OPEN of the next bar, and you should be building your system tests to reflect the way trading occurs in real life.


wabbit [:D]




Users browsing this topic
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.