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, can you help me with my custom dashboard? I’m sending all the necessary files. Let me know if you can work on it. Please check the indicator carefully—some people declined, and I don’t have the source code. I’ll also need a sample file before I can select you as the developer
Hello, I have a strategy written in Pine Script (TradingView) that used to send signals to MetaTrader 5 via PineConnector. Now I want a native MT5 Expert Advisor (EA) written in MQL5, so I can do full backtesting and trading inside MetaTrader without any external bridge. I will provide: - Full Pine Script code - Entry and exit rules (based on BOS and OB logic) - SL/TP and dynamic risk management (R:R) - Breakeven
Job Title: HFT-Style M1 Gold Scalper EA for Exness Broker – 100-200 Trades/Day Description: Need a high-frequency trading Expert Advisor for scalping XAUUSD (Gold) on M1 timeframe only. This is for personal live account on Exness broker (ECN type preferred). Requirements: • 100-200+ trades per day during high liquidity sessions (London/New York overlap). • Ultra-fast tick-by-tick execution, optimized for low latency
EA for Gold 30+ USD
I am looking for a good EA robot for gold that will be taking trades on 1 min chart and takes profits on 1$ move on gold. that can take as many entries as possible in a day. example: ENTRY ON 3000.00 AND TAKE PROFIT AT 3001.00. The robot will have all the trading knowledge and strategy with a high win rate
The void 40 - 300 USD
An AI, with a clear understanding, analysis and predictions of the market, based on the right information and experience on years of market structure, an AI that is ready to face and survive the hardest moments of the market and emerge victorious. Simply but the perfect tool for a day trader
Here are my confirmations for Milestone 1: Trading hours: RTH only (9:30–16:00 ET). Data period: Please test the maximum available history. A longer sample (ideally 10 years) is preferred, as it strengthens the diagnostic and regime analysis. This is for robustness of the assessment, not for optimization. Positioning: One trade at a time (no stacking). Directions: Long and short, strictly as defined by the rules
look at attachment! i dont know if it is a expert or indi what it needs to do is for whatever par you are on the timeframe must adjust to the slider realtime on chart as you slide the slider and the chart and loaded indicators chnag eto the trimeframe you slide to time frame range M1 to D1
I want an experienced developer to create an EA that works with a grid system. I have a video on how the EA works. I want an experienced developer who will use the video to create the same bot
Ninja Trader 8 - **** https://www.youtube.com/watch?v=iDXAA6hUt2M - Orderflows Trader vs NinjaTrader Volumetric Charts What Are The Differences Only watch this video as a reference point, this is the standard setting for Volumetric https://www.youtube.com/watch?v=YrI8byj9_mg - How to Setup Volumetric Footprint Charts in NinjaTrader 8 | Futures Day Trading Tutorial - by Bull Barbie -----------------------------------
I’m looking for a skilled MQL5 developer to help build and manage an automated trading system that bridges TradingView custom indicator alerts to an Exness MT5 account . This role involves capturing Buy/Sell signals and lot sizes from TradingView webhooks , processing them with a Python listener , and executing orders on MT5 hosted on a 24/7 VPS . The ideal candidate will ensure accurate trades, reliable execution

Informazioni sul progetto

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