int Bars
Number of bars in the current chart.
Number of bars in the current chart.
in your example shift is always smaler then Bars!
the current bar is the bar 0. so what you want is,
for (int shift = 1000; shift >= 0; shift--){
/*do what you want*/
}
Thank You
for(shift = MathMin(1000,Bars-1); shift > 0; shift--)Tester only gives 100 bars of history. Don't exceed array sizes.
Hi! I've been trying to make an indicator that shows me when to enter and leave trades.
I thought of making something like this
for(shift = 1000; shift < Bars; shift--)
{
ma5c=iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift);
ma5o=iMA(NULL,0,5,0,MODE_EMA,PRICE_OPEN,shift);
if((ma5o > ma5c))
{
if(Display_Sell == true)
{
ObjectCreate(PatternText[shift], OBJ_TEXT, 0, Time[shift],
High[shift]);
ObjectSetText(PatternText[shift], "Sell", 10,
"Times New Roman", Red);
downArrow[shift1] = High[shift1];
}
}
}
The idea is to start searching from the last 1000 bar to the present so when the loop first finds an entry point it'll then find an exit point.
The problem is when i compile a simple loop like the one above the platform crash.
Can you help me solving this?
thank's