Hi, The following system seems to show the Shorts when I use Explore, but when I use backtest only one trade appears and it says it's an open long position. I'm new at AmiBroker so any guidance would be appreciated.
Thanks //Define EntryTrigger EntryTrigger = DaysUp AND CloseGTMA200 AND ATR30PGT15 AND HighGTMA103ATR5; //Define SELL Price for tomorrow - Todays high + 0.5 * ATR(2) ShortPrice = H + (0.5*ATR(2)); //Define stops and cover price //InitialStop = ShortPrice + Ref(6 * ATR(10),-1); InitialStop = ShortPrice + Ref(1.1*ATR(2),-1); ProfitStop = Ref(L, -2); ExitTrigger = L <= ProfitStop; //CoverPrice = IIf(O > Ref(ProfitStop, -1), O, Ref(ProfitStop, -2)); CoverPrice = profitstop; // You need to define the Buy and Sell signals for the // backtester, when going short // Sell = EntryTrigger; Buy = ExitTrigger; Short = EntryTrigger; Cover = ExitTrigger; // The explorer needs Filter to be set with your signals. //Filter = Buy; //Filter = Short OR Cover; //Filter = 1; Filter = Short; //Filter=1; AddColumn( H,"Todays High", 1.2 ); AddColumn(ATR(2),"ATR(2)",1.4); AddColumn(ATR(10),"ATR(10)",1.4); AddColumn(initialstop,"Initial stop",1.2); AddColumn(Profitstop,"Low 2 Days ago",1.2); AddColumn( EntryTrigger, "Short?", 1.2 ); AddColumn( ExitTrigger, "BuyBack?", 1.2 ); AddColumn( Close, "Close", 1.2 ); AddColumn( Daysup, "Days Up", 1.2 ); AddColumn( MA(C,200) ,"MA(200)",1.2); AddColumn( CloseGTMA200 ,"Close > MA200",1.2); AddColumn( (ATR(30)/C)*100 ," ATR(30)% > 1.5", 1.2 ); AddColumn( MA(C,10) + 3 * ATR(5),"High > MA(10)+3*ATR(5)", 1.2 ); AddColumn(HighGTMA103ATR5 ,"High above ma(10) + atr(5)*3",1.2); AddColumn( ShortPrice,"Sell at",1.2); AddColumn( ProfitStop,"Buy at",1.2); AddColumn( CoverPrice,"Cover at",1.2); // You might also want to have an automatic stop to // exit immediately when hit (because the way you have // InitialStop won't do much). ApplyStop(stopTypeLoss, stopModePoint, initialstop);
