Hi, this is really a very good strategy and works very well.
Can someone help me create Buy Sell signals for the same. I tried the same as follows but I am not able to backtest the same correctly.
//---------------------------------------------------------------------------
// Buy & Sell Conditions
//---------------------------------------------------------------------------
Buy = TimeFrameGetPrice("O",inDaily,0) == TimeFrameGetPrice("L",inDaily,0);
Short = TimeFrameGetPrice("O",inDaily,0) == TimeFrameGetPrice("H",inDaily,0);
Sell = TimeNum() >= 152500;
Cover = TimeNum() >= 152500;
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = ExRem(Short,Cover);
Cover = ExRem(Cover,Short);
BuyPrice = ValueWhen(Buy,O);
ShortPrice = ValueWhen(Short,O);
Filter = Buy OR Sell OR Short OR Cover;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorDarkBlue, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorBlue, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorDarkRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorGreen, 0,L, Offset=-45);
//---------------------------------------------------------------------------
// End of AFL
//---------------------------------------------------------------------------
Wanted the following features to be added in the AFL [to trade Nifty 50 & Nifty MidCap 100 scrips; No. of Lots = 4 and / or Maximum Amount per trade = Rs. 2,00,000; Maximum Loss per Trade is 2% of Trading Capital and Maximum Loss per day is 6% of Trading Capital] :
1) Set Position size,
2) Enter the trade at Open + 1 minute,
3) Initial Stop Loss at Low (if Open = Low) and at High (if Open = High),
4) Trailing Stop Loss,
5) Booking 25% of the Position once the scrip has moved 0.3%,
6) Booking another 25% of the position once the scrip has moved 0.5%
5) Squaring off the balance position at 3:25 PM on the same day.
Also, while backtesting this strategy, what settings should be used in the "Trades" window....(i.e., what should be the Buy Price, Sell Price, Short Price & Cover Price.) Also, should one use the Buy Delay / Sell Delay options and if yes, what is its significance and how should it be used.
Thnx in advance.