[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

Or you could do as I suggested before and make the Start time conditional to the opening gap which makes your InSession variable aware of the opening gap:

 

BTStartTime1 = ParamTime("Backtesting SOD","09:00:01");

BTStartTime2 = ParamTime("Backtesting SOD Gap","10:30:01");

BTEndTime1 = ParamTime("Backtesting EOD","17:20:00");

 

TimeFrameSet(inDaily);

bGapUp = GapUp();

bGapDown = GapDown();

TimeFrameRestore();

 

bGapUp = TimeFrameExpand(bGapUp,inDaily);

bGapDown = TimeFrameExpand(bGapDown,inDaily);

 

GapStartTime = IIf(bGapUp OR bGapDown, BTStartTime2, BTStartTime1);

InSession = TimeNum() >= GapStartTime AND TimeNum() <= BTEndTime1;

 

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

 

Regards,

 

David

 


Re: Trade stop after GapUp or GapDown

 

Thnx for your help. It is not totally what I am looking for but it
comes close. Now it the system will skip a whole trading day if it
starts with a gap. My original idea was to delay the start, till the
effect of the gap has disappeared. But it is possible to
change "indaily" into "inhourly", which doesn't give good results.
But thats also good to know that the system seems to be able to beat
the gap problems :-)

Thnx again for the help!

Greets Ronald

 

 


From: dbw451 [mailto:dbw451@xxxxxxxxxxx]
Sent: 03/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

__,_._,___