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

[amibroker] Re: Exit on Next Day Open



PureBytes Links

Trading Reference Links

Backtesting is definitely a good idea. But, you must backtest correctly ;)

At a glance, I see a couple of issues with your code:

1. You cannot set your BuyPrice/ShortPrice to yesterday's values without first verifying that that range has been hit.

In your code, you are saying to Buy if the Open is less than the previous day's Low and setting your BuyPrice at the previous day's Low. However, if the bar opened less than the previous day's Low and kept going *lower* you will have overstated your BuyPrice. Same thing with your ShortPrice. Instead you should be setting the value to Open.

2. Your delay logic is not correct. You need to be careful with BarsSince. If there are redundant Buy/Short signals since the first Buy/Short, your Sell/Cover will always be relative to the most recent one (i.e. the redundant signal that came *after* the original signal). As such your exit may only trigger much later than you expect. See ExRemSpan for how to handle fixed holding periods.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "haiguise" <sherif626@xxx> wrote:
>
> K got it, Thanks. I guess I am just trusting the stats of Backtesting on some sites at face value and when I do it in amibroker, the whole system blows up and loses its entire equity even though the signals are good. 
> --- In amibroker@xxxxxxxxxxxxxxx, "gariki003" <kcityg@> wrote:
> >
> > you can check if todays high rallied to yesterdays mid point; if the high did not rallie then neither did any other price.
> > 
> > H > Ref(your_yesterdays_average,-1)
> > 
> > HTH
> > -gariki
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "haiguise" <sherif626@> wrote:
> > >
> > > Got It, Thanks. Here is What I did. Now I am wondering, How can I Check if The Price of Today's Bar Rallied to the Mid point of Yesterday's Bar. Is that even Possible. So If Yesterday's Bar was O-2 H-4 L-1 C-2.5. I want to Make Sure that Today's Price rally to 3 Before I do a buy signal.
> > > //Larry Williams OOPS Pattern
> > > PositionSize = MarginDeposit = 1;
> > > PointValue=1;
> > > sellDelay = Optimize("sellDelay",1,1,50,1);
> > > coverDelay=Optimize("coverDelay",1,1,50,1);
> > > Buy = O<Ref(L,-1);
> > > BuyPrice=Ref(L,-1);
> > > Sell = BarsSince(Buy) == sellDelay; 
> > > SellPrice = O;
> > > Short = O>Ref(H,-1);
> > > ShortPrice=Ref(H,-1);
> > > Cover=BarsSince(Short)==CoverDelay;
> > > CoverPrice=O;
> > > Filter=Buy OR Sell;
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> wrote:
> > > >
> > > > SetTradeDelays( 1, 1, 1, 1 );
> > > > BuyPrice = Open;
> > > > SellPrice = Open;
> > > > 
> > > > Best regards,
> > > > Tomasz Janeczko
> > > > amibroker.com
> > > > ----- Original Message ----- 
> > > > From: "haiguise" <sherif626@>
> > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > Sent: Wednesday, July 29, 2009 8:14 PM
> > > > Subject: [amibroker] Exit on Next Day Open
> > > > 
> > > > 
> > > > >I have been searching the message board for this answer but I seem to not be able to get an answer. I am creating a System what I 
> > > > >want to do is Sell Today at the Open Price (Simple) and then Next Day Sell on the Open. How Do I write in AFL to sell Next Day. 
> > > > >Thanks
> > > > >
> > > > >
> > > > >
> > > > > ------------------------------------
> > > > >
> > > > > **** IMPORTANT PLEASE READ ****
> > > > > This group is for the discussion between users only.
> > > > > This is *NOT* technical support channel.
> > > > >
> > > > > TO GET TECHNICAL SUPPORT send an e-mail directly to
> > > > > SUPPORT {at} amibroker.com
> > > > >
> > > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> > > > > http://www.amibroker.com/feedback/
> > > > > (submissions sent via other channels won't be considered)
> > > > >
> > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > > > > http://www.amibroker.com/devlog/
> > > > >
> > > > > Yahoo! Groups Links
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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/