I am trying to draw Arrows Based on another indicator's signal from higher timeframe, but the problem i am facing is that it draws the arrow on multiple candles
For example : If I check the arrow visibility on W1 timeframe and have the my indicator draw the arrow on D1 timeframe it will draw 5 arrows on 5 daily candles for the weekly candle where the arrow appeared , but i cant figure out how to limit it to only place the arrow on one candle and not all five.
here is my code:
for(int i = limit-1; i >= 0; i--)
{
int barshift_W1 = iBarShift(Symbol(), PERIOD_W1, Time[i]);
if(barshift_W1 < 0) continue;
//Indicator Buffer 1
if(iCustom(NULL, PERIOD_W1, "Arrow Indicator", 0, barshift_W1) != EMPTY_VALUE
)
{
Buffer1[i] = iLow(NULL, PERIOD_W1, barshift_W1) - iATR(NULL, PERIOD_CURRENT, 14, i);
}
else
{
Buffer1[i] = EMPTY_VALUE;
}
//Indicator Buffer 2
if(iCustom(NULL, PERIOD_W1, "Arrow Indicator", 1, barshift_W1) != EMPTY_VALUE
)
{
Buffer2[i] = iHigh(NULL, PERIOD_W1, barshift_W1) + iATR(NULL, PERIOD_CURRENT, 14, i);
}
else
{
Buffer2[i] = EMPTY_VALUE;
}
}