Join our fan page
- Published by:
- Vladimir Karputov
- Views:
- 11487
- Rating:
- Published:
- 2018.08.23 13:26
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
The author of the idea: Scriptor
MQL5 code author: barabashkakvn
The EA only operates when a new bar appears. Position volume is always fixed and set in the Lots parameter. Stop Loss, Take Profit and Trailing Stop parameters can be disabled - to do this, set the appropriate value to "0.0". The last Trailing Step parameter - trailing step.
Two Moving Averages (First and Second) are used. The crossing is defined in a very simple way (this is not the most accurate method, but it is the easiest one) - by analyzing the indicators values on two adjacent bars:
//--- Buy Signal if(MA_First[1]>MA_Second[1]+ExtMA_MinimumDistance && MA_First[2]<MA_Second[2]-ExtMA_MinimumDistance) ... //--- Sell signal if(MA_First[1]<MA_Second[1]-ExtMA_MinimumDistance && MA_First[2]>MA_Second[2]+ExtMA_MinimumDistance) ...
where:
- MA_First[1] - First indicator value on bar #1;
- MA_First[2] - First indicator value on bar #2;
- MA_Second[1] - Second indicator value on bar #1;
- MA_Second[2] - Second indicator value on bar #2;
- ExtMA_MinimumDistance - calculated parameter of the minimum distance between the indicators (Minimum distance between MA's). This parameter can be completely disabled: to do this, set the parameter to "0.0" in the inputs.
Then each signal is checked by the filter using the Momentum indicator - the Momentum filter parameter override is checked.
Visually, this looks as follows:
Test on EURUSD M15:
Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/21515
![Rj_SlidingRangeRj_Digit_System_HTF](https://c.mql5.com/i/code/indicator.png)
The Rj_SlidingRangeRj_Digit_System indicator with the timeframe selection option available in the input parameters.
![Rj_SlidingRangeRj_Digit_System](https://c.mql5.com/i/code/indicator.png)
The indicator paints candles going beyond the Rj_SlidingRangeRj_Digit channel.
![Separate Trade](https://c.mql5.com/i/code/expert.png)
iATR (Average True Range, ATR) and iStdDev (Standard Deviation, StdDev) indicators are configured for crossing of the two iMAs (Moving Average, MA) plus for Buy and Sell separately.
![IdeaTrend](https://c.mql5.com/i/code/indicator.png)
IdeaTrend is meant for checking a trend defining idea.