Just I was searching that page only. I used this forum only for learning only, I am extremly sorry for that.
So please, can anybody help me in modifying the following code to get no of limited signals for the whole chart. The code I pasted here is copied from knowledge base, for limiting the no of signal for a new day, but I want to modify the code for the complete chart.
// trades limit
N = 2;
Plot( Close, "Close", colorDefault, styleBar );
// identify new day
dn = DateNum();
newDay = dn != Ref( dn,-1);
// buy and sell signals
Buy = Cross( MACD(), Signal() );
Sell = Cross( Signal(), MACD() );
// visualize signals with yellow arrows
PlotShapes(BuyshapeUpArrow, colorYellow, 0, Low);
PlotShapes(SellshapeDownArrow, colorYellow, 0, High);
// modify Buy array and allow only first N signals
Buy = Buy AND Sum( Buy, BarsSince( newDay) +1 ) <= N;
// visualize modified signals with green triangles
PlotShapes(Buy*shapeUpTriangle, colorGreen, 0, Low, -24);Code button `
The code is working. I want to use this code for Index option contracts which has life period of 1 month to 3 months only. My condition is very simple that I want to trade if price crossed on first crossover signal only.