[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Re: Trade stop after GapUp or GapDown



PureBytes Links

Trading Reference Links

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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of dbw451
Sent: Tuesday, March 06, 2007 5:32 PM
To: amibroker@xxxxxxxxxxxxxxx
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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of optiekoersen
Sent: 03/06/2007 3:56 PM
To: amibroker@xxxxxxxxxxxxxxx
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

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___