... eigentlich ist die Berechnung nicht falsch bzw. wenn die Lotgrösse falsch ist kommt eine Fehlermeldung ... was ich fragen wollte was genau checkt er bzw. wie checkt er.
... eigentlich ist die Berechnung nicht falsch bzw. wenn die Lotgrösse falsch ist kommt eine Fehlermeldung ... was ich fragen wollte was genau checkt er bzw. wie checkt er.
danke nochmal
Naja, aufgrund der falschen Losgröße gibt es keinen Handel, such halt eine andere Lösung für die Losgröße.
Bei mir ist die Lotgrösse als extern definiert. Jetzt macht schon Handel(hängt vom intial Wert ab), kriege abe immer noch die Meldung mit der Lotgrösse, was nicht sein kann ...
CheckVolumeValue - holt die defnierte Lotgrösse , Falls zu gross ist nimmt die minimal erlaubte --> die wird nochmal gecheckt (CheckLotValue) und auch das Geld/AccountFreeMarginCheck (CheckMoneyForTrade)
Hoffe kriege noch Antwort , vielleicht ist auch hilfreich für alle anderen ....
Aber woher kommt dann der Eintrag, dass es weder für EURUSD H1 noch für NZDUSD H1 eine Position eröffnet wird?
Er macht jetzt schon Trades und kriege diese zwei arten von Fehler, was ich nicht verstehen kann ... Im StrategyTester kriege ich sie nicht und der Roboter rennt auch seit 3 Monaten ohne Probleme ...
amando: Dan lese mal die fehlermeldung, das wirst du selber lösen müssen oder deinen code hier posten. Wir können hier nicht glaskugel lesen.
Hier der Code ... die Prozeduren sind von der Seite mit der Beschreibung (https://www.mql5.com/en/articles/2555) deshlab habe sie nicht angeführt...
double lotb=CheckVolumeValue(getLotSize(Symbol(),magicnr),OP_BUY);
if(CheckMoneyForTrade(Symbol(),lotb,OP_BUY) || CheckLotValue(lotb))
{
Tick=0;
while(Tick<1)
{
while(IsTradeContextBusy())
Sleep(100);
RefreshRates();
SL = Ask - StopLoss * gpoint_320;
Tick=OrderSend(Symbol(),OP_BUY,lotb,nor_1(Ask),1,SL,0,buycomment,magicnr,0,clrBlue);
if(Tick<1) {
Print("Error opening OP_BUY: ",GetLastError()); Sleep(1000);
RefreshRates();
} else {
//SL = Ask - StopLoss * gpoint_320;
TP = Ask + TakeProfit * gpoint_320;
//--- check the levels before modifying the order if(OrderModifyCheck(OrderTicket(), OrderOpenPrice(), SL, TP))
{
if(!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0))
{
Print("Failed setting TP/SL OrderType: Buy errcode : ",GetLastError());
return;
}
elsePrint("Successfully setting TP/SL on OrderType: Buy");
}
}
}
}
===================================
//+------------------------------------------------------------------+//| Check the correctness of the lot volume |//+------------------------------------------------------------------+bool CheckLotValue(double volume)
{
//--- minimal allowed volume for trade operationsdouble min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
if(volume<min_volume)
{
Print("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume);
return(false);
}
//--- maximal allowed volume of trade operationsdouble max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
if(volume>max_volume)
{
Print("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume);
return(false);
}
//--- get minimal step of volume changingdouble volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);
int ratio=(int)MathRound(volume/volume_step);
if(MathAbs(ratio*volume_step-volume)>0.0000001)
{
Print("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f",
volume_step,ratio*volume_step);
return(false);
}
//description="Correct volume value";return(true);
}
//+------------------------------------------------------------------+//| Checking the new values of levels before order modification |//+------------------------------------------------------------------+bool OrderModifyCheck(int ticket,double price,double sl,double tp)
{
//--- select order by ticketif(OrderSelect(ticket,SELECT_BY_TICKET))
{
//--- point size and name of the symbol, for which a pending order was placedstring symbol=OrderSymbol();
double point=SymbolInfoDouble(symbol,SYMBOL_POINT);
//--- check if there are changes in the Open pricebool PriceOpenChanged=true;
int type=OrderType();
if(!(type==OP_BUY || type==OP_SELL))
{
PriceOpenChanged=(MathAbs(OrderOpenPrice()-price)>point);
}
//--- check if there are changes in the StopLoss levelbool StopLossChanged=(MathAbs(OrderStopLoss()-sl)>point);
//--- check if there are changes in the Takeprofit levelbool TakeProfitChanged=(MathAbs(OrderTakeProfit()-tp)>point);
//--- if there are any changes in levelsif(PriceOpenChanged || StopLossChanged || TakeProfitChanged)
return(true); // order can be modified //--- there are no changes in the Open, StopLoss and Takeprofit levelselse//--- notify about the errorPrintFormat("Order #%d already has levels of Open=%.5f SL=%.5f TP=%.5f",
ticket,OrderOpenPrice(),OrderStopLoss(),OrderTakeProfit());
}
//--- came to the end, no changes for the orderreturn(false); // no point in modifying
}
//+------------------------------------------------------------------+//| Check Volume Value |//+------------------------------------------------------------------+double CheckVolumeValue(double check,int type)
{
double val=check;
MarketInfo(Symbol(),MODE_LOTSTEP);
double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
if(check<min_volume)
val=min_volume;
double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
if(check>max_volume)
val=max_volume;
double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);
int ratio=(int)MathRound(check/volume_step);
if(MathAbs(ratio*volume_step-check)>0.0000001)
val=ratio*volume_step;
double margin=AccountFreeMarginCheck(Symbol(),type,val);
if(margin<0)
val=MarketInfo(Symbol(),MODE_MINLOT);
return(val);
}
//+------------------------------------------------------------------+//| Check Money |//+------------------------------------------------------------------+bool CheckMoneyForTrade(string symb, double lots,int type)
{
double free_margin=AccountFreeMarginCheck(symb,type, lots);
//-- if there is not enough moneyif(free_margin<0)
{
string oper=(type==OP_BUY)? "Buy":"Sell";
Print("Not enough money for ", oper," ",lots, " ", symb, " Error code=",GetLastError());
return(false);
}
//--- checking successfulreturn(true);
}
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
Wenn Sie kein Benutzerkonto haben, registrieren Sie sich
Erlauben Sie die Verwendung von Cookies, um sich auf der Website MQL5.com anzumelden.
Bitte aktivieren Sie die notwendige Einstellung in Ihrem Browser, da Sie sich sonst nicht einloggen können.
Sie sind angemeldet. Die Zwei-Faktor-Authentifizierung wurde deaktiviert. Richten Sie sie erneut ein und scannen Sie einen neuen QR-Code oder fahren Sie mit deaktivierter Zwei-Faktor-Authentifizierung fort.
Danke mal für die Hilfe ;) ... mit dem Indicator hats geklappt.
Jetzt kriege die Meldung, könnt ihr mir da noch ein bischen weiterhelfen.
danke.
test on EURUSD,H1
there are no trading operations
test on NZDUSD,H1
2019.07.23 08:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
2019.07.23 09:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
2019.07.23 10:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
2019.07.23 13:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
2019.07.23 14:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
2019.07.23 15:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
2019.07.23 16:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
2019.07.23 19:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
2019.07.23 20:00:00 MultiStrategy_Trading__1 NZDUSD,H1: invalid lots amount for FreeMarginCheck function
there are no trading operations
Puhh hah ....da sieht man mal was einige Produkte an Qualität aufweisen.
Einfachste Fehlermeldungen können nicht gelöst werden.
Hey, danke mal für die Kritik ;)
... eigentlich ist die Berechnung nicht falsch bzw. wenn die Lotgrösse falsch ist kommt eine Fehlermeldung ... was ich fragen wollte was genau checkt er bzw. wie checkt er.
danke nochmal
Hey, danke mal für die Kritik ;)
... eigentlich ist die Berechnung nicht falsch bzw. wenn die Lotgrösse falsch ist kommt eine Fehlermeldung ... was ich fragen wollte was genau checkt er bzw. wie checkt er.
danke nochmal
Sorry, muss nochmal fragen ;)
Bei mir ist die Lotgrösse als extern definiert. Jetzt macht schon Handel(hängt vom intial Wert ab), kriege abe immer noch die Meldung mit der Lotgrösse, was nicht sein kann ...
ich checke die Lotgrösse drei mal
double lotb=CheckVolumeValue(getLotSize(Symbol(),magicnr),OP_BUY);
if(CheckMoneyForTrade(Symbol(),lotb,OP_BUY) || CheckLotValue(lotb)) {....OrderSend()...}
CheckVolumeValue - holt die defnierte Lotgrösse , Falls zu gross ist nimmt die minimal erlaubte --> die wird nochmal gecheckt (CheckLotValue) und auch das Geld/AccountFreeMarginCheck (CheckMoneyForTrade)
Hoffe kriege noch Antwort , vielleicht ist auch hilfreich für alle anderen ....
danke.
Aber woher kommt dann der Eintrag, dass es weder für EURUSD H1 noch für NZDUSD H1 eine Position eröffnet wird?
Aber woher kommt dann der Eintrag, dass es weder für EURUSD H1 noch für NZDUSD H1 eine Position eröffnet wird?
Er macht jetzt schon Trades und kriege diese zwei arten von Fehler, was ich nicht verstehen kann ... Im StrategyTester kriege ich sie nicht und der Roboter rennt auch seit 3 Monaten ohne Probleme ...
test on EURUSD,H1
2020.04.01 11:00:00 MultiStrategy_Trading EURUSD,H1: invalid lots amount for FreeMarginCheck function
2020.04.01 21:19:11 MultiStrategy_Trading EURUSD,H1: OrderModify error 1
strategy tester report 415 total trades
Dan lese mal die fehlermeldung, das wirst du selber lösen müssen oder deinen code hier posten. Wir können hier nicht glaskugel lesen.
Hier der Code ... die Prozeduren sind von der Seite mit der Beschreibung (https://www.mql5.com/en/articles/2555) deshlab habe sie nicht angeführt...