- 10Punkte 3.mq4
- Mein Ansatz. Der Kern ist der Motor.
- BrainSystem: Entwicklung von Handelssystemen und Trades
Es dürfte nicht schwer sein im Backtest den vordefinierten Indikator Momentum zu testen, leider wurde ich eines besseren belehrt nach ca 10 minuten Ladezeit habe ich den Vorgang abgebrochen.
Hallo,
Die Frage.
- Hat der Indikator früher funktioniert?
- Wurde Indikator selbst programmiert? (dann bitte den Kode teilen)
- Der Indikator kam vom bestimmten Anbieter. (Persönlich anschreiben)
Hallo,
Die Frage.
- Hat der Indikator früher funktioniert?
- Wurde Indikator selbst programmiert? (dann bitte den Kode teilen)
- Der Indikator kam vom bestimmten Anbieter. (Persönlich anschreiben)
Genau den meine ich, er funktioniert optimal im Realtime Chart auf allen Zeiten aber eben nicht im Backtest.
Hi Igor,
Hallo,
habe mir Momentum.mq5 angeschaut und musste feststellen, dass da CopyBuffer() und Handle Funktionen fehlen.
Den muss man komplett umschreiben.
Gruß Igor
Hallo,
habe mir Momentum.mq5 angeschaut und musste feststellen, dass da CopyBuffer() und Handle Funktionen fehlen.
Den muss man komplett umschreiben.
Gruß Igor
Du brauchst die nicht unbedingt, wenn du eine Formel dafür hast.
Aber es ist wirklich komisch...
Diese geht nicht:
//+------------------------------------------------------------------+ //| Momentum.mq5 | //| Copyright 2021, Tobias Johannes Zimmer | //| https://www.mql5.com/pennyhunter | //+------------------------------------------------------------------+ #property copyright "Copyright 2021, Tobias Johannes Zimmer" #property link "https://www.mql5.com/pennyhunter" #property version "1.00" #property indicator_separate_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrDodgerBlue //--- input parameters input int InpMomentumPeriod = 14; // Period input ENUM_APPLIED_PRICE InpAppliedPrice = PRICE_CLOSE; //--- indicator buffer double ExtMomentumBuffer[]; int ExtMomentumPeriod; int begin; // starting index //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //--- check for input value if(InpMomentumPeriod < 0) { ExtMomentumPeriod = 14; Print("Input parameter InpMomentumPeriod has wrong value. Indicator will use value ", ExtMomentumPeriod); } else ExtMomentumPeriod = InpMomentumPeriod; //--- buffers SetIndexBuffer(0, ExtMomentumBuffer, INDICATOR_DATA); //--- sets first bar from what index will be drawn PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, ExtMomentumPeriod - 1); begin = InpMomentumPeriod - 1; // } //+------------------------------------------------------------------+ //| Momentum | //+------------------------------------------------------------------+ int OnCalculate( const int rates_total, // rates total const int prev_calculated, // bars, calculated at previous call const datetime &Time[], // Time const double &o[], // Open const double &h[], // High const double &l[], // Low const double &c[], // Close const long &TickVolume[], // Tick Volume const long &Volume[], // Real Volume const int &Spread[] // Spread ) { int start_position = (ExtMomentumPeriod - 1) + begin; if(rates_total < start_position) return(0); //--- start working, detect position int pos = prev_calculated - 1; if(pos < start_position) pos = begin + ExtMomentumPeriod; //--- main cycle for(int i = pos; i < rates_total && !IsStopped(); i++) ExtMomentumBuffer[i] = (Price(i,PRICE_CLOSE,o,h,l,c) / Price(i - ExtMomentumPeriod,PRICE_CLOSE,o,h,l,c)) * 100; //--- OnCalculate done. Return new prev_calculated. return(rates_total); } //+------------------------------------------------------------------+ //+-------------------------------------------------------------------------------------+ //| Function that gets a certain index of a price buffer depending on the applied price | //+-------------------------------------------------------------------------------------+ double Price(int idx, ENUM_APPLIED_PRICE applied, const double &o[], const double &h[], const double &l[], const double &c[]) //--- ohlc buffers had to be provided by reference again { double price = 0.0; switch(applied) { case PRICE_OPEN : price = o[idx]; break; case PRICE_HIGH : price = h[idx]; break; case PRICE_LOW : price = l[idx]; break; case PRICE_CLOSE: price = c[idx]; break; case PRICE_MEDIAN: price = (h[idx] + l[idx]) / 2; break; case PRICE_TYPICAL: price = (h[idx] + l[idx] + c[idx]) / 3; break; case PRICE_WEIGHTED: price = (h[idx] + l[idx] + (2 * c[idx])) / 4; break; } return(price); }
Diese geht:
//+------------------------------------------------------------------+ //| Momentum.mq5 | //| Copyright 2021, Tobias Johannes Zimmer | //| https://www.mql5.com/pennyhunter | //+------------------------------------------------------------------+ #property copyright "Copyright 2021, Tobias Johannes Zimmer" #property link "https://www.mql5.com/pennyhunter" #property version "1.00" #property indicator_separate_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrDodgerBlue //--- input parameters input int InpMomentumPeriod = 14; // Period input ENUM_APPLIED_PRICE InpAppliedPrice = PRICE_CLOSE; //--- indicator buffer double ExtMomentumBuffer[]; int ExtMomentumPeriod; int begin; // starting index //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //--- check for input value if(InpMomentumPeriod < 0) { ExtMomentumPeriod = 14; Print("Input parameter InpMomentumPeriod has wrong value. Indicator will use value ", ExtMomentumPeriod); } else ExtMomentumPeriod = InpMomentumPeriod; //--- buffers SetIndexBuffer(0, ExtMomentumBuffer, INDICATOR_DATA); //--- sets first bar from what index will be drawn PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, ExtMomentumPeriod - 1); begin = InpMomentumPeriod - 1; // } //+------------------------------------------------------------------+ //| Momentum | //+------------------------------------------------------------------+ int OnCalculate( const int rates_total, // rates total const int prev_calculated, // bars, calculated at previous call const datetime &Time[], // Time const double &o[], // Open const double &h[], // High const double &l[], // Low const double &c[], // Close const long &TickVolume[], // Tick Volume const long &Volume[], // Real Volume const int &Spread[] // Spread ) { int start_position = (ExtMomentumPeriod - 1) + begin; if(rates_total < start_position) return(0); //--- start working, detect position int pos = prev_calculated - 1; if(pos < start_position) pos = begin + ExtMomentumPeriod; //--- main cycle for(int i = pos; i < rates_total && !IsStopped(); i++) ExtMomentumBuffer[i] = (Price(i,PRICE_CLOSE,o,h,l,c) / Price(i - ExtMomentumPeriod,PRICE_CLOSE,o,h,l,c)) * 100; //--- OnCalculate done. Return new prev_calculated. return(rates_total); } //+------------------------------------------------------------------+ //+-------------------------------------------------------------------------------------+ //| Function that gets a certain index of a price buffer depending on the applied price | //+-------------------------------------------------------------------------------------+ double Price(int idx, ENUM_APPLIED_PRICE applied, const double &o[], const double &h[], const double &l[], const double &c[]) //--- ohlc buffers had to be provided by reference again { double price = 0.0; switch(applied) { case PRICE_OPEN : price = o[idx]; break; case PRICE_HIGH : price = h[idx]; break; case PRICE_LOW : price = l[idx]; break; case PRICE_CLOSE: price = c[idx]; break; case PRICE_MEDIAN: price = (h[idx] + l[idx]) / 2; break; case PRICE_TYPICAL: price = (h[idx] + l[idx] + c[idx]) / 3; break; case PRICE_WEIGHTED: price = (h[idx] + l[idx] + (2 * c[idx])) / 4; break; } return(price); }
Ich verstehe nicht mal warum, wenn ich sie vergleiche sind sie exakt gleich. Doch die Erste mache das hier:
Du brauchst die nicht unbedingt, wenn du eine Formel dafür hast.
Aber es ist wirklich komisch...
Diese geht nicht:
Diese geht:
Ich verstehe nicht mal warum, wenn ich sie vergleiche sind sie exakt gleich. Doch die Erste mache das hier:
Genau, das ist exakt das Problem, super vielen Dank für deine Hilfe.
Gruß Thorsten
- Freie Handelsapplikationen
- Über 8.000 Signale zum Kopieren
- Wirtschaftsnachrichten für die Lage an den Finanzmärkte
Sie stimmen der Website-Richtlinie und den Nutzungsbedingungen zu.