Indikatoren: Trailing_Stop_Level
Hallo Scriptor
können Sie bitte SendNotification hinzufügen, wenn sich der Trend ändert?
Das wäre perfekt für mich
Danke
Mario
Hallo Scriptor
Ist es möglich, dass Sie den Code überprüfen, etwas seltsam ( siehe Bild ) . Danke vm im Voraus. Neuch
Hallo Scriptor
Ist es möglich, dass Sie den Code überprüfen, etwas seltsam ( siehe Bild ) . Danke vm im Voraus. Neuch
// Trailing_Stop_Level_m03.mq5
***
- www.mql5.com
// Nachlaufender_Stop_Level_m03.mq5
***
Verwenden Sie die Schaltfläche ![]()
Hallo Scriptor
Ist es möglich, dass Sie den Code überprüfen, etwas seltsam ( siehe Bild ) . Danke vm im Voraus. Neuch
// Nachlaufender_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); }
Verwenden Sie die Schaltfläche
Danke Wladimir
Trailing_Stop_Level:
Ein Indikator für die Stop-Loss.
Autor: Scriptor