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 👋 I want to build three bots that work in different ways. I am excited to share this experience with you. I want to finish the first bot first, then we move on to the second bot, and so on. First, about the first bot, I want it this way. I want it to be a member of a public channel on Telegram (but this channel prevents copying messages; I mean, when you long-press a message, you can't copy it). I searched
We need a skilled MT5 developer to build a fully automated Expert Advisor optimized for XAUUSD with low to medium risk and a strict maximum drawdown of 10 percent. Account sizes 20K to 50K USD, including prop firm accounts. Requirements • Full MQ5 source code with clear comments • Commercial usage rights for our company • Strategy: trend or breakout, strict SL and TP on every trade, no martingale, no unlimited grid •
Hi! I’m looking for an experienced ThinkorSwim/ThinkScript developer to implement it exactly as specified. Please read the requirements below carefully and reply with: (1) a fixed-price quote, (2) earliest start date and ETA, (3) a short summary of similar ThinkScript work you’ve done (links or screenshots if available), and (4) any questions or clarifications. Project summary Create a ThinkorSwim (ThinkScript)
I'm Looking for a competent, professional and experienced MQ5 Coder who has a professional Forex Trader Mindset (Not just a programmer) who can review the strategy, logic and structure in detail and then accordingly review the code and make the strategy more robust by implementing further layers or robustness to make it fully functional. If you can optimize it for various forex pairs, indices, crypto and commodities
Convert an MQL5 script to MQL4. The code uses the ALGLIB library. Please ensure the converted MQL4 version produces consistent results with the original MQL5 program. The MQL5 script is attached
I want to hire a professional MQL5 developer to build an automated Expert Advisor (EA) for MetaTrader 5 that trades using Institutional Order Blocks (OB) logic combined with BOS (Break of Structure) and ChoCH (Change of Character) confirmations. The EA should identify valid order blocks (“Boss” phase) and execute precise trades (“Charge” phase) with full risk and trade management. The idea is based on the “Smart
Tradelocker bot required. *Entry into buying is when, after a minimum of 3 consecutive red candles, the first next one forms an engulfing candle, entry is when engulfing candle closes. *Stop loss at the lowest point of that eng.candle *Take profit RR *Lot size in percentage *need to have working time example 06:00 until 12:00 *The engolfing candle must be same signals like on tradingview, also visible on chart
Hi All, I want to create an Expert Advisor that will be based on specific timing to activate bids and also use positions for the period to take bids. The timing for the bids will have variables as daily, weekly or monthly. A daily means EA will activate everyday after considering prices from the time the market opens to the time specified. Eg if the time specified is 2am, the EA will consider all prices from the
Hi Developers, I would like to order the following EA US30 / DE40 Price action Pending orders including buy and sell stop Ultra micro scalper High frequence Fixed TP & SL Trailing Step / Stop Loss / Start Spread filter Session filter Please check as well the attachment, I would like to have a equal behaviour. Many thanks and best regards, Dominik
I have a proven strategy and a complete, step by step pseudocode blueprint for an ea that scans for Bollinger Band contradictions. I am not a programmer, but I have mapped out the logic. My goal is to build this to create a life-changingopportunity for my family and a dear friends family. I am cash strapped but can offer a small bounty for the programmer who can accurately translate this blueprint into a working .mq5

Informazioni sul progetto

Budget
10 - 20 USD
Per lo sviluppatore
9 - 18 USD
Scadenze
da 1 a 2 giorno(i)