im new to coding mlq5 and as a beginner i tried to make a EMA (exponantial moving avarage) bot that shows a BUY comment when the price was going under the 50 EMA line while the 50 EMA was above the 100 EMA and the 150 EMA.
even though there is no error in the code in backtesting it does not show the BUY comment when this signal is happening. i was hoping some of you could help me further.
if (greenarray[0]>yellowarray[0]>redarray[0]True = non-zero and false = zero so you get
if( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true ) |
if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false ) |
True = non-zero and false = zero so you get
i'm not sure i follow how would this look in code?
True = non-zero and false = zero so you get
This is a nice reply. Explains precisely what is happening.
So the code starts to compare an integer with a boolean due to it testing multiple conditions at the same time.
void OnTick() { double d_Green = 4 ; double d_Yellow = 3 ; double d_Red = 2 ; double d_Close = 1 ; string Message_1 = NULL ; string Message_2 = NULL ; // VARIANT 1 if ( d_Green > d_Yellow > d_Red && d_Green > d_Close ) { Message_1 = "VARIANT 1 IS TRUE " ; } // VARIANT 2 if ( ( d_Green > d_Yellow ) && ( d_Yellow > d_Red ) && ( d_Green > d_Close ) ) { Message_2 = "VARIANT 2 IS TRUE " ; } Comment ( "DIVIDE AND RULE => " , Message_1 + Message_2 ) ; }
True = non-zero and false = zero so you get
thank you for your help this fixed my problem.
I also wanted to thank you everybody in this thread helped me fix my problem :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
im new to coding mlq5 and as a beginner i tried to make a EMA (exponantial moving avarage) bot that shows a BUY comment when the price was going under the 50 EMA line while the 50 EMA was above the 100 EMA and the 150 EMA.
even though there is no error in the code in backtesting it does not show the BUY comment when this signal is happening. i was hoping some of you could help me further.