Convert Indicator to EA

MQL4 Esperti

Specifiche

Add conditional buy n sell code for opening a trade and reverse closing code in the following ea code

- entry of buy at onset of blue dot

- exit of buy at onset of Pink dot

- entry of Sell at onset of pink dot

- exit of Sell at onset of blue dot 

 Var MA Indicator

//+------------------------------------------------------------------+

//|                                                  var_mov_avg.mq4 |

//|                                 Copyright © 2016, Dmitri Migunov |

//|                                            sniper_dragon@mail.ru |

//|                                                                  |

//|          Thanks for previous version 2004, GOODMAN & Mstera è AF |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2016, Dmitri Migunov"

#property link      "sniper_dragon@mail.ru"

#property version   "1.00"

      

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1  clrSienna

#property indicator_color2  clrBlue

#property indicator_color3  clrMagenta

#property indicator_color4  clrYellow


//---- input parameters

input

  int

    periodAMA = 50, // period of AMA

    nfast     = 15, // first noise filter parameter. Higher values make indicator less sensitive to spikes.

    nslow     = 10; // second noise filter parameter. Higher values make indicator less sensitive to spikes.


input

  double

    G   = 1.0,  // the power of filtered part in the moving average. Another way to make the signal line smoother.

    dK  = 0.1;  // doesn't really influence anything much.


input

  bool

    UseAlert  = false,  // if true then alerts will be used.

    UseSound  = false;  // if true then sound will be used in alerts.


input

  string

    SoundFile = "expert.wav"; // name of the sound file for alerts.


input

  int

    offsetInPips = 30;  // maximal offset signal dots from current price


//---- buffers

double

  kAMAbuffer[],

  kAMAupsig[],

  kAMAdownsig[],

  signalBuffer[];


//+------------------------------------------------------------------+

int

  cbars     = 0;


double

  slowSC,

  fastSC,

  dSC,

  dKPoint;


bool

  SoundBuy  = false,

  SoundSell = false;


//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int OnInit(void){

//---- indicators

  SetIndexStyle( 0, DRAW_LINE, 0, 2 );

  SetIndexStyle( 1, DRAW_ARROW, STYLE_SOLID, 2 );

  SetIndexArrow( 1, 159 );

  SetIndexStyle( 2, DRAW_ARROW, STYLE_SOLID, 2 );

  SetIndexArrow( 2, 159 );

  SetIndexStyle( 3, DRAW_ARROW, STYLE_SOLID, 1 );

  SetIndexArrow( 3, 159 );

   

  SetIndexBuffer( 0, kAMAbuffer );

  SetIndexBuffer( 1, kAMAupsig );

  SetIndexBuffer( 2, kAMAdownsig );

  SetIndexBuffer( 3, signalBuffer );

   

  IndicatorDigits( Digits );

  

//--- calculate this variables when start

  slowSC  = 2.0 / ( nslow + 1 );

  fastSC  = 2.0 / ( nfast + 1 );

  dSC     = fastSC - slowSC;

  dKPoint = dK * Point;


//--- initialization done

  return(INIT_SUCCEEDED);

}


//+------------------------------------------------------------------+

//| Custom indicator iteration function                              |

//+------------------------------------------------------------------+

int OnCalculate (const  int       rates_total,

                 const  int       prev_calculated,

                 const  datetime  &time[],

                 const  double    &open[],

                 const  double    &high[],

                 const  double    &low[],

                 const  double    &close[],

                 const  long      &tick_volume[],

                 const  long      &volume[],

                 const  int       &spread[])

{

  int

    pos = 0;

   

  double

    AMA,

    AMA0,

    signal,

    ER,

    ERSC,

    SSC,

    ddK;

  

  string

    message;

   

  if( prev_calculated == rates_total ) return( rates_total );

    

  cbars   = prev_calculated;

  

  if( rates_total <= ( periodAMA+2 ) ){

    return( rates_total );

  }


//---- check for possible errors

  if( cbars < 0 ) return(-1);


//---- last counted bar will be recounted

  if( cbars > 0 ) cbars--;

  

  pos   = rates_total - periodAMA - 2;

  AMA0  = close[ pos+1 ];

  

  for( int p=pos; p>=0; p-- ){

    signal    = MathAbs( close[ p ] - close[ p+periodAMA ] );

    ER        = signal / getNoise( close, p );

    ERSC      = ER * dSC;

    SSC       = ERSC + slowSC;

    ddK       = MathPow( SSC, G ) * ( close[p] - AMA0 );

    AMA       = AMA0 + ddK;

    AMA0      = AMA;

    

    int

      offset  = ( high[p] - low[p] ) / Point() * 2;


    if( offset < 5 )            offset = 5;

    if( offset > offsetInPips ) offset = offsetInPips;

    

    kAMAbuffer[p]   = AMA;

    kAMAupsig[p]    = 0;

    kAMAdownsig[p]  = 0;

    signalBuffer[p] = 0;


    if( MathAbs( ddK ) <= dKPoint )  continue;

    

    if( ddK > 0 ) kAMAupsig[p]    = AMA;

    if( ddK < 0 ) kAMAdownsig[p]  = AMA;


    if( kAMAupsig[p] != EMPTY_VALUE && kAMAupsig[p] != 0 && SoundBuy ){

      SoundBuy        = false;

      signalBuffer[p] = MathMin( close[p+1], low[p] ) - offset * Point;

      if( 0 == p )  showAlert( "BUY @ " + Ask );

    } 

  

    if ( !SoundBuy && ( EMPTY_VALUE == kAMAupsig[p] || 0 == kAMAupsig[p] ) ){

      SoundBuy = true;

    }

    

    if ( kAMAdownsig[p] != EMPTY_VALUE && kAMAdownsig[p] != 0 && SoundSell ){

      SoundSell       = false;

      signalBuffer[p] = MathMax( close[ p+1 ], high[p] ) + offset * Point;

      if( 0 == p )  showAlert( "Sell @" + Bid );

    }

  

    if( !SoundSell && ( EMPTY_VALUE == kAMAdownsig[p] || 0 == kAMAdownsig[p] )){

      SoundSell = true;

    }

  }

  


  return( rates_total );

}


double  getNoise( const double &close[], const int pos ){

  double

    noise = 0.000000001;

    

  for( int i=0; i<periodAMA; i++ ){

    noise += MathAbs( close[ pos+i ] - close[ pos+i+1 ] );

  }

  

  return noise;

}


void  showAlert( string message ){

  message  = TimeCurrent() + " " + Symbol() + " " + Period() + "M " + message;

  Comment( message );


  if( ! UseAlert ) return;

  if( UseSound ) PlaySound( SoundFile );

   

  Alert( message );

}


Thanks 

Con risposta

1
Sviluppatore 1
Valutazioni
(772)
Progetti
1039
44%
Arbitraggio
50
8% / 50%
In ritardo
116
11%
Gratuito
2
Sviluppatore 2
Valutazioni
(414)
Progetti
478
40%
Arbitraggio
7
43% / 29%
In ritardo
16
3%
Gratuito
3
Sviluppatore 3
Valutazioni
(39)
Progetti
44
16%
Arbitraggio
1
100% / 0%
In ritardo
7
16%
Gratuito
4
Sviluppatore 4
Valutazioni
(68)
Progetti
111
26%
Arbitraggio
17
6% / 71%
In ritardo
15
14%
Gratuito
Pubblicati: 9 codici
5
Sviluppatore 5
Valutazioni
(121)
Progetti
134
66%
Arbitraggio
36
25% / 56%
In ritardo
22
16%
Gratuito
Pubblicati: 10 codici
Ordini simili
hello great developer I’m looking for an experienced developer to build a high-speed trade copier that works both ways between MT4 and MT5 . The copier must support: MT4 → MT5 MT5 → MT4 MT5 → MT5 (example: Blueberry MT5 → FTMO MT5) The system will run on my own VPS (local copier, not cloud-based). Key Requirements Real-time / fast execution (low latency) Two-way copying (MT4 ↔ MT5) Support for multiple brokers
European Central Bank (ECB) Interest Rate Decision The European Central Bank left interest rates unchanged at its first policy meeting of 2026, in line with expectations. source: https://www.mql5.com/en/economic-calendar/european-union/ecb-interest-rate-decision '407332776' : added order #481999464 sell 0.01 BTCUSDm at market
I’m looking for developer to build an AI-assisted trading system for Metatader 5 . You to deliver, working MT5 module, AI module (Python or compatible), source codes for both This phase is focused strictly on core logic and AI integration , not UI or dashboards. Kindly reach out only if you have experience on AI integration and prove of past work
EA Expert MTA 4 30+ USD
I have my own indicator and needs to create EA expert working smoothly with it to hit the targets as defined in indicator: Technical approach: - The EA will read the indicator signals using Copy Buffer on the selected timeframe - The EA should hit indicator variable targets factor -​Auto-Entry: Instant execution when the signal appears. ​-Alerts: Mobile Push Notifications + Pop-up alerts. -​Money Management Auto-lot
저는 20 년 경력 의 나스닥 트레이더입니다 . 리스크 관리 규칙을 자동화해 줄 전문 MT5 Expert Advisor가 필요합니다. 요구 사항 은 다음과 같습니다. 1. 종목: 나스닥(US100/NAS100)만 지원 2. 최대 총 거래량: 0.20랏 (보통 0.02랏씩 여러 번 진입) 3. 자동 손절매: 신규 포지션 진입 시 $75 USD 손절매 자동 설정 4. 일일 손실 제한 : 일일 손익 이 - $ 150 USD 이하일 경우 모든 포지션 청산 및 당일 거래 차단 5. 안티 마틴 게일 : 기존 순 포지션이 손실 상태일 경우 신규 진입 차단 6. 피라미 딩 허용 : 기존 포지션 이 수익 상태 일 경우 추가 포지션 진입 허용 (최대 총 0.20 랏) 7. 손익분기점 기능 : 총 수익이 $100 USD 이상일 경우 모든 손절매 를 ( 평균 가격
I am in search of a profitable bot for scalping Gold. The bot should be ready as at now to trade in a live market with good consistency. It should have a low drawdown. No martingale or grid system. The developer should be able to send a demo so I can test. If you have any profitable EA, pls
Основной стандартный и единственный индикатор Параболическая SAR. Непосредственно работа робота. 1. Производится 1 сделка при начале нового тренда, тренд определяется индикатором Parabolic SAR. Пример: если точки расположены ниже цены - значит тренд восходящий, открывается покупка (по рынку), при смене тренда на снижение - точки становятся выше цены, происходит закрытие предыдущей сделки (если она была открыта), и
Hi, I’m looking to build an automated backtest for an ORB breakout strategy on NQ using 1-second data. Every trading day the opening range is built from 09:25:00 to 09:29:49 (New York time). At 09:29:50 two stop orders are placed: buy stop at OR high + offset points sell stop at OR low − offset points. Whichever triggers first becomes the trade and the other order is cancelled. The trade is managed with stop loss
I am in search of a profitable bot for scalping Gold. The bot should be ready as at now to trade in a live market with good consistency. It should have a low drawdown. No martingale or grid system. The developer should be able to send a demo so I can test. If you have any profitable EA, pls holla
Hello everyone, I am looking for an expert who is experienced with the Matriks IQ platform for the Turkish stock market. The project requires proficiency in C# coding within this environment. If you have prior experience or have developed algorithms on this platform, please reach out to me so we can discuss the details. Regards

Informazioni sul progetto

Budget
10 - 20 USD
Scadenze
da 1 a 2 giorno(i)