Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2017.01.26 09:05

CrossMA - expert for MetaTrader 5

| English Русский 中文 Español Deutsch 日本語 Português

Published by:
Vladimir Karputov
votes: 13
CrossMA.mq5 (29.07 KB)view

Author of the idea — George F.Peskov, author of the MQL5 code — barabashkakvn.

Trading system based on intersection of two iMA (MA) stop loss is set automatically based on the value of ATR. Email message is sent whenever a position is opened or closed. Parameters can be selected by backtesting.

Getting the indicator values on the first and second bars:

//--- get Moving Average
   mas=iMAGet(handle_iMA1,1);       // long moving average 12
   maf=iMAGet(handle_iMA2,1);       // short moving average 4
   mas_p=iMAGet(handle_iMA1,2);     // long moving average 12
   maf_p=iMAGet(handle_iMA2,2);     // short moving average 4

Check conditions for selling:

//--- Condition for selling
   if(maf<mas && maf_p>=mas_p)
      double lots=LotsOptimized();
      double stop_loss=NormalizeDouble(m_symbol.Ask()+Atr,Digits());
      if(SndMl==true && res)
         sHeaderLetter="Operation SELL by"+Symbol()+"";
         sBodyLetter="Deal Sell by"+Symbol()+" at "+DoubleToString(m_symbol.Bid(),Digits())+
                     ", and set stop/loss at "+DoubleToString(stop_loss,Digits())+"";

Check conditions for buying:

//--- Condition for buying
   if(maf>mas && maf_p<=mas_p)
      double lots=LotsOptimized();
      double stop_loss=NormalizeDouble(m_symbol.Bid()-Atr,Digits());
      if(SndMl==true && res)
         sHeaderLetter="Operation BUY at"+Symbol()+"";
         sBodyLetter="Deal Buy at"+Symbol()+" for "+DoubleToString(m_symbol.Ask(),Digits())+
                     ", and set stop/loss at "+DoubleToString(stop_loss,Digits())+"";


Translated from Russian by MetaQuotes Software Corp.
Original code:

RT Scalper RT Scalper

Real time indicator designed for scalping on FORTS.

Exp_FisherTransform_X2 Exp_FisherTransform_X2

The Exp_FisherTransform_X2 trend trading system based on the signals from two FisherTransform indicators.

Exp_2pbIdealMA_ReOpen Exp_2pbIdealMA_ReOpen

The Exp_2pbIdealMA EA is based on the crossing of Moving Averages with position scaling according to the trend.

Fractal_CCI Fractal_CCI

Fractal Commodity Channel Index.