//Buy on Friday the ticker symbol with the best performance of the last 15 trading days. //Sell 5 weeks later //It calculates the PositionScore on the Close at a thursday then it enters a trade at the Open on a Friday AND closes this trade on the Open on a Thursday at least 22 bars after entry, //You will need the latest Version of Amibroker for this because of the break function). //Ed Pottasch & Samantha SetBarsRequired(10000,10000); SetOption("MaxOpenPositions", 1 ); PositionSize = -100; SetTradeDelays(0,0,0,0); PositionScore = IIf( Ref(ROC(C,15),-1) > 0, Ref(ROC(C,15),-1), 0); procedure sell_proc(Buy,Sellday) { global Sell;T global SellPrice; SellPrice = 0; Sell = 0; // sell delay in bars selldelay = 22; for (i = 1; i < BarCount; i++) { if (Buy[ i ]) { for (j = i + selldelay; j < BarCount; j++) { if (Sellday[ j ]) { Sell[ j ] = 1; i = j; break; } } } } } Buy = DayOfWeek() == 5; BuyPrice = O; sell_proc(Buy,DayOfWeek() == 4); SellPrice = O; SetChartOptions(0, chartShowDates); GraphXSpace = 5; Plot(C,"C",1,64); PlotShapes(IIf(Buy,shapeUpArrow,0),colorWhite, layer = 0, yposition = BuyPrice, offset = 0 );