Sie verpassen Handelsmöglichkeiten:
- Freie Handelsapplikationen
- Über 8.000 Signale zum Kopieren
- Wirtschaftsnachrichten für die Lage an den Finanzmärkte
Registrierung
Einloggen
Sie stimmen der Website-Richtlinie und den Nutzungsbedingungen zu.
Wenn Sie kein Benutzerkonto haben, registrieren Sie sich
Hallo MT4-Programmierer,
Ich frage mich, ob mir jemand helfen kann. Ich versuche, den Indikator "Hull moving average 2 strict nmc" in einen EA zu implementieren.
Das Problem, dem ich gegenüberstehe, ist, dass der Indikator laut Protokoll immer wieder in MT4 geladen wird, darüber hinaus eröffnet der EA keinen Handel. Soweit ich weiß, könnte ein Problem mit dem Aufruf des iCustom-Indikators die Ursache dafür sein.
Dies ist, was ich versuche zu tun:
Der EA sollte LONG gehen, wenn der Hull Moving Average 2 strict nmc grün ist und short, wenn der Hull Moving Average 2 strict nmc rot ist.
extern int HMAPeriod = 35;
extern int HMAPrice = 0; // PRICE_CLOSE
extern double HMASpeed = 2;
[/CODE]
[CODE]
// Forex TSD Hull Moving Average
double hma0 = iCustom(Symbol(), 0, "Hull moving average 2 strict nmc", HMAPeriod, HMAPrice, HMASpeed, 0, 2, 0);
double hma1 = iCustom(Symbol(), 0, "Hull moving average 2 strict nmc", HMAPeriod, HMAPrice, HMASpeed, 0, 2, 1);
double hma2 = iCustom(Symbol(), 0, "Hull moving average 2 strict nmc", HMAPeriod, HMAPrice, HMASpeed, 0, 2, 2);
Buy = (hma0 > hma1 && hma1 > hma2);
Sell = (hma0 < hma1 && hma1 < hma2);
Ich danke Ihnen im Voraus für Ihre Hilfe.
Hallo MT4 Programmierer,
Ich frage mich, ob mir jemand helfen kann. Ich versuche, den Indikator "Hull moving average 2 strict nmc" in einen EA zu implementieren.
Das Problem, was ich konfrontiert bin, ist, dass der Indikator über und über in MT4 geladen wird, nach dem Bericht log, weiter mehr der EA ist nicht einen Handel zu öffnen. Soweit ich weiß, könnte ein Problem mit dem Aufruf des iCustom-Indikators die Ursache dafür sein.
Dies ist, was ich versuche zu tun:
Der EA sollte LONG gehen, wenn der Hull moving average 2 strict nmc grün ist und short, wenn der Hull moving average 2 strict nmc rot ist.
extern int HMAPeriod = 35;
extern int HMAPrice = 0; // PRICE_CLOSE
extern double HMASpeed = 2;
[/CODE]
[CODE]
// Forex TSD Hull Moving Average
double hma0 = iCustom(Symbol(), 0, "Hull moving average 2 strict nmc", HMAPeriod, HMAPrice, HMASpeed, 0, 2, 0);
double hma1 = iCustom(Symbol(), 0, "Hull moving average 2 strict nmc", HMAPeriod, HMAPrice, HMASpeed, 0, 2, 1);
double hma2 = iCustom(Symbol(), 0, "Hull moving average 2 strict nmc", HMAPeriod, HMAPrice, HMASpeed, 0, 2, 2);
Buy = (hma0 > hma1 && hma1 > hma2);
Sell = (hma0 < hma1 && hma1 < hma2);
tfi_markets
Ihnen fehlt ein Parameter (der erste, der TimeFrame-Parameter). Ändern Sie den Aufruf von iCustom() wie folgt:
iCustom(Symbol(),0, "Hull moving average 2 strict nmc", "", HMAPeriod, HMAPrice,HMASpeed,0,2,0);
und es wird OK funktionieren
Hallo Mladen,
herzlichen Dank für deine Hilfe!
Ich habe deinen Vorschlag umgesetzt, der Fehler ist weg, was sehr gut ist. Aber der EA eröffnet leider immer noch keinen Handel. Ich wäre dir dankbar, wenn du die Auftragslogik überprüfen könntest, vielleicht mache ich hier etwas falsch?
int Extra_Pips=1;
extern int HMA_Period=21;
extern int HMA_Price=PRICE_CLOSE; //0
extern double HMA_Speed= 2;
//+------------------------------------------------------------------+
//| ORDER Logic / Indicators |
//+------------------------------------------------------------------+
if(openedOrders<=0)
{
// Forex TSD Hull Moving Average
double hma0 = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,2,0);
double hma1 = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,2,1);
double hma2 = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,2,2);
//+------------------------------------------------------------------+
//| BUY |
//+------------------------------------------------------------------+
if(hma0>hma1 && hma1>hma2)
{
// Wait some pips
double pipsExtra1=Extra_Pips*Point; // Get distance from cross signal
OpenBuy();
return(0);
}
//+------------------------------------------------------------------+
//| SELL |
//+------------------------------------------------------------------+
if(hma0<hma1 && hma1<hma2)
{
// Wait some pips
double pipsExtra2=Extra_Pips*Point; // Get distance from cross signal
OpenSell();
return(0);
}
}
Würde jemand bitte helfen Sie mir mit dem Code für die Berechnung der Losgröße für verschiedene Paare, so dass jeder Pip Gewinn 10 Einheiten der Währung ist? Zum Beispiel, wenn "ProfitPerPip = 10" dann das Los für EURUSD wäre 1,00
Ich danke Ihnen.
Hallo Mladen,
vielen Dank für Ihre Hilfe!
Ich habe Ihren Vorschlag umgesetzt, der Fehler ist weg, was sehr gut ist. Aber der EA ist leider immer noch nicht einen Handel zu öffnen. Ich wäre Ihnen dankbar, wenn Sie die Auftragslogik überprüfen könnten, vielleicht mache ich hier etwas falsch?
int Extra_Pips=1;
extern int HMA_Period=21;
extern int HMA_Price=PRICE_CLOSE; //0
extern double HMA_Speed= 2;
//+------------------------------------------------------------------+
//| ORDER Logic / Indicators |
//+------------------------------------------------------------------+
if(openedOrders<=0)
{
// Forex TSD Hull Moving Average
double hma0 = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price,HMA_Speed,0,2,0);
double hma1 = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,2,1);
double hma2 = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,2,2);
//+------------------------------------------------------------------+
//| BUY |
//+------------------------------------------------------------------+
if(hma0>hma1 && hma1>hma2)
{
// Wait some pips
double pipsExtra1=Extra_Pips*Point; // Get distance from cross signal
OpenBuy();
return(0);
}
//+------------------------------------------------------------------+
//| SELL |
//+------------------------------------------------------------------+
if(hma0<hma1 && hma1<hma2)
{
// Wait some pips
double pipsExtra2=Extra_Pips*Point; // Get distance from cross signal
OpenSell();
return(0);
}
}
tfi_markets
Der einfachste Weg ist, den Trendpuffer zu überprüfen (Puffer 3)
Etwa so:
double trendp = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,2);
if (trendc!=trendp)
{
if (trendc == 1) // code for buy
if (trendc == -1) // code for sell
}
tfi_markets
Der einfachste Weg ist die Überprüfung des Trendpuffers (Puffer 3)
Etwa so:
double trendp = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,2);
if (trendc!=trendp)
{
if (trendc == 1) // code for buy
if (trendc == -1) // code for sell
}
Hallo Mladen,
es tut mir leid, dass ich dich wieder belästigen muss, vielen Dank für deine Vorschläge bis jetzt
Ich habe es wie folgt implementiert, aber leider scheint es den Trendwechsel nicht richtig zu erfassen,
und es läuft bei der Eröffnung von Kaufaufträgen aus dem Ruder, siehe angehängter Screenshot.
Code für Eröffnungsaufträge:
if(openedOrders<=0)
{
// Forex TSD Hull Moving Average
double trendc = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,1);
double trendp = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,2);
if(trendc!=trendp)
{
if(trendc==1) // code for buy
OpenBuy();
return(0);
}
if(trendc==-1) // code for sell
{
OpenSell();
return(0);
}
}
//+------------------------------------------------------------------+
//| Open Buy |
//+------------------------------------------------------------------+
void OpenBuy()
{
double lbStop = 0; if(lStopLoss>0) lbStop = NormalizeDouble(MarketInfo(s_symbol,MODE_ASK)-lStopLoss *pPoint*pipMultiplier,digit);
double lbTake = 0; if(lTakeProfit>0) lbTake = NormalizeDouble(MarketInfo(s_symbol,MODE_ASK)+lTakeProfit*pPoint*pipMultiplier,digit);
if(AccountFreeMargin()<(100*Lots)) { Print("We have no money. Free Margin = ",AccountFreeMargin()); return; }
//
//
//
if(!EcnBroker)
dummyResult=OrderSend(s_symbol,OP_BUY,LotsOptimized(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,lbStop,lbTake,ExpertName,MAGIC,0,clOpenBuy);
else
{
int buyTicket= OrderSend(s_symbol,OP_BUY,LotsOptimized(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,0,0,ExpertName,MAGIC,0,clOpenBuy);
if(buyTicket>= 0)
bool buyOrderMod=OrderModify(buyTicket,OrderOpenPrice(),lbStop,lbTake,0,CLR_NONE);
if(buyOrderMod==false)
{
int ErrorCode = GetLastError();
string ErrDesc = ErrorDescription(ErrorCode);
string ErrAlert=StringConcatenate("Modify Buy Order - Error ",ErrorCode,": ",ErrDesc);
if(ShowAlerts==true) Alert(ErrAlert);
string ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Bid: ",MarketInfo(s_symbol,MODE_BID)," Ticket: ",buyTicket," Stop: ",lbStop," Profit: ",lbTake);
Print(ErrLog);
}
}
}
//+------------------------------------------------------------------+
//| Open Sell |
//+------------------------------------------------------------------+
void OpenSell()
{
double lsStop = 0; if(sStopLoss>0) lsStop = NormalizeDouble(MarketInfo(s_symbol,MODE_BID)+sStopLoss *pPoint*pipMultiplier,digit);
double lsTake = 0; if(sTakeProfit>0) lsTake = NormalizeDouble(MarketInfo(s_symbol,MODE_BID)-sTakeProfit*pPoint*pipMultiplier,digit);
if(AccountFreeMargin()<(100*Lots)) { Print("We have no money. Free Margin = ",AccountFreeMargin()); return; }
//+------------------------------------------------------------------+
//| ECN Broker |
//+------------------------------------------------------------------+
if(!EcnBroker)
dummyResult=OrderSend(s_symbol,OP_SELL,LotsOptimized(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,lsStop,lsTake,ExpertName,MAGIC,0,clOpenSell);
else
{
int sellTicket = OrderSend(s_symbol,OP_SELL,LotsOptimized(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,0,0,ExpertName,MAGIC,0,clOpenSell);
if(sellTicket >= 0)
bool sellOrderMod=OrderModify(sellTicket,OrderOpenPrice(),lsStop,lsTake,0,CLR_NONE);
if(sellOrderMod==false)
{
int ErrorCode = GetLastError();
string ErrDesc = ErrorDescription(ErrorCode);
string ErrAlert=StringConcatenate("Modify Sell Order - Error ",ErrorCode,": ",ErrDesc);
if(ShowAlerts==true) Alert(ErrAlert);
string ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Bid: ",MarketInfo(s_symbol,MODE_BID)," Ticket: ",sellTicket," Stop: ",lsStop," Profit: ",lsTake);
Print(ErrLog);
}
}
}
[/CODE]
Code for closing orders:
[CODE]
void CheckForClose()
{
RefreshRates();
double trendc_c = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,1);
double trendp_c = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,2);
for(int i=0;i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!= MAGIC) continue;
if(OrderSymbol() != s_symbol) continue;
if(trendc_c!=trendp_c) // Check Trend
{
if(OrderType()==OP_BUY)
{
if(trendc_c==1) //is BUY?
{
bool buyClose=OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,clCloseBuy);
if(buyClose==false)
{
int ErrorCode = GetLastError();
string ErrDesc = ErrorDescription(ErrorCode);
string ErrAlert= StringConcatenate("Close Buy Order - Error ",ErrorCode,": ",ErrDesc);
if(ShowAlerts == true) Alert(ErrAlert);
string ErrLog=StringConcatenate("Bid: ",MarketInfo(s_symbol,MODE_BID)," Lots: ",OrderLots()," Ticket: ",OrderTicket());
Print(ErrLog);
}
}
break;
}
}
if(trendc_c!=trendp_c) // Check trend
{
if(OrderType()==OP_SELL)
{
if(trendc_c==-1) // is SELL?
{
bool sellClose= OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,clCloseSell);
if(sellClose == false)
{
ErrorCode = GetLastError();
ErrDesc = ErrorDescription(ErrorCode);
ErrAlert=StringConcatenate("Close Sell Order - Error ",ErrorCode,": ",ErrDesc);
if(ShowAlerts==true) Alert(ErrAlert);
ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Lots: ",OrderLots()," Ticket: ",OrderTicket());
Print(ErrLog);
}
}
break;
}
}
}
}
Vielen Dank im Voraus!
Hallo Mladen,
entschuldigen Sie, dass ich Sie noch einmal belästigen muss, vielen Dank für Ihre Vorschläge bis jetzt
Ich habe es wie folgt implementiert, aber leider scheint es den Trendwechsel nicht richtig zu erfassen,
und bei der Eröffnung von Kaufaufträgen läuft es aus dem Ruder, siehe angehängter Screenshot.
Code für Eröffnungsaufträge:
if(openedOrders<=0)
{
// Forex TSD Hull Moving Average
double trendc = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,1);
double trendp = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,2);
if(trendc!=trendp)
{
if(trendc==1) // code for buy
OpenBuy();
return(0);
}
if(trendc==-1) // code for sell
{
OpenSell();
return(0);
}
}
//+------------------------------------------------------------------+
//| Open Buy |
//+------------------------------------------------------------------+
void OpenBuy()
{
double lbStop = 0; if(lStopLoss>0) lbStop = NormalizeDouble(MarketInfo(s_symbol,MODE_ASK)-lStopLoss *pPoint*pipMultiplier,digit);
double lbTake = 0; if(lTakeProfit>0) lbTake = NormalizeDouble(MarketInfo(s_symbol,MODE_ASK)+lTakeProfit*pPoint*pipMultiplier,digit);
if(AccountFreeMargin()<(100*Lots)) { Print("We have no money. Free Margin = ",AccountFreeMargin()); return; }
//
//
//
if(!EcnBroker)
dummyResult=OrderSend(s_symbol,OP_BUY,LotsOptimized(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,lbStop,lbTake,ExpertName,MAGIC,0,clOpenBuy);
else
{
int buyTicket= OrderSend(s_symbol,OP_BUY,LotsOptimized(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,0,0,ExpertName,MAGIC,0,clOpenBuy);
if(buyTicket>= 0)
bool buyOrderMod=OrderModify(buyTicket,OrderOpenPrice(),lbStop,lbTake,0,CLR_NONE);
if(buyOrderMod==false)
{
int ErrorCode = GetLastError();
string ErrDesc = ErrorDescription(ErrorCode);
string ErrAlert=StringConcatenate("Modify Buy Order - Error ",ErrorCode,": ",ErrDesc);
if(ShowAlerts==true) Alert(ErrAlert);
string ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Bid: ",MarketInfo(s_symbol,MODE_BID)," Ticket: ",buyTicket," Stop: ",lbStop," Profit: ",lbTake);
Print(ErrLog);
}
}
}
//+------------------------------------------------------------------+
//| Open Sell |
//+------------------------------------------------------------------+
void OpenSell()
{
double lsStop = 0; if(sStopLoss>0) lsStop = NormalizeDouble(MarketInfo(s_symbol,MODE_BID)+sStopLoss *pPoint*pipMultiplier,digit);
double lsTake = 0; if(sTakeProfit>0) lsTake = NormalizeDouble(MarketInfo(s_symbol,MODE_BID)-sTakeProfit*pPoint*pipMultiplier,digit);
if(AccountFreeMargin()<(100*Lots)) { Print("We have no money. Free Margin = ",AccountFreeMargin()); return; }
//+------------------------------------------------------------------+
//| ECN Broker |
//+------------------------------------------------------------------+
if(!EcnBroker)
dummyResult=OrderSend(s_symbol,OP_SELL,LotsOptimized(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,lsStop,lsTake,ExpertName,MAGIC,0,clOpenSell);
else
{
int sellTicket = OrderSend(s_symbol,OP_SELL,LotsOptimized(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,0,0,ExpertName,MAGIC,0,clOpenSell);
if(sellTicket >= 0)
bool sellOrderMod=OrderModify(sellTicket,OrderOpenPrice(),lsStop,lsTake,0,CLR_NONE);
if(sellOrderMod==false)
{
int ErrorCode = GetLastError();
string ErrDesc = ErrorDescription(ErrorCode);
string ErrAlert=StringConcatenate("Modify Sell Order - Error ",ErrorCode,": ",ErrDesc);
if(ShowAlerts==true) Alert(ErrAlert);
string ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Bid: ",MarketInfo(s_symbol,MODE_BID)," Ticket: ",sellTicket," Stop: ",lsStop," Profit: ",lsTake);
Print(ErrLog);
}
}
}
[/CODE]
Code for closing orders:
[CODE]
void CheckForClose()
{
RefreshRates();
double trendc_c = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,1);
double trendp_c = iCustom(Symbol(),0,"Hull moving average 2 strict nmc", "", HMA_Period, HMA_Price, HMA_Speed,0,3,2);
for(int i=0;i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!= MAGIC) continue;
if(OrderSymbol() != s_symbol) continue;
if(trendc_c!=trendp_c) // Check Trend
{
if(OrderType()==OP_BUY)
{
if(trendc_c==1) //is BUY?
{
bool buyClose=OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_BID),Slippage*pipMultiplier,clCloseBuy);
if(buyClose==false)
{
int ErrorCode = GetLastError();
string ErrDesc = ErrorDescription(ErrorCode);
string ErrAlert= StringConcatenate("Close Buy Order - Error ",ErrorCode,": ",ErrDesc);
if(ShowAlerts == true) Alert(ErrAlert);
string ErrLog=StringConcatenate("Bid: ",MarketInfo(s_symbol,MODE_BID)," Lots: ",OrderLots()," Ticket: ",OrderTicket());
Print(ErrLog);
}
}
break;
}
}
if(trendc_c!=trendp_c) // Check trend
{
if(OrderType()==OP_SELL)
{
if(trendc_c==-1) // is SELL?
{
bool sellClose= OrderClose(OrderTicket(),OrderLots(),MarketInfo(s_symbol,MODE_ASK),Slippage*pipMultiplier,clCloseSell);
if(sellClose == false)
{
ErrorCode = GetLastError();
ErrDesc = ErrorDescription(ErrorCode);
ErrAlert=StringConcatenate("Close Sell Order - Error ",ErrorCode,": ",ErrDesc);
if(ShowAlerts==true) Alert(ErrAlert);
ErrLog=StringConcatenate("Ask: ",MarketInfo(s_symbol,MODE_ASK)," Lots: ",OrderLots()," Ticket: ",OrderTicket());
Print(ErrLog);
}
}
break;
}
}
}
}
Vielen Dank im Voraus!
Eine Frage: Warum schließen Sie Kaufaufträge, wenn das Kaufsignal eintrifft, und Verkaufsaufträge, wenn das Verkaufssignal eintrifft? Müsste das nicht umgekehrt sein? Und ich denke, dass es einige Dinge verhindern wird, die jetzt passieren
Einfache Frage über Mql5, wie können wir die Indikatorwerte/Labels oben auf dem Unterfenster ausblenden? In mql4, ich weiß, es ist mit "SetIndexLabel(0,NULL);", aber ich kann nicht finden, es für mt5. Vielen Dank!
Einfache Frage zu Mql5, wie kann man die Indikatorwerte/Labels oben im Subfenster ausblenden? In mql4 weiß ich, dass es mit "SetIndexLabel(0,NULL);" geht, aber ich kann es für mt5 nicht finden. Vielen Dank!
airquest
Verwenden Sie : PlotIndexSetInteger(0,PLOT_SHOW_DATA,false); für das
Hallo Mladen. Ich habe einen Experten angehängt, den ich vor der letzten Ausgabe von Metatrader benutzt habe. Jetzt funktioniert er nicht mehr.
Besteht die Möglichkeit, dass du ihn mit deinem Zauberstab wieder zum Laufen bringst? Wenn du das kannst, freue ich mich, wenn ihn jeder benutzen kann....es ist ein guter (oder war!)