Convert Indicator to EA

MQL4 Asesores Expertos

Tarea técnica

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 

Han respondido

1
Desarrollador 1
Evaluación
(769)
Proyectos
1033
44%
Arbitraje
50
8% / 50%
Caducado
117
11%
Libre
2
Desarrollador 2
Evaluación
(414)
Proyectos
478
40%
Arbitraje
7
43% / 29%
Caducado
16
3%
Libre
3
Desarrollador 3
Evaluación
(39)
Proyectos
44
16%
Arbitraje
1
100% / 0%
Caducado
7
16%
Libre
4
Desarrollador 4
Evaluación
(68)
Proyectos
111
26%
Arbitraje
17
6% / 71%
Caducado
15
14%
Libre
5
Desarrollador 5
Evaluación
(121)
Proyectos
134
66%
Arbitraje
36
25% / 56%
Caducado
22
16%
Libre
Solicitudes similares
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA
I am looking forward to automate my trading strategy where I use renko bars on Tradingview. I really want to use unirenkos too, but unfortunately I couldn't figure out how to use ninjatrader on my MacBook and Tradingview does not offer unirenkos. As far as I see from your offered services you are very familiar with ninjatrader. I wanted to ask you if you could code me an Indicator for unirenkos for Tradingview so I
I am looking forward to automate my trading strategy where I use renko bars on Tradingview. I really want to use unirenkos too, but unfortunately I couldn't figure out how to use ninjatrader on my MacBook and Tradingview does not offer unirenkos. As far as I see from your offered services you are very familiar with ninjatrader. I wanted to ask you if you could code me an Indicator for unirenkos for Tradingview so I
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA
Hello, I want to create an EA that can be able to take and optimise trade bids using the trend tracker concept I have developed. The tracker will monitor 2 lines to determine the trend of the market and afterwards take bids towards the correct direction. It will also be able to use a distance between the bids for the direction of the trend and plan a reverse bid when the price of the extreme doesn’t change again. The
Gradient boosting and L2 100 - 200 USD
I am looking for a well experienced programmer to put/implement a gradient boosting algorithm and an L2 to reduce overfitting in my ea which l already have which uses indicators . If you are experienced please adhere
Hello, I'm looking for a developer for repair calendar in EA MT4/MT5 (News Filter - https://ec.forexprostools.com ) for all windows servers. Note: EA MT4/MT5 works with calendar on PC Win 10, 11 but not on all windows servers. I have the source code and will post within the comments section for review. If you are able to do this and quality. Please apply. Thanks
Create mt4 ea 50+ USD
To convert the provided MT4 indicator script into an Expert Advisor (EA) and implement prompt functionality for user input, we need to modify the code to handle external parameters and provide a user-friendly interface. Below is the EA code that incorporates prompts for user inputs
SCALP MARTINCALE SPY TIMEFRAME 1MIN CANDLE - SHORT SIDE ONLY 1-SET RISK : A IS A VARIABLE (HOW MUCH $) 2-SET ATR(3) : SET THE TIME AT WHICH THE ATR SHOULD BE TAKEN, IF SET 933AM THEN THE ATR OF THE 1MIN CANDLE AT 933AM CANDLE WILL BE USED (ROUND AT 0.25 UP OR DOWN) *USE NEW YORK TIME 3-SET MAX NUMBER OF ENTRY : B IS A VARIABLE 4-SET RSI(14) / C IS A VARIABLE, IF RSI(14) > C = ORDERS OPEN 5-IF RSI(14) > C IS TRIGGERED
I WRITE a code i want to conect this for automatic trading through vps .and als advanced features for this code .i attached afile please watch .and give me perfect ea

Información sobre el proyecto

Presupuesto
10 - 20 USD
Para el ejecutor
9 - 18 USD
Plazo límite de ejecución
de 1 a 2 día(s)