Second if statement is not executed after the first if statement's conditions comes false. My code is attached below. Please can someone point me in the right direction.
Second if statement is not executed after the first if statement's conditions comes false. Please can someone point me in the right direction.
what makes you think that? else if says it does get executed. most likely the conditions of the second if are also false.
use the debugger and check the values
Be careful of the if-else construct you are using. It can be very misleading.
This is what you are doing ...
if ( condition1 ) { // Something if ... } else if (condition2 ) { // Something else if ... };
This is what it is actually doing ...
if ( condition1 ) { // Something if ... } else { if (condition2 ) { // Something else if ... }; // Something else ... };
You can write it like this for more control ...
if ( condition1 ) { // Something if ... } else { if (condition2 ) { // Something else if ... } else { // Something else else ... }; // Something else ... };
You make a gross mistake: you create a new indicator handle on each tick. This is the biggest mistake!
According to the MQL5 style, the indicator handle is created ONCE!!! And this is done in OnInit.
Example:
An example of get values from the iRSI indicator
- 2020.07.05
- www.mql5.com
Second if statement is not executed after the first if statement's conditions comes false. Please can someone point me in the right direction.