if (candleOneOpen && candleOneClose < (movingAverage1 && movingAverage2))
The logic here is wrong.
candleOneOpen is not a boolean type and it likely doesn't contain a boolean value (0 or 1). The same is true for movingAverage1 and movingAverage2.
Try writing out the conditional statements into bool variables first, then decide the conditions to check in an if-statement. Not only is it easier to maintain multiple conditions but, when you look back at your code, it'll help you pick up where you left off.
Example:
bool isLowerOpen1 = candleOneOpen < movingAverage1; bool isLowerOpen2 = candleOneOpen < movingAverage2; bool isLowerClose1 = candleOneClose < movingAverage1; bool isLowerClose2 = candleOneClose < movingAverage2; bool isValidSellSignal = isLowerOpen1 && isLowerOpen2 && isLowerClose1 && isLowerClose2; if (isValidSellSignal) { // Print }
The logic here is wrong.
candleOneOpen is not a boolean type and it likely doesn't contain a boolean value (0 or 1). The same is true for movingAverage1 and movingAverage2.
Try writing out the conditional statements into bool variables first, then decide the conditions to check in an if-statement. Not only is it easier to maintain multiple conditions but, when you look back at your code, it'll help you pick up where you left off.
Example:
much appreciated man!
been stuck on this for a few hours now. really appreciate the help.
bool isLowerOpen1 = candleOneOpen < movingAverage1; bool isLowerOpen2 = candleOneOpen < movingAverage2; bool isLowerClose1 = candleOneClose < movingAverage1; bool isLowerClose2 = candleOneClose < movingAverage2; bool isValidSellSignal = isLowerOpen1 && isLowerOpen2 && isLowerClose1 && isLowerClose2;or
bool isValidSellSignal = MathMax(candleOneOpen, CandleOneClose) < MathMin(movingAverage1, movingAverage2);
- 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, when im using the code below to return the Print, it doesnt work. when i change the code from "<" to ">" it seems to work however. Not sure why "<" doesnt work though.
Any advice would be appreciated.