counting Candles and wait
hi guys, Suppose i have several nested conditions which every candle is checking and when all of them is true i want to waiting and counting 5 candle. how to do that?
int countingNewCandles(int sPos,int c,bool zero)
{
MqlRates priceData[];
ArraySetAsSeries(priceData,true);
CopyRates(Symbol(),Period(),sPos,c,priceData);
static int candleCounter;
static datetime timeStampLastCheck;
datetime timeStampCurrentCandle;
timeStampCurrentCandle=priceData[sPos].time;
if(zero)
{
candleCounter=0;
Print("counter has 0 value");
}
else
{
if(timeStampCurrentCandle!=timeStampLastCheck)
{
timeStampLastCheck=timeStampCurrentCandle;
candleCounter++;
}
}
Comment("Counted Candle since Chart : "+(string)candleCounter);
return candleCounter;
}
counter = countingNewCandles(0,3,false);
nothing happend! counter not change
I'm no expert but wouldn't it be easier to count back "x" candles (5 in your case) to see if the conditions are met.
That's how I handle such a task.
But as i said, I'm not an expert and I just do very basic coding for indicators and experts.
hi guys, Suppose i have several nested conditions which every candle is checking and when all of them is true i want to waiting and counting 5 candle. how to do that?