
- www.mql5.com
My advice: you need to write your own MQL5 code. This is the only way you can understand.
Are you ready to start?
My advice: you need to write your own MQL5 code. This is the only way you can understand.
Are you ready to start?
Yes I am ready to learn! I am currently working with your source code for: https://www.mql5.com/en/code/16849
My goal is to create my own version of this with a different method for stop loss. Also, to make it open trades based on a percentage rather than a
fixed lot size.

- www.mql5.com
Yes I am ready to learn! I am currently working with your source code for: https://www.mql5.com/en/code/16849
My goal is to create my own version of this with a different method for stop
loss . Also, to make it open trades based on a percentage rather than a fixed lot size.
This is an outdated code, now I switched to my more advanced engine "barabashkakvn Trading engine" (latest version 3.109). Literally the last code: iMA and Medium OHLC .
Description:
Trading strategy idea
The EA works (looking for signals to enter and / or exit) on the H1 timeframe and only at the time of the birth of a new bar.
At a given Start Hour hour, the direction of the trend is determined using the iMA (Moving Average, MA) indicator with a long MA Trend averaging period (it is recommended to take a period of at least 150 bars).
The trend is confirmed by two iMA indicators (Moving Average, MA) with periods much shorter than the trend ones - MA Fast and MA Slow . and the average bar price (high + low) / 2.
Determining the direction of the trend:
a record of the form MA Trend # 1 means: the value of the MA indicator (Moving Average, MA) on bar 1, the MA Trend indicator responsible for determining the trend is used
Trend Up: MA Trend # 1> MA Trend # 2, Trend Down: MA Trend # 1 < MA Trend # 2.
Trend confirmation:
a record of the form PRICE_MEDIAN # 1 means the average price of a bar, calculated by the prices of this bar: (high + low) / 2Trend Up: PRICE_MEDIAN # 1 < MA Fast # 1 AND MA Fast # 1> MA Slow # 1, Trend Down PRICE_MEDIAN # 1 < MA Fast # 1 AND MA Fast # 1 < MA Slow # 1.
More details about the advisor settings:
Please note: the trading signal has the highest priority! You can restrict its execution only using the Only one positions parameter. If Only one positions is “ true ” and the number of positions opened by this EA on this symbol is greater than “1”, then the trading signal is ignored.
The Close opposite parameter is " true ": first, CLOSE the opposite position, then process the trading signal.
Trading settings
In the adviser, you can turn on and off Stop Loss , Take Profit and Trailing Stop . To disable the selected parameter set to "0.0".
Trailing can be triggered either after N-seconds or only at the moment of birth of a new bar. Trailing interval in seconds is set in Trailing, in seconds . General rule: if the interval is set less than "10" - this means ONLY at the time of the birth of a new bar, if the interval is set exactly or more than "10" - this means work every "N" seconds.
Additional features
- Only one positions - there is always only one position in the market
- Close opposite - closing positions opposite to the trading signal, and first there is a guaranteed closing of the opposite position and only then opening a new position in the signal direction
Please note: the trading signal has the highest priority! You can restrict its execution only using the Only one positions parameter. If Only one positions is “ true ” and the number of positions opened by this EA on this symbol is greater than “1”, then the trading signal is ignored.
The Close opposite parameter is “ true ”: first, CLOSE the opposite position, then process the trading signal.
Position size management (lot calculation)
The lot can be either permanent ( Money management set in the Constant lot and set the lot size in The value for "Money management" ) or dynamic - in percentage of risk per trade ( Money management set in Risk in percent for a deal and set the percentage of risk in The value for "Money management" ). You can also set a permanent lot equal to the minimum lot - Set Money management to Lots Min .

- www.mql5.com
I can change the adviser and it will work just like the intersection of two iMAs. Necessary?
Busy doing a lot of learning so I can do it.
Yes, I am just looking to simply open a buy or sell on the crossing of the two iMA's. With account risk instead of fixed lot.
I want to create a stop loss if a candle closes above/below the slow iMA. Trailing stop would be ok too.
I can change the adviser and it will work just like the intersection of two iMAs. Necessary?
Busy doing a lot of learning so I can do it.
Yes, I am just looking to simply open a buy or sell on the crossing of the two iMA's. With account risk instead of fixed lot.
I want to create a stop
loss if a candle closes above/below the slow iMA. Trailing stop would be ok too.
Especially for you: Сrossing of the two iMAs

- www.mql5.com
Thank you so much for your help! I did not expect anyone to provide me with source code like this.
I now realize the major problem with this method and I will have to make significant changes. You have saved me a lot of time as I can now work on a solution as this is a failing strategy.
I will now attempt to create an EA that opens and closes orders upon contact with a slow exponential moving average. On the charts this seems to have a much higher chance of securing profits.
Thank you very much for the code!
Hello Vladimir,
Can you provide the same sample code for determining a crossing section between a floating value and a percent value?
Difficult to find something like that
Thanks

- 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 world,
I'm somewhat new to mql5 and forex automation in general.
Recently I have been brushing up on c++ for the purpose of developing my own EA.
I would greatly appreciate it if someone could provide me with a link to the source code of a working EMA cross strategy.
My goal is to enter trades based on the crossing of the two EMA's, but I do not want to close a trade based on the same condition. Rather, have the trade closed if the candle has closed passed the slower EMA.
Any template related to this method would be of great use to my learning. Previously I used FXDreema to try create a template like this, but found that it was incredibly hard to work with. It's almost like those EA builders are not usable unless you accept the exported file as is.
Not looking for a freelancer, just some friendly advice from any experienced developers :)
Thank you!