Indicadores: Trailing_Stop_Level
Hola Scriptor
puedes añadir SendNotification cuando cambie la tendencia, por favor
Sería perfecto para mí
Gracias
Mario
Hola Scriptor
Es posible que compruebe el código, algo extraño ( ver imagen ) . Gracias vm de antemano. Neuch
Hola Scriptor
Es posible que compruebe el código, algo extraño ( ver imagen ) . Gracias vm de antemano. Neuch
// Trailing_Stop_Level_m03.mq5
***
- www.mql5.com
// Trailing_Stop_Level_m03.mq5
***
Utilice el botón ![]()
Hola Scriptor
Es posible que compruebe el código, algo extraño ( ver imagen ) . Gracias vm de antemano. Neuch
// Trailing_Stop_Level_mod1.mq5 #property indicator_chart_window #property indicator_buffers 3 #property indicator_plots 2 #property indicator_label1 "Level for short" #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 #property indicator_label2 "Level for long" #property indicator_type2 DRAW_LINE #property indicator_color2 clrGreen #property indicator_style2 STYLE_SOLID #property indicator_width2 1 input double InpPercent = 0.5; double BufferLevUP[],BufferLevDN[],BufferData[]; string IndicatorName, ShortName; int OnInit() { SetIndexBuffer(0,BufferLevUP,INDICATOR_DATA); SetIndexBuffer(1,BufferLevDN,INDICATOR_DATA); SetIndexBuffer(2,BufferData,INDICATOR_CALCULATIONS); IndicatorName=MQL5InfoString(MQL5_PROGRAM_NAME); ShortName =IndicatorName+"("+DoubleToString(InpPercent,2)+")"; IndicatorSetString(INDICATOR_SHORTNAME,ShortName); IndicatorSetInteger(INDICATOR_DIGITS,Digits()); ArraySetAsSeries(BufferLevUP,true); ArraySetAsSeries(BufferLevDN,true); ArraySetAsSeries(BufferData,true); return(INIT_SUCCEEDED); } 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[]) { if(rates_total<4) return 0; ArraySetAsSeries(close,true); int limit=rates_total-prev_calculated; if(limit>1) { limit=rates_total-2; ArrayInitialize(BufferLevUP,EMPTY_VALUE); ArrayInitialize(BufferLevDN,EMPTY_VALUE); ArrayInitialize(BufferData,0); } for(int i=limit; i>=0 && !IsStopped(); i--) { double loss=close[i]*InpPercent/100; if(close[i]>BufferData[i+1] && close[i+1]>BufferData[i+1]) { BufferData[i]=fmax(BufferData[i+1],close[i]-loss); BufferLevDN[i]=BufferData[i]; BufferLevUP[i]=EMPTY_VALUE; } else { if(close[i]<BufferData[i+1] && close[i+1]<BufferData[i+1]) { BufferData[i]=fmin(BufferData[i+1],close[i]+loss); BufferLevUP[i]=BufferData[i]; BufferLevDN[i]=EMPTY_VALUE; } else { if(close[i]>BufferData[i+1]) { BufferData[i]=close[i]-loss; BufferLevDN[i]=BufferData[i]; BufferLevUP[i]=EMPTY_VALUE; } else { BufferData[i]=close[i]+loss; BufferLevUP[i]=BufferData[i]; BufferLevDN[i]=EMPTY_VALUE; } } } } return(rates_total); }
Utilice el botón
Gracias Vladimir
Trailing_Stop_Level:
Indicador de niveles Stop Loss.
Autor: Scriptor