Questions des débutants MQL5 MT5 MetaTrader 5 - page 418
Vous manquez des opportunités de trading :
- Applications de trading gratuites
- Plus de 8 000 signaux à copier
- Actualités économiques pour explorer les marchés financiers
Inscription
Se connecter
Vous acceptez la politique du site Web et les conditions d'utilisation
Si vous n'avez pas de compte, veuillez vous inscrire
Bonjour, j'ai obtenu cette erreur - à partir du journal du testeur de stratégie:
2015.08.26 14:09:47.704 2001.08.29 16:15 array out of range in 'Kamikadze_MA_V_04_42_Fibo_03.mq4' (929,29)
(929,29) - s'agit-il d'une chaîne de caractères et du numéro d'ordre du caractère dans la chaîne ?
Bonjour, j'ai obtenu cette erreur - à partir du journal du testeur de stratégie:
2015.08.26 14:09:47.704 2001.08.29 16:15 array out of range in 'Kamikadze_MA_V_04_42_Fibo_03.mq4' (929,29)
(929,29) - s'agit-il d'une chaîne de caractères et du numéro d'ordre du caractère dans la chaîne ?
Bonjour, j'ai obtenu cette erreur - à partir du journal du testeur de stratégie:
2015.08.26 14:09:47.704 2001.08.29 16:15 array out of range in 'Kamikadze_MA_V_04_42_Fibo_03.mq4' (929,29)
(929,29) - s'agit-il d'une chaîne de caractères et du numéro d'ordre du caractère dans la chaîne ?
Oui.
Deux ans que ça marche, et puis bang et erreur - je pense qu'il y a beaucoup de commandes à ce moment-là. Voici le code, ce qui ne va pas ici (mis en évidence en gras) - conseiller - s'il vous plaît
if(!CloseOk)
{
if(OrderType()==OP_BUY)
{
//Print("BUY=",OrderTicket());
nBuy++;
if(lastTimeBuy<1 || lastTimeBuy<OrderOpenTime())lastTimeBuy=OrderOpenTime();
//if (TP_Error<stplvl/Point)TP_Error=stplvl/Point;
//if (OrderOpenPrice()+stplvl>MAT)NewTP=Ask+TP_Error*Point;else NewTP=MAT;
//if (TP_Error==0)NewTP=MAT;
NewTP=NormalizeDouble(MAT,Digits);
if(MathAbs(NewTP-OrderTakeProfit())>1*Point)
{//модифицируем ТП
if(swCommentary)
Print("Модификация Тейк-Профита BUY "+DoubleToStr(NewTP,Digits)+" OPEN="+OrderOpenPrice());
ModifyStopTake(0,stpls,NewTP);takepr=NewTP;
}
if(BU!=0 && OrderStopLoss()!=(OrderOpenPrice()+BU*Point) && //безубыток
Bid>BUbuy && Ask>(OrderOpenPrice()+BU*Point+stplvl) &&
(Levl_Zerro==0 || (maMirrorOBuy<(OrderOpenPrice()-Levl_Zerro*Point))))
{
if(swCommentary)Print("Безубыток BUY "+DoubleToStr(OrderOpenPrice()+BU*Point,Digits));
if(maMBlock!=1){Print("BUY 2");ModifyStopTake(0,OrderOpenPrice()+BU*Point,takepr);stpls=OrderOpenPrice()+BU*Point;}
OrderBU[NorderBU]=OrderTicket();NorderBU++;
}//maMBlock!=1&&
if(BarSL!=0 && iBarShift(NULL,0,OrderOpenTime())>=BarSL)
{
if(swCommentary)Print("BARSL BUY");ClosePosBySelect();
if(blockBarSL>0)
{
YesBarSLBuy=0;if(swCommentary)Print("blockBARSL BUY");
//ClosePositions("NULL",OP_BUY,Magic);
ClosePosBySelect();
}
}//BARSL
}
if(OrderType()==OP_SELL)
{
//Print("SELL=",OrderTicket());
nSell++;
if(lastTimeSell<1 || lastTimeSell<OrderOpenTime())lastTimeSell=OrderOpenTime();
//if (TP_Error<stplvl/Point)TP_Error=stplvl/Point;
//if (OrderOpenPrice()-stplvl<MAT)NewTP=Bid-TP_Error*Point;else NewTP=MAT;
//if (TP_Error==0)NewTP=MAT;
NewTP=NormalizeDouble(MAT,Digits);
if(MathAbs(NewTP-OrderTakeProfit())>1*Point)
{//модифицируем ТП
if(swCommentary)
Print("Модификация Тейк-Профита SELL "+DoubleToStr(NewTP,Digits)+" OPEN="+OrderOpenPrice()+
" STOP="+OrderStopLoss());
ModifyStopTake(0,stpls,NewTP);takepr=NewTP;
}
if(BU!=0 && OrderStopLoss()!=(OrderOpenPrice()-BU*Point) && Bid<BUsell && //безубыток
Bid<(OrderOpenPrice()-BU*Point-stplvl) &&
(Levl_Zerro==0 || ((OrderOpenPrice()+Levl_Zerro*Point)<maMirrorOSell)))
{
if(swCommentary)Print("Безубыток SELL "+DoubleToStr(OrderOpenPrice()-BU*Point,Digits));
if(maMBlock!=1){Print("SELL 2");ModifyStopTake(0,OrderOpenPrice()-BU*Point,takepr);stpls=OrderOpenPrice()-BU*Point;}
OrderBU[NorderBU]=OrderTicket();NorderBU++;
} // maMBlock!=1&&
if(BarSL!=0 && iBarShift(NULL,0,OrderOpenTime())>=BarSL)
{
if(swCommentary)Print("BARSL SELL");
ClosePosBySelect();
if(blockBarSL>0)
{
YesBarSLSell=0;if(swCommentary)Print("BARSL SELL");
//ClosePositions("NULL",OP_SELL,Magic);
ClosePosBySelect();
}
}//BARSL
}
}
Deux ans que ça marche, et puis bang et erreur - je pense qu'il y a beaucoup de commandes à ce moment-là. Voici le code, ce qui ne va pas ici (mis en évidence en gras) - conseiller - s'il vous plaît
Vous sortez du tableau de l'OrderBU.
Ajouté : utiliser le stylisme - cela aidera à rendre le code lisible.
Deux ans que ça marche, et puis bang et erreur - je pense qu'il y a beaucoup de commandes à ce moment-là. Voici le code, ce qui ne va pas ici (mis en évidence en gras) - conseiller - s'il vous plaît
if(!CloseOk)
{
if(OrderType()==OP_BUY)
{
//Print("BUY=",OrderTicket());
nBuy++;
if(lastTimeBuy<1 || lastTimeBuy<OrderOpenTime())lastTimeBuy=OrderOpenTime();
//if (TP_Error<stplvl/Point)TP_Error=stplvl/Point;
//if (OrderOpenPrice()+stplvl>MAT)NewTP=Ask+TP_Error*Point;else NewTP=MAT;
//if (TP_Error==0)NewTP=MAT;
NewTP=NormalizeDouble(MAT,Digits);
if(MathAbs(NewTP-OrderTakeProfit())>1*Point)
{//модифицируем ТП
if(swCommentary)
Print("Модификация Тейк-Профита BUY "+DoubleToStr(NewTP,Digits)+" OPEN="+OrderOpenPrice());
ModifyStopTake(0,stpls,NewTP);takepr=NewTP;
}
if(BU!=0 && OrderStopLoss()!=(OrderOpenPrice()+BU*Point) && //безубыток
Bid>BUbuy && Ask>(OrderOpenPrice()+BU*Point+stplvl) &&
(Levl_Zerro==0 || (maMirrorOBuy<(OrderOpenPrice()-Levl_Zerro*Point))))
{
if(swCommentary)Print("Безубыток BUY "+DoubleToStr(OrderOpenPrice()+BU*Point,Digits));
if(maMBlock!=1){Print("BUY 2");ModifyStopTake(0,OrderOpenPrice()+BU*Point,takepr);stpls=OrderOpenPrice()+BU*Point;}
OrderBU[NorderBU]=OrderTicket();NorderBU++;
}//maMBlock!=1&&
if(BarSL!=0 && iBarShift(NULL,0,OrderOpenTime())>=BarSL)
{
if(swCommentary)Print("BARSL BUY");ClosePosBySelect();
if(blockBarSL>0)
{
YesBarSLBuy=0;if(swCommentary)Print("blockBARSL BUY");
//ClosePositions("NULL",OP_BUY,Magic);
ClosePosBySelect();
}
}//BARSL
}
if(OrderType()==OP_SELL)
{
//Print("SELL=",OrderTicket());
nSell++;
if(lastTimeSell<1 || lastTimeSell<OrderOpenTime())lastTimeSell=OrderOpenTime();
//if (TP_Error<stplvl/Point)TP_Error=stplvl/Point;
//if (OrderOpenPrice()-stplvl<MAT)NewTP=Bid-TP_Error*Point;else NewTP=MAT;
//if (TP_Error==0)NewTP=MAT;
NewTP=NormalizeDouble(MAT,Digits);
if(MathAbs(NewTP-OrderTakeProfit())>1*Point)
{//модифицируем ТП
if(swCommentary)
Print("Модификация Тейк-Профита SELL "+DoubleToStr(NewTP,Digits)+" OPEN="+OrderOpenPrice()+
" STOP="+OrderStopLoss());
ModifyStopTake(0,stpls,NewTP);takepr=NewTP;
}
if(BU!=0 && OrderStopLoss()!=(OrderOpenPrice()-BU*Point) && Bid<BUsell && //безубыток
Bid<(OrderOpenPrice()-BU*Point-stplvl) &&
(Levl_Zerro==0 || ((OrderOpenPrice()+Levl_Zerro*Point)<maMirrorOSell)))
{
if(swCommentary)Print("Безубыток SELL "+DoubleToStr(OrderOpenPrice()-BU*Point,Digits));
if(maMBlock!=1){Print("SELL 2");ModifyStopTake(0,OrderOpenPrice()-BU*Point,takepr);stpls=OrderOpenPrice()-BU*Point;}
OrderBU[NorderBU]=OrderTicket();NorderBU++;
} // maMBlock!=1&&
if(BarSL!=0 && iBarShift(NULL,0,OrderOpenTime())>=BarSL)
{
if(swCommentary)Print("BARSL SELL");
ClosePosBySelect();
if(blockBarSL>0)
{
YesBarSLSell=0;if(swCommentary)Print("BARSL SELL");
//ClosePositions("NULL",OP_SELL,Magic);
ClosePosBySelect();
}
}//BARSL
}
}
Votre erreur "Out of array" signifie que l'EA demande une valeur supérieure à celle du tableau initialisé ou du tableau traité,
Par exemple, si le tableau traite 6 paramètres, l'initialisation doit être de 6 (de 0 à 5 ce que nous traitons), le comptage est de zéro et l'initialisation est de 1.
Vous sortez du tableau de l'OrderBU.
Ajouté : utiliser le stylisme - cela aidera à rendre le code lisible.
Merci pour le conseil, la fenêtre du tableau est décente ArrayResize(OrderBU,1000) ; comment se fait-il que...
Vous payez des gens - ils l'écrivent, et ensuite vous vous asseyez et réfléchissez dessus.
Merci pour le conseil, la fenêtre du tableau est décente ArrayResize(OrderBU,1000) ; comment se fait-il que...
Vous payez des gens - ils l'écrivent, et ensuite vous vous asseyez et réfléchissez dessus.
Puisque "deux années ont fonctionné", cela signifie que le code a été écrit pour l'ancienne mql4, où les dépassements de tableau étaient "autorisés", maintenant ils ne le sont plus, maintenant c'est une erreur. Vous avez raison.