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 [email protected], "dbw451" <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED] > Sent: 03/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 >
