SetOption("PriceBoundChecking", True) doses't really work like it's
suppose to do. That would be a nice future feature of Amibroker to
have actually.
I like to enter a trade NOT at the open or close of the next trading
day but with a certain price level. I like the backtester to
eliminate those trades that wouldn't go through of course. Any help
would be greatly appreciated..
Three
--- In [email protected], "Andy" <se...@...> wrote:
>
> Okay, I think I'm getting closer thankful to the Yahoo Search engine
> that now works.
>
> I'm now using the SetTradeDelays function so that the backtester will
> trade the following day. I have the revised code below thinking that
> this will backtest using today's signals to either buy or sell
> tomorrow using tomorrow's price targets. The AmiBroker explorer
> function will report Next Day's Target prices every day. Is the
> below code legit for this? Am I missing something or do you have an
> comments?
>
> Thank you!
>
> Three
>
>
>
>
> // Simple ATR Script by Andrew Senft
> //
>
> // One position at a time
> SetOption("MaxOpenPositions", 1 );
>
> // Trade tomorrow
> SetTradeDelays(1,1,0,0);
>
> // Make sure that tomorrow's price is tradable
> SetOption("PriceBoundChecking", True);
>
> // Optimization
> BuyOffSet = 2; //Optimize("BuyOffSet",2,1,20,1);
> BuyATRPeriod = 1; //Optimize("BuyATRPeriod",1,1,5,1);
> ATRMultiplier = 1; //Optimize("ATRMultiplier",1,0.7,1.20,.1);
>
> // ATR funciton
> Graph8 = HHV(High - ATRMultiplier * ATR(BuyATRPeriod), BuyOffset);
>
> // Finding a Buy or Sell signal
> Buy = Cross(Close,Graph8);
> Sell = Cross(Graph8,Close);
>
> // Either Buy or Sell it
> Buy = ExRem(Buy,Sell);
> Sell = ExRem(Sell,Buy);
>
> // Tomorrow's target prices
> BuyPrice = Ref(Graph8,-1);
> SellPrice = Ref(Graph8,-1);
>
> // Explore reporting every trading day
> Filter=(1);
> AddColumn( IIf(Buy==1,1,IIf(Sell==1,-1,0) ), "Long/Sell", 1.0);
> AddColumn( BuyPrice, "Tomorrow's Target Price");
> AddColumn( Graph8, "Today's Target Price" );
> AddColumn( ATR(BuyATRPeriod), "ATR " );
> AddColumn( O, "Open ");
> AddColumn( H, "High ");
> AddColumn( L, "Low ");
> AddColumn( C, "Close ");
>