|
Startseite | Registrieren | Hilfe | Benutzerliste | Kalender | Suchen | Heutige Beiträge | Alle Foren als gelesen markieren |
Programmierung MQL5 Hier gehts rund ums Programmieren in MQL5. |
|
Themen-Optionen | Thema durchsuchen | Ansicht |
|
|||
Indikatoren von mq4 in mq5 umwandeln
Hallo!
Ich habe Indikatoren die ich in MT4 verwendet habe. Nun habe ich den MT5 und würde diese gerne übernehmen. Kann mir hier jemand helfen diese umzuwandeln? Ist vermutlich keine große Sache, leider kenne ich mich in MQL-Programmierung nicht aus. Wäre sehr dankbar wenn diese mir jemand umwandeln könnte oder mit vergleichbare nennen kann die es schon im mq5 gibt. Hab diese leider bisher nicht gefunden. |
|
|||
Kann ich dir gerne machen, aber mit den ex4-Dateien kann ich nix anfangen.
Ich brauche die mq4-Files zum Übersetzen. Anderenfalls eine genaue Beschreibung was die machen, aber dafür muß ich dann schon was verlangen. Die 'LWMA_Crossover_Signal.mq5' poste ich hier sobald sie fertig ist. Komme erst Abends dazu. LG Otto PS: Gute Entscheidung auf MT5 umzusteigen |
|
|||
Das wäre natürlich super, wenn du mir wenigstens die eine Datei konvertieren kannst.
Mein Problem ist einfach, dass ich in der Vergangenheit mal ein paar Indikatoren entdeckt habe, mit denen ich bei binären Optionen ganz gut zurecht gekommen bin. Diese habe ich eben leider nur im ex4-Format. Da ich meine Strategie ändern möchte brauche ich auch andere Periodizitäten (M1;M2;M3;M10) Diese konnte ich in MT4 nicht laden bzw. vielleicht gibt es da ja eine Möglichkeit. Darum bin ich zum MT5 gewechselt und muss mir dort meine Templates neu aufbauen, leider.... Im Prinzip suche ich ein Handelssignal, was mir beim 60 Sekunden Handel den Einstiegspunkt zeigt. Also bspw. wenn der Kurs an einem eng gesetzten Trendkanal im Zick Zack oben od. unten anschlägt und dies dann mit nem Pfeil od. Punkt kennzeichnet. Weiß hier jemand was? |
|
|||
Du suchst also den "Holy Grail" für BOs
Den kenn ich, der heißt "Martin Gail" und wird dein Konto schrotten. Aber es ist ja nicht meines. Die BOs sollen ausserdem ja bald verboten werden. Wie dem auch sei, im Anhang die versprochenen 2 Files. Die mq5 nach MQL5\Indicators und die mqh nach MQL5\Include kopieren. Die Signale kommen viel zu spät und es gibt jede Menge Fehlsignale, besonders wenn der Markt seitlich läuft. Such dir doch einen passenden Broker (zb ActivTrades) und lerne traden. LG Otto Da haut was mit dem Datei anhängen nicht hin, ich versuche es nochmals. Geändert von Kronenchakra (17.11.16 um 22:06 Uhr) Grund: Korrektur |
|
|||
Irgendwas funktioniert da bei den Anhängen nicht, also kopiere ich den Code hierher.
Code:
//+------------------------------------------------------------------+ //| Buffers.mqh | //| Copyright © 2016 Ing. Otto Pauser | //| Ein Auszug aus meiner Bibliothek | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Initialization of buffers as function | //+------------------------------------------------------------------+ bool InitIndi(double &Buffer[], // the buffer ENUM_INDEXBUFFER_TYPE BufType, // INDICATOR_DATA / INDICATOR_COLOR_INDEX / INDICATOR_CALCULATIONS ENUM_DRAW_TYPE DrwType =DRAW_NONE, // DRAW_NONE .. DRAW_COLOR_CANDLES ENUM_LINE_STYLE LineStyle=STYLE_SOLID, // STYLE_SOLID .. STYLE_DASHDOTDOT int LineWidth=1, // PLOT_LINE_WIDTH - 1 ........ int LineColor=clrRed, // PLOT_LINE_COLOR - clr....... int aIntValue=0, // for SMA,EMA,WMA the period / for Max/Min lookback / for ArrowCode string PlotLabel="", // PLOT_LABEL - "Any String" int PlotShift=0) // PLOT_SHIFT { static int BufIdx; // counter for bufferindex SetIndexBuffer (BufIdx,Buffer, BufType ); PlotIndexSetInteger(BufIdx,PLOT_DRAW_TYPE, DrwType ); PlotIndexSetInteger(BufIdx,PLOT_LINE_STYLE, LineStyle); PlotIndexSetInteger(BufIdx,PLOT_LINE_WIDTH, LineWidth); PlotIndexSetString (BufIdx,PLOT_LABEL, PlotLabel); PlotIndexSetDouble (BufIdx,PLOT_EMPTY_VALUE,NULL ); PlotIndexSetInteger(BufIdx,PLOT_SHIFT, PlotShift); if(DrwType==DRAW_ARROW) PlotIndexSetInteger(BufIdx,PLOT_ARROW, aIntValue); if(LineColor==0) PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,aIntValue+1); else PlotIndexSetInteger(BufIdx,PLOT_LINE_COLOR, LineColor); BufIdx++; // increment bufferindex for next Init() return(true); } //+------------------------------------------------------------------+ //| Alert enhanced | //+------------------------------------------------------------------+ ENUM_INIT_RETCODE MyAlert(string aMsg) { Alert(aMsg); return(INIT_FAILED); } int MyAlert(string aMsg, int aRetVal) { Alert(aMsg); return(aRetVal); } //+------------------------------------------------------------------+ //| Working with buffers | //+------------------------------------------------------------------+ double GetAverage(const double &Buf1[], const double &Buf2[], int idx, int count) { int start=idx-count; int limit=start+count; if(start<0) start=0; double sum=0; for(int i=start;i<limit;i++) sum=sum+MathAbs(Buf1[i]-Buf2[i]); return(sum/count); } bool IsCrossingUp(const double &Buf1[], const double &Buf2[], int idx) { if(idx<1) return false; return(((Buf1[idx-1]<=Buf2[idx-1]) && (Buf1[idx]> Buf2[idx])) || ((Buf1[idx-1]< Buf2[idx-1]) && (Buf1[idx]>=Buf2[idx]))); } bool IsCrossingDn(const double &Buf1[], const double &Buf2[], int idx) { if(idx<1) return false; return(((Buf1[idx-1]>=Buf2[idx-1]) && (Buf1[idx]< Buf2[idx])) || ((Buf1[idx-1]> Buf2[idx-1]) && (Buf1[idx]<=Buf2[idx]))); } Code:
//+------------------------------------------------------------------+ //| LWMA_Crossover_Signal.mq5 | //| Copyright © 2016 Ing. Otto Pauser | //| Original code LWMA-Crossover_Signal.mq4 | //| Copyright © 2005, Jason Robinson (jnrtrading) | //| http://www.jnrtading.co.uk | //+------------------------------------------------------------------+ //| Allows you to enter two lwma periods and it will then show you at| //| which point they crossed over. It is more usful on the shorter | //| periods that get obscured by the bars / candlesticks and when | //| the zoom level is out. Also allows you then to remove the emas | //| from the chart. (lwmas are initially set at 5 and 6) | //+------------------------------------------------------------------+ #include <Buffers.mqh> #property copyright "Copyright © 2016 Ing. Otto Pauser" #property version "1.00" #property indicator_chart_window #property indicator_buffers 4 #property indicator_plots 4 input int inp_PeriodFast = 5; // MA Period fast input int inp_PeriodSlow = 6; // MA Period slow input bool inp_Realtime = true; // Realtime input bool inp_ShowMAs = true; // Show MAs input int inp_LineWidth = 1; // MA Linewidth input int inp_ArrowSize = 1; // Arrowsize double MA_fast[], // buffer for fast MA MA_slow[], // buffer for slow MA CrossUp[], // buffer for signal UP CrossDn[]; // buffer for signal DN int haFastMA, // handle for fast MA haSlowMA; // handle for slow MA int idxStart; // startindex for calculation int OnInit() // Custom indicator initialization function { // initialize the plotbuffers InitIndi(CrossUp,INDICATOR_DATA,DRAW_ARROW,STYLE_SOLID,inp_ArrowSize,clrLime,233,"Signal UP"); InitIndi(CrossDn,INDICATOR_DATA,DRAW_ARROW,STYLE_SOLID,inp_ArrowSize,clrRed ,234,"Signal DN"); ENUM_DRAW_TYPE Draw_Type = DRAW_NONE; if(inp_ShowMAs) Draw_Type = DRAW_LINE; InitIndi(MA_fast,INDICATOR_DATA,Draw_Type ,STYLE_SOLID,inp_LineWidth,clrLime); InitIndi(MA_slow,INDICATOR_DATA,Draw_Type ,STYLE_SOLID,inp_LineWidth,clrRed ); haFastMA = iMA(NULL, 0, inp_PeriodFast, 0, MODE_LWMA, PRICE_CLOSE); haSlowMA = iMA(NULL, 0, inp_PeriodSlow, 0, MODE_LWMA, PRICE_CLOSE); if((haFastMA==INVALID_HANDLE) || (haSlowMA==INVALID_HANDLE)) return(MyAlert("Invalid handle for iMA")); return(INIT_SUCCEEDED); } // Custom indicator iteration function int OnCalculate (const int rates_total, // size of input time series const int prev_calculated, // bars handled in previous call const datetime& time[], // Time const double& open[], // Open const double& high[], // High const double& low[], // Low const double& close[], // Close const long& tick_volume[], // Tick Volume const long& volume[], // Real Volume const int& spread[]) // Spread { if(prev_calculated==0) // first call of OnCalculate { ArrayInitialize(CrossUp,NULL); ArrayInitialize(CrossDn,NULL); ArrayInitialize(MA_fast,NULL); ArrayInitialize(MA_slow,NULL); idxStart=0; } else idxStart=prev_calculated-1; if(BarsCalculated(haFastMA)<rates_total) return(0); // check if all data calculated, try again next call if(BarsCalculated(haSlowMA)<rates_total) return(0); // check if all data calculated, try again next call if(!inp_Realtime) // no Realtime, only new candles if(prev_calculated==rates_total) return(rates_total); int to_copy; // calculate wow much to copy if(prev_calculated>rates_total || prev_calculated<=0) to_copy=rates_total; else { to_copy=rates_total-prev_calculated; // last value is always copied to_copy++; } if(CopyBuffer(haFastMA,0,0,to_copy,MA_fast)<=0) return(MyAlert("Error CopyBuffer fastMA",0)); // try to copy and check if(CopyBuffer(haSlowMA,0,0,to_copy,MA_slow)<=0) return(MyAlert("Error CopyBuffer slowMA",0)); // try to copy and check for(int i=idxStart;i<rates_total;i++) // calculate the signals { double Range=GetAverage(high, low, i, 9); if(IsCrossingUp(MA_fast, MA_slow, i)) CrossUp[i] = low [i]-Range*0.5; else if(IsCrossingDn(MA_fast, MA_slow, i)) CrossDn[i] = high[i]+Range*0.5; } return(rates_total); } |
|
|||
Hallo Otto,
vielen Dank für das convertieren. Ich habe den Code hier von dir kopiert und im MT Editor als mq5 und mqh gespeichert und an die entsprechende stelle kopiert. Allerdings kann ich diese im MT5 in der Navigatin dann nicht auswählen. Wo ist der Fehler? Vielen Dank für deine Info am Anfang, bei Active Trades bin ich schon länger.... |
|
|||
Zuerst kompilieren, dann evtl. den MT5 neu starten damit er es mitbekommt.
Sollte er aber normalerweise. Eine kleine Korrektur ist noch dazugekommen, so ab Zeile 101. Das ist erforderlich um im RealTime Mode die Signale wieder wegzulöschen falls sich die MAs doch nicht kreuzen. Code:
//+------------------------------------------------------------------+ //| LWMA_Crossover_Signal.mq5 | //| Copyright © 2016 Ing. Otto Pauser | //| Original code LWMA-Crossover_Signal.mq4 | //| Copyright © 2005, Jason Robinson (jnrtrading) | //| http://www.jnrtading.co.uk | //+------------------------------------------------------------------+ //| Allows you to enter two lwma periods and it will then show you at| //| which point they crossed over. It is more usful on the shorter | //| periods that get obscured by the bars / candlesticks and when | //| the zoom level is out. Also allows you then to remove the emas | //| from the chart. (lwmas are initially set at 5 and 6) | //+------------------------------------------------------------------+ #include <MyBuffers.mqh> #property copyright "Copyright © 2016 Ing. Otto Pauser" #property version "1.00" #property indicator_chart_window #property indicator_buffers 4 #property indicator_plots 4 input int inp_PeriodFast = 5; // MA Period fast input int inp_PeriodSlow = 6; // MA Period slow input bool inp_Realtime = true; // Realtime input bool inp_ShowMAs = true; // Show MAs input int inp_LineWidth = 1; // MA Linewidth input int inp_ArrowSize = 1; // Arrowsize double MA_fast[], // buffer for fast MA MA_slow[], // buffer for slow MA CrossUp[], // buffer for signal UP CrossDn[]; // buffer for signal DN int haFastMA, // handle for fast MA haSlowMA; // handle for slow MA int idxStart; // startindex for calculation int OnInit() // Custom indicator initialization function { // initialize the plotbuffers InitIndi(CrossUp,INDICATOR_DATA,DRAW_ARROW,STYLE_SOLID,inp_ArrowSize,clrLime,233,"Signal UP"); InitIndi(CrossDn,INDICATOR_DATA,DRAW_ARROW,STYLE_SOLID,inp_ArrowSize,clrRed ,234,"Signal DN"); ENUM_DRAW_TYPE Draw_Type = DRAW_NONE; if(inp_ShowMAs) Draw_Type = DRAW_LINE; InitIndi(MA_fast,INDICATOR_DATA,Draw_Type ,STYLE_SOLID,inp_LineWidth,clrLime); InitIndi(MA_slow,INDICATOR_DATA,Draw_Type ,STYLE_SOLID,inp_LineWidth,clrRed ); haFastMA = iMA(NULL, 0, inp_PeriodFast, 0, MODE_LWMA, PRICE_CLOSE); haSlowMA = iMA(NULL, 0, inp_PeriodSlow, 0, MODE_LWMA, PRICE_CLOSE); if((haFastMA==INVALID_HANDLE) || (haSlowMA==INVALID_HANDLE)) return(MyAlert("Invalid handle for iMA")); return(INIT_SUCCEEDED); } // Custom indicator iteration function int OnCalculate (const int rates_total, // size of input time series const int prev_calculated, // bars handled in previous call const datetime& time[], // Time const double& open[], // Open const double& high[], // High const double& low[], // Low const double& close[], // Close const long& tick_volume[], // Tick Volume const long& volume[], // Real Volume const int& spread[]) // Spread { if(prev_calculated==0) // first call of OnCalculate { ArrayInitialize(CrossUp,NULL); ArrayInitialize(CrossDn,NULL); ArrayInitialize(MA_fast,NULL); ArrayInitialize(MA_slow,NULL); idxStart=0; } else idxStart=prev_calculated-1; if(BarsCalculated(haFastMA)<rates_total) return(0); // check if all data calculated, try again next call if(BarsCalculated(haSlowMA)<rates_total) return(0); // check if all data calculated, try again next call if(!inp_Realtime) // no Realtime, only new candles if(prev_calculated==rates_total) return(rates_total); int to_copy; // calculate wow much to copy if(prev_calculated>rates_total || prev_calculated<=0) to_copy=rates_total; else { to_copy=rates_total-prev_calculated; // last value is always copied to_copy++; } if(CopyBuffer(haFastMA,0,0,to_copy,MA_fast)<=0) return(MyAlert("Error CopyBuffer fastMA",0)); // try to copy and check if(CopyBuffer(haSlowMA,0,0,to_copy,MA_slow)<=0) return(MyAlert("Error CopyBuffer slowMA",0)); // try to copy and check for(int i=idxStart;i<rates_total;i++) // calculate the signals { double Range=GetAverage(high, low, i, 9); if(IsCrossingUp(MA_fast, MA_slow, i)) CrossUp[i] = low [i]-Range*0.5; else CrossUp[i] = NULL; if(IsCrossingDn(MA_fast, MA_slow, i)) CrossDn[i] = high[i]+Range*0.5; else CrossDn[i] = NULL; } return(rates_total); } Wahrscheinlich könntest du LR-Kanäle (LR=Lineare Regression) brauchen, die sind IMHO absolut super, hab ich auf Lager, muss ich aber schon was dafür verlangen, war viel Arbeit. LG Otto Geändert von Kronenchakra (17.11.16 um 23:12 Uhr) Grund: Ergänzung |
|
|||
So sehen die LR_Channels aus.
Sind 3 Stück, jeweils 5 Linien. Viele Linien auf den ersten Blick. Die sind für die maschinelle Auswertung vorgesehen. Auch ein Rückschluß auf die Vola ist durch die Breite der Kanäle möglich. |
|
|||
Das Probier ich mal. Vielen Dank schon mal, hast dir echt mühe gemacht!!
Die LR Kanaläle sind dynamisch, oder? Passen sich also ständig an? Was kannst ja mal sagen, was ich dir dafür spendieren darf...??! |
|
|||
Na klar sind die dynamisch, sonst hätt's ja keinen Sinn.
Wieviel ist es dir denn wert? Mach einen Vorschlag! Einstellbar sind Anzahl der Kanäle (1-3) und die Periodenlängen. Das mit den Wendepunkten ist auch nicht gerade das gelbe vom Ei. Ich stell das mal hier rein. Code:
//+------------------------------------------------------------------+ //| DEMA_Peak_Signal.mq5 | //| Copyright © 2016 Ing. Otto Pauser | //+------------------------------------------------------------------+ #include <MyBuffers.mqh> #property copyright "Copyright © 2016 Ing. Otto Pauser" #property version "1.00" #property indicator_chart_window #property indicator_buffers 3 #property indicator_plots 3 input int inp_PeriodFast = 5; // MA Period fast input int inp_PeriodSlow = 6; // MA Period slow input bool inp_Realtime = true; // Realtime input bool inp_UseDEMAs = true; // Use DEMAs input bool inp_ShowMAs = true; // Show MAs input int inp_LineWidth = 1; // MA Linewidth input int inp_ArrowSize = 1; // Arrowsize double MA_fast[], // buffer for fast MA CrossUp[], // buffer for signal UP CrossDn[]; // buffer for signal DN int haFastMA; // handle for fast MA int idxStart; // startindex for calculation int OnInit() // Custom indicator initialization function { // initialize the plotbuffers InitIndi(CrossUp,INDICATOR_DATA,DRAW_ARROW,STYLE_SOLID,inp_ArrowSize,clrLime,233,"Signal UP"); InitIndi(CrossDn,INDICATOR_DATA,DRAW_ARROW,STYLE_SOLID,inp_ArrowSize,clrRed ,234,"Signal DN"); ENUM_DRAW_TYPE Draw_Type = DRAW_NONE; if(inp_ShowMAs) Draw_Type = DRAW_LINE; InitIndi(MA_fast,INDICATOR_DATA,Draw_Type ,STYLE_SOLID,inp_LineWidth,clrLime); if(inp_UseDEMAs) haFastMA = iDEMA(NULL, 0, inp_PeriodFast, 0, PRICE_CLOSE); else haFastMA = iMA(NULL, 0, inp_PeriodFast, 0, MODE_LWMA, PRICE_CLOSE); if(haFastMA==INVALID_HANDLE) return(MyAlert("Invalid handle for iMA")); return(INIT_SUCCEEDED); } // Custom indicator iteration function int OnCalculate (const int rates_total, // size of input time series const int prev_calculated, // bars handled in previous call const datetime& time[], // Time const double& open[], // Open const double& high[], // High const double& low[], // Low const double& close[], // Close const long& tick_volume[], // Tick Volume const long& volume[], // Real Volume const int& spread[]) // Spread { if(prev_calculated==0) // first call of OnCalculate { ArrayInitialize(CrossUp,NULL); ArrayInitialize(CrossDn,NULL); ArrayInitialize(MA_fast,NULL); idxStart=0; } else idxStart=prev_calculated-1; if(BarsCalculated(haFastMA)<rates_total) return(0); // check if all data calculated, try again next call if(!inp_Realtime) // no Realtime, only new candles if(prev_calculated==rates_total) return(rates_total); int to_copy; // calculate wow much to copy if(prev_calculated>rates_total || prev_calculated<=0) to_copy=rates_total; else { to_copy=rates_total-prev_calculated; // last value is always copied to_copy++; } if(CopyBuffer(haFastMA,0,0,to_copy,MA_fast)<=0) return(MyAlert("Error CopyBuffer fastMA",0)); // try to copy and check for(int i=idxStart;i<rates_total;i++) // calculate the signals { double Range=GetAverage(high, low, i, 9); if(PeakPassedLo(MA_fast, i)) CrossUp[i] = low [i]-Range*0.5; else CrossUp[i] = NULL; if(PeakPassedHi(MA_fast, i)) CrossDn[i] = high[i]+Range*0.5; else CrossDn[i] = NULL; } return(rates_total); } Code:
bool PeakPassedHi(const double &Buf[], int idx) { if(idx<3) return(false); return((Buf[idx-1]> Buf[idx ]) && (Buf[idx-2]<=Buf[idx-1]) && (Buf[idx-3]<=Buf[idx-2]) ); }; bool PeakPassedLo(const double &Buf[], int idx) { if(idx<3) return(false); return((Buf[idx-1]< Buf[idx ]) && (Buf[idx-2]>=Buf[idx-1]) && (Buf[idx-3]>=Buf[idx-2]) ); }; Ausserdem ist da noch ein Fisch drin, da ja die Signale abwechseld kommen sollten. Ich adaptiere gerade ähnliches für die echten Ticks (Marktübersicht->Tab Ticks) für einen ScalpingRobot. Der sollte Anfang nächsten Jahres laufen. Bin schon sehr gespannt auf die ersten Tests. LG Otto |
Lesezeichen |
Stichworte |
konvertieren, konvertierung, konvertierung mql5, mql5, programmierung, programmierung metatrader, programmierung mql5 |
Themen-Optionen | Thema durchsuchen |
Ansicht | |
|
|