I think you need a set of parens in the following:
 
Buy = Sum(buysig,pds21) > Sum(Sellsig,pds21) AND InSession AND NOT EOD AND 

NOT (bGapUp OR bGapDown);


  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of dbw451
Sent: Tuesday, March 06, 2007 5:32 PM
To: [email protected]
Subject: RE: [amibroker] Re: Trade stop after GapUp or GapDown



Ronald,

 

I think your problem might be your use of the GapUp() and GapDown()
functions.  I've never used either before, so without testing I can only go
by the documentation.  I think the functions set a single "true" value by
comparing the current bar to the previous bar.  Since you are using 5-minute
bars, a gap at the open would be purely coincidental.  Maybe you need to set
the timeframe to daily before using the GapUp() and GapDown() functions.
When you restore and expand the time frame, your bGapUp and bGapDown
variables should contain "true" for the entire day.

 

TimeFrameSet(inDaily);

bGapUp = GapUp();

bGapDown = GapDown();

TimeFrameRestore();

 

bGapUp = TimeFrameExpand(bGapUp,inDaily);

bGapDown = TimeFrameExpand(bGapDown,inDaily);

 

Buy = Sum(buysig,pds21) > Sum(Sellsig,pds21) AND InSession AND NOT EOD AND 

NOT bGapUp OR bGapDown; 

 

I don't have the time right now to test and verify the above code, but
hopefully it will help.

 

Regards,

 

David

 

 


  _____  


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of optiekoersen
Sent: 03/06/2007 3:56 PM
To: [email protected]
Subject: [amibroker] Re: Trade stop after GapUp or GapDown

 

Hmm, maybe I am doing something wrong. I will give a part of the 
code. Should have provided that earlier...

BTStartTime1 = ParamTime("Backtesting SOD","09:00:01");
BTEndTime1 = ParamTime("Backtesting EOD","17:20:00");
EOD = TimeNum() >= BTEndTime1;
SOD = TimeNum() >= BTStartTime1;
SOD = SOD != Ref(SOD,-1);
EOD = EOD != Ref(EOD,-1);
InSession = Flip( SOD, EOD);

//then comes my system//

EnableSessionTiming = ParamToggle("Enable Session Timing","NO|YES",1);
if( EnableSessionTiming )

Buy = 

Sum(buysig,pds21) > Sum(Sellsig,pds21) AND InSession AND NOT EOD AND 
NOT GapUp() OR GapDown(); 

I hope this makes it something clearer....

The code for the startsession was posted here on the forum before, I 
borrowed it :-)

Greets Ronald 



 

Reply via email to