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

[amibroker] Re: Trade stop after GapUp or GapDown



PureBytes Links

Trading Reference Links

Thnx...this is working :-)
I think I will be able to make an extra argument now. During 
lunchtime its better to eat then to trade with this system. I think I 
can incorporate this now, so that I don't have to check my results 
manually.

Thanks again everybody for the help

--- In amibroker@xxxxxxxxxxxxxxx, "dbw451" <dbw451@xxx> wrote:
>
> 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@...] 
> 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
>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/