&& iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 1, 1+i) == EMPTY_VALUE
I don't get a signal when I am supposed to, so I was just wondering if there was something wrong with the logic
I don't get a signal when I am supposed to, so I was just wondering if there was something wrong with the logic
Forum on trading, automated trading systems and testing trading strategies
How to ask and indicator to look for empty buffeer value
Alain Verleyen, 2016.01.29 08:08
Please show the relevant code.if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation
//Indicator Buffer 1
if(iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 1, i) != 0 && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 1, i) != EMPTY_VALUE //NonLagMAv8 is not equal to fixed value
&& iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 2, 1+i) != 0 && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 2, 1+i) != EMPTY_VALUE //NonLagMAv8 is not equal to fixed value
// && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 1, 1+i) != 0 && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 1, 1+i) != EMPTY_VALUE //NonLagMAv8 is not equal to fixed value
// && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 2, 2+i) != 0 && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 2, 2+i) != EMPTY_VALUE //NonLagMAv8 is not equal to fixed value
&& iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NL2Price, NL2Length, 0, 0, 1, 1, 0, 0, 0, 1, i) != 0 && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NL2Price, NL2Length, 0, 0, 1, 1, 0, 0, 0, 1, i) != EMPTY_VALUE //NonLagMAv8 is not equal to fixed value
&& iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 1, 1+i) == EMPTY_VALUE
)
{
Buffer1[i] = Low[i] - iATR(NULL, PERIOD_CURRENT, 14, i) - ArrowPos * myPoint; //Set indicator value at Candlestick Low - Average True Range - fixed value
// if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Buy"); time_alert = Time[0]; } //Instant alert, only once per bar
if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Buy"); //Alert on next bar open
}
Is it also possible for the system to look for 2 buffers on a particular candle. For example it is not uncommon for NonLagMA to have 2 buffer entries for both UP and DOWN on the same candle when it is changing.
So is my statement below logically correct for the system to look one candle back and for it to have a value in BUY and SELL buffer, or does this confuse the system.
iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 2, 1+i) != 0 && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 2, 1+i) != EMPTY_VALUE //NonLagMAv8 is not equal to fixed value
&& iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 1, 1+i) != 0 && iCustom(NULL, PERIOD_CURRENT, "NonLagMAv8", NLPrice, NL1Length, 0, 0, 1, 1, 0, 0, 0, 1, 1+i) != EMPTY_VALUE //NonLagMAv8 is not equal to fixed value
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I am trying to code an indicator which looks for a change in NonlagMA.
However I keep running into trouble because when the NOnlagMA changes or thinks about changing direction it will populate the Bufferr for both UP and DOWN.
Assumning I am looking for Up signal. I can tell the indicator to look at look at the UP buffer and when this is pouplated, to then look at previous value (shift 1) to make sure it was a down value.
That works. the problem occurs on the next candle which also fulfils this criteria, because the candle that has a change populates both UP and DOWN buffer.
I only want the one signal. Am I able to use a command such as == EMPTY_VALUE to look for an empty buffer.
I tried this but I run into trouble.
Is there any other way to tell MQ4 code to make sure there is no value in the Buffer?
Thanks in advance.