I have tried just about everything!
1. I have tried to change the period that i am testing
2. I have tried changing the currency pair
3. I have changed the time frame
4. I have moved the EA to another broker's MT4 ST
5. I have changed the names of the variables
6. I have tried initializing it in the Expert initialization Function - int OnInit()
7. I have changed the code.
8. I have added additional code to change the value from "true" to "false"
NOTHING changes the value from "true" to "false". I cannot continue programming until I have solved the problem! Please help!
input int WPRoversold = -85; //WPR Bottom Level input int WPRoverbought = -15; //WPR Top Level input int WPR_MAPeriod = 30; //MA Period for WPR input int WPR_Period = 40; //WPR Period input ENUM_TIMEFRAMES WPR_Timeframe = PERIOD_H1; //WPR Timeframe input ENUM_MA_METHOD WPR_MAMethod = MODE_EMA; //MA Method for WPR
input int StochHighLevel1 = 84; input int StochHighLevel2 = 74; input int StochLowLevel1 = 24; input int StochLowLevel2 = 34;
This is always true, because of the double negation:
if(WPR < -WPRoversold)
And so causes WPR_OS to be set to true on every call.
Bloody Hell! Two negatives make a positive!
So that is why WPR_OS will NEVER be "false"!!!
THANKS A LOT FOR YOUR HELP!
Ok, also your array size looks bogus. It should be dependent on WPR_MAPeriod not WPR_Period.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a global bool variable (WPR_OS) that is set to "false" and I also have code that will set it to false under certain conditions but it will not be set to false when I run it in the ST.
I have even included it in the initialization function, int OnInit(), but still it refuses to be set to "false". Right from the start of running the EA in the ST on the very first Journal line it already shows "true".
I have another similar variable (WPR_OB) which gives no problem at all.
Why would something like this occur? I have now spent hours in trying everything I can but still it refuses to be changed to "false".
Here are some code and Journal transaction reports: