Matthew Finch: Is it possible in MT4 to set a variable to a level or indicator and use the variable instead?
In every programming language in existence.
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
Hi,
I'm totally new to coding on MT4/MQL4 and had a question, maybe a dumb one. I have a Portfolio EA which contains 100 individual EA strategies. It works quite well but each time I want to tweak the SL or TP, I need to change 100 lines of code. Boring. Is it possible in MT4 to set a variable to a level or indicator and use the variable instead?
Example 1 : Instead of saying -
Take Profit = 25 (and repeating this 100 times in the code for each EA)
I would have something like
x = 25
Take Profit = x
- and therefore just change the initial assignment of x to change up the value.
Example 2: Instead of saying -
x = ATR of Current Daily Chart
Take Profit = x/2
I dont need anyone to write the code for me :) That would take the fun out of learning - I read some technical docs and see that all needs to declared first etc, but at this stage I would just like to know if it's technically possible.
Thanks
Matthew