당사 팬 페이지에 가입하십시오
Exp_ColorX2MA_X2 - MetaTrader 5용 expert
- 조회수:
- 2961
- 평가:
- 게시됨:
- 2018.07.09 11:08
- 업데이트됨:
- 2023.03.29 13:48
- 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
Trend-following trading system Exp_ColorX2MA_X2 is based on the signals of two indicators ColorX2MA. The first indicator determines the direction of the slow trend based on the line color. The second indicator determines the moment for opening a trade, when the line color changes. The signal is formed when a bar is closing if two conditions are met:
- Signals of the fast and slow trend match;
- Direction of the fast trend has changed.
Input parameters of the Expert Advisor
//+-------------------------------------------------+ //| Input parameters of the EA indicator | //+-------------------------------------------------+ sinput string Trade="Trade Management"; //+============== TRADE MANAGEMENT ==============+ input double MM=0.1; //Share of a deposit in a deal input MarginMode MMMode=LOT; //Lot value detection method input uint StopLoss_=1000; //Stop Loss in points input uint TakeProfit_=2000; //Take Profit in points sinput string MustTrade="Trade Permissions"; //+============== TRADE PERMISSIONS ==============+ input int Deviation_=10; //Max price deviation in points input bool BuyPosOpen=true; //Permission to enter long positions input bool SellPosOpen=true; //Permission to enter short positions //+-------------------------------------------------+ //| Input parameters of the filter indicator | //+-------------------------------------------------+ sinput string Filter="SLOW TRADE PARAMETERS"; //+============== TRADE PARAMETERS ==============+ input ENUM_TIMEFRAMES TimeFrame=PERIOD_H6; //1 Chart period for the trend input Smooth_Method MA_Method1=MODE_SMA_; //first-smoothing averaging method input uint Length1=12; //first smoothing depth input int Phase1=15; //first smoothing parameter, 3//---- for JJMA within the range of -100 ... +100 it influences the quality of the transition process; //---- for VIDIA it is a CMO period, for AMA it is a slow average period input Smooth_Method MA_Method2=MODE_JJMA; //second-smoothing averaging method input uint Length2= 5; //second smoothing depth input int Phase2=15; //second smoothing parameter, 3//---- for JJMA within the range of -100 ... +100 it influences the quality of the transition process; //---- for VIDIA it is a CMO period, for AMA it is a slow average period input Applied_price_ IPC=PRICE_CLOSE_;//price constant input uint SignalBar=1; //Bar index to get receive signal input bool BuyPosClose=true; //Permission to exit long positions by trend input bool SellPosClose=true; //Permission to exit short positions by trend //+-------------------------------------------------+ //| Input parameters of the entry indicator | //+-------------------------------------------------+ sinput string Input="ENTRY PARAMETERS"; //+=============== ENTRY PARAMETERS ===============+ input ENUM_TIMEFRAMES TimeFrame_=PERIOD_M30; //2 Chart period for entry input Smooth_Method MA_Method1_=MODE_SMA_; //first-smoothing averaging method input uint Length1_=12; //first smoothing depth input int Phase1_=15; //first smoothing parameter, 3//---- for JJMA within the range of -100 ... +100 it influences the quality of the transition process; //---- for VIDIA it is a CMO period, for AMA it is a slow average period input Smooth_Method MA_Method2_=MODE_JJMA; //second-smoothing averaging method input uint Length2_= 5; //second smoothing depth input int Phase2_=15; //second smoothing parameter, 3//---- for JJMA within the range of -100 ... +100 it influences the quality of the transition process; //---- for VIDIA it is a CMO period, for AMA it is a slow average period input Applied_price_ IPC_=PRICE_CLOSE_;//price constant input uint SignalBar_=1;//Bar index to receive an entry signal input bool BuyPosClose_=false; //Permission to exit long positions by signal input bool SellPosClose_=false; //Permission to exit short positions by signal //+-------------------------------------------------+
String parameters with text in the code of input parameters are only for better visualization of the input parametera window of the expert.
The ColorX2MA_HTF indicators in the EA are only intended for a more convenient visualization of trends in the strategy tester, and they are inactive in other operation modes.
For the generated EA to operate correctly, the compiled files of indicators ColorX2MA.ex5 and ColorX2MA_HTF.ex5 must be in the <terminal_data_directory>\MQL5\Indicators folder.
Note that the TradeAlgorithms.mqh library file allows using Expert Advisors with brokers who offer nonzero spread and the option of setting Stop Loss and Take Profit together with position opening. You can download more variants of the library at the following link: Trade Algorithms.
Default Expert Advisor's input parameters have been used during the tests shown below. Stop Loss and Take Profit have not been used during the tests.
Testing results for USDJPY over the year 2016, slow trend on H6, and entry by fast trend on M30:
Fig 1. Examples of deals on the chart
Fig. 2. Testing results chart
MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/21001
Moving average AbsolutelyNoLagLwma displaying the most recent values as a price label, with the possibility to round the indicator levels to a required number of digits.
ColorXDerivativeIndicator Derivative additionally smoothed and made as a color histogram
Indicator ColorX2MA with the timeframe selection option available in the input parameters
Exp_BlauErgodicMDI_TmA trading system using oscillator BlauErgodicMDI with the option of strictly setting a trading time interval