you need to set a NULL pointer to a variable int a = NULL;
int a = NULL; if(PositionsTotal() < 1) { if(a == NULL || a == 1) { a = 0; } else if(a == 0) { a = 1; } } Print(a);I will add my opinion: it is better to use the standard 0 because NULL is a compiler macro, and it can have a value other than 0
Pavel Shutovskiy: I will add my opinion: it is better to use
the standard 0 because NULL is a compiler macro, and it can have a value other than 0
I agree.
Don't use NULL.
- You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
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
https://stackoverflow.com/questions/58228952/how-to-update-variable-from-with-if-statement-mql5