Hola a todos los integrantes de la comunidad. Quiero personalizar un indicador sacándole las alertas. Hay algun tutorial que indique como hacerlo o algun compañero que lo haya hecho y quiera indicarme como hacerlo?. Gracias por su ayuda
- Ayuda a la codificación
- Discusión
- ¿Cómo codificar?
Ramon Correa Nuñez:
Hola a todos los integrantes de la comunidad. Quiero personalizar un indicador sacándole las alertas. Hay algun tutorial que indique como hacerlo o algun compañero que lo haya hecho y quiera indicarme como hacerlo?. Gracias por su ayuda
A qué tipo de Alertas te refieres? Tienes el código?
Hola a todos los integrantes de la comunidad. Quiero personalizar un indicador sacándole las alertas. Hay algun tutorial que indique como hacerlo o algun compañero que lo haya hecho y quiera indicarme como hacerlo?. Gracias por su ayuda
Hola Enrique
indicador es el half trend, este es el codigo. Gracias por tu ayuda.
Archivos adjuntos:
half-trend1.mq4
7 kb
Ramon Correa Nuñez #:
Gracias por su ayuda
Gracias por su ayuda
//+------------------------------------------------------------------+ //| HalfTrend.mq4 | //| Copyright 2014, AlexSoftware | //| Based on Ozymandias.mq4 | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 Blue // up[] #property indicator_width1 2 #property indicator_color2 Red // down[] #property indicator_width2 2 #property indicator_color3 Blue // atrlo[] #property indicator_width3 1 #property indicator_color4 Red // atrhi[] #property indicator_width4 1 #property indicator_color5 Blue // arrup[] #property indicator_width5 1 #property indicator_color6 Red // arrdwn[] #property indicator_width6 1 input int Amplitude = 2; input bool ShowBars = true; input bool ShowArrows = true; bool nexttrend; double minhighprice,maxlowprice; double up[],down[],atrlo[],atrhi[],trend[]; double arrup[],arrdwn[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { IndicatorBuffers(7); // +1 buffer - trend[] SetIndexBuffer(0,up); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(1,down); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(2,atrlo); SetIndexBuffer(3,atrhi); SetIndexBuffer(6,trend); SetIndexBuffer(4,arrup); SetIndexBuffer(5,arrdwn); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); SetIndexEmptyValue(6,0.0); if(ShowBars) { SetIndexStyle(2,DRAW_HISTOGRAM, STYLE_SOLID); SetIndexStyle(3,DRAW_HISTOGRAM, STYLE_SOLID); } else { SetIndexStyle(2,DRAW_NONE); SetIndexStyle(3,DRAW_NONE); } if(ShowArrows) { SetIndexStyle(4,DRAW_ARROW,STYLE_SOLID); SetIndexArrow(4,233); SetIndexStyle(5,DRAW_ARROW,STYLE_SOLID); SetIndexArrow(5,234); } else { SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_NONE); } nexttrend=0; minhighprice= High[Bars-1]; maxlowprice = Low[Bars-1]; return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class CFix { } ExtFix; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ 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[]) { double atr,lowprice_i,highprice_i,lowma,highma; int workbar=0; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); for(int i=Bars-1; i>=0; i--) { lowprice_i=iLow(Symbol(),Period(),iLowest(Symbol(),Period(),MODE_LOW,Amplitude,i)); highprice_i=iHigh(Symbol(),Period(),iHighest(Symbol(),Period(),MODE_HIGH,Amplitude,i)); lowma=NormalizeDouble(iMA(NULL,0,Amplitude,0,MODE_SMA,PRICE_LOW,i),Digits()); highma=NormalizeDouble(iMA(NULL,0,Amplitude,0,MODE_SMA,PRICE_HIGH,i),Digits()); trend[i]=trend[i+1]; atr=iATR(Symbol(),0,100,i)/2; arrup[i] = EMPTY_VALUE; arrdwn[i] = EMPTY_VALUE; if(nexttrend==1) { maxlowprice=MathMax(lowprice_i,maxlowprice); if(highma<maxlowprice && Close[i]<Low[i+1]) { trend[i]=1.0; nexttrend=0; minhighprice=highprice_i; } } if(nexttrend==0) { minhighprice=MathMin(highprice_i,minhighprice); if(lowma>minhighprice && Close[i]>High[i+1]) { trend[i]=0.0; nexttrend=1; maxlowprice=lowprice_i; } } if(trend[i]==0.0) { if(trend[i+1]!=0.0) { up[i]=down[i+1]; up[i+1]=up[i]; arrup[i] = up[i] - 2*atr; } else { up[i]=MathMax(maxlowprice,up[i+1]); } atrhi[i] = up[i] - atr; atrlo[i] = up[i]; down[i]=0.0; } else { if(trend[i+1]!=1.0) { down[i]=up[i+1]; down[i+1]=down[i]; arrdwn[i] = down[i] + 2*atr; } else { down[i]=MathMin(minhighprice,down[i+1]); } atrhi[i] = down[i] + atr; atrlo[i] = down[i]; up[i]=0.0; } } return (0); } //+------------------------------------------------------------------+
GRACIAS POR TU AYUDA
Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese