lucalupi75
Прохожий
[lang=it]Hello everyone,
I ask your help regarding the issue that arises when I nest an if condition inside another if condition: the code does not do what is contained within the second condition, even when the condition is true. I tried to reverse the order of the conditions (the first if replaces the second one and vice versa) but nothing has changed: the second condition is not taken into account.
Below I show part of a codeto explain the point:
if ((myHigh-myClose)<=(1/3)*(myHigh-myLow)) //First If
//if (myOpen>myClose)
{
Print("Check_If_1");
//if ((myHigh-myClose)<=(1/3)*(myHigh-myLow))
if (myOpen>myClose) //Second If
{
Print("Check_If_2");
}
Print("Check_AfterSecondIf");
}
Basically the code has to write, in the Journal of the Tester, the string "Check_If_1" when the first condition is true and "Check_If_2" when the second one is true. When the first condition is true it is also expected to write the string "Check_AfterSecondIf".
Indeed the Journal will contain only the strings "Check_If_1" and "Check_AfterSecondIf, but never the string" Check_If_2: this confirms that the instructions in the second if, nested to the first one, are not taken into account.
I attach the complete EA, which the above code is part of. I saved two versions: in the second one the order of conditions is reversed:
I ask, if possible, indications from you on how to address the problem.
Thanks for your attention and have a good day![/lang]
I ask your help regarding the issue that arises when I nest an if condition inside another if condition: the code does not do what is contained within the second condition, even when the condition is true. I tried to reverse the order of the conditions (the first if replaces the second one and vice versa) but nothing has changed: the second condition is not taken into account.
Below I show part of a codeto explain the point:
if ((myHigh-myClose)<=(1/3)*(myHigh-myLow)) //First If
//if (myOpen>myClose)
{
Print("Check_If_1");
//if ((myHigh-myClose)<=(1/3)*(myHigh-myLow))
if (myOpen>myClose) //Second If
{
Print("Check_If_2");
}
Print("Check_AfterSecondIf");
}
Basically the code has to write, in the Journal of the Tester, the string "Check_If_1" when the first condition is true and "Check_If_2" when the second one is true. When the first condition is true it is also expected to write the string "Check_AfterSecondIf".
Indeed the Journal will contain only the strings "Check_If_1" and "Check_AfterSecondIf, but never the string" Check_If_2: this confirms that the instructions in the second if, nested to the first one, are not taken into account.
I attach the complete EA, which the above code is part of. I saved two versions: in the second one the order of conditions is reversed:
I ask, if possible, indications from you on how to address the problem.
Thanks for your attention and have a good day![/lang]