Hi,
when you declare a variable inside a {} block, it can only be used inside the block.
This is a very important fundamental of the MQL language - you should read the
documentation about variables and scope.
So you have to declare vol0 and vol1 before the if-statement.
Best regards
Please stop leaving your forum threads hanging! In all the threads you have started you have never come back to confirm if the answers given were satisfactory and resolved your issue or if you understood them. In all the cases you just left them hanging without a final response.
If you continue with this pattern of behavior, there will be a tendency to start ignoring your requests for help.
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.

- 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 want to define variables depending on a condition so I write
But mql4 says vol0 and vol1 are not defined when it tries to calculate my_double, whereas it is defined in all cases of the boolean CONDITION.