Make the variable static...
static double OKShort;
as it stands, every new tick will reinitialise okshort to 0.
https://book.mql4.com/variables/types
hth
V
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I want OKShort to stay = 1 until the condition for OKShort = 2 is met. Right now, OKShort stays = 1 only on the bar where Low == ll. As soon as we hit the next bar, and Low != ll, then OKshort goes back to 0. I want it to stay at 1 until I assign a new value.
double hh;
double ll;
double OKShort;
//---- Set Variables
hh=High[iHighest(NULL,0,MODE_HIGH,Entry,0)];
ll=Low[iLowest(NULL,0,MODE_LOW,Entry,0)];
mid= NormalizeDouble(((hh+ll)/2),5);
if (Low == ll) OKShort = 1;
if (High == hh && OKShort == 1) OKShort = 2;