Hello everyone,
How do I write a code based on the example below.
For example:
If current price CLOSE is above EMA 5 HIGH take buy trade
If current price CLOSE is below EMA 5 LOW take sell trade
You can get the value of the EMAs using iMA:
* MT4: https://docs.mql4.com/indicators/ima
* MT5: https://www.mql5.com/en/docs/indicators/ima
Then, you can get the value of the previous close using iClose.
Then, compare the values check if they meet your buy / sell criteria.
Also, specify which version of MT you're programming for so it's easier to help you out.
- docs.mql4.com
Try it: Two iMA High Low Simple
Hello Everyone,
I am new to ea's but I am trying out a few courses and trying to get my head around it all.
in the mean time, how do I:-
1. if a position has been opened on say a 4 hour candle,
and if its still open
or if closed
don't open another position on candle "0"
2. If a position is open on candle "0"
Close the trade on the close of candle "0"
3. Use a trailing stop on whatever position is open.
If only I understood coding as I do english.... soon, hopefully. Thanks
ps, im learning mt4. for starters
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 (2014)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone,
How do I write a code based on the example below.
For example:
If current price CLOSE is above EMA 5 HIGH take buy trade
If current price CLOSE is below EMA 5 LOW take sell trade