Alert after every candle close

  • Thread starter Thread starter ogwedhi
  • Start date Start date
  • Watchers Watchers 2
The arrow array (arrowar) you are checking for a Buy alert isn't zero by default. When there is no arrow, the array's value is EMPTY_VALUE. So, you need to change > 0 to != EMPTY_VALUE.

However, this won't fix everything for you.

You also need to check color array (arrowcl you are checking for a Sell alert) to determine whether it is a Buy or Sell signal.

arrowar assumes a non-empty value whenever there is any signal at all - be it Buy or Sell. Then the arrowcl array is changed based on whether it is a Buy (0) or Sell (1), so your two conditions have to look like this:

MQL5:
if ((arrowar[rates_total - 1 - TriggerCandle] != EMPTY_VALUE) && (arrowcl[rates_total - 1 - TriggerCandle] == 0) && ((TriggerCandle > 0) || ((TriggerCandle == 0) && (LastAlertDirection != 1))))

MQL5:
if ((arrowar[rates_total - 1 - TriggerCandle] != EMPTY_VALUE) && (arrowcl[rates_total - 1 - TriggerCandle] == 1) && ((TriggerCandle > 0) || ((TriggerCandle == 0) && (LastAlertDirection != -1))))