Dans le testeur Version:5.00 Build 655 (06.Jun.2012) Aucune modification de vente stoploss, aucune erreur affichée. A l'achat, aucun problème, tout fonctionne
#include <Trade\Trade.mqh>#include <Trade\SymbolInfo.mqh>#include <Trade\PositionInfo.mqh>//+------------------------------------------------------------------+inputdouble Lot = 0.01;
inputint Magic = 77;
inputint Deviation = 3;
//+------------------------------------------------------------------+double ask,bid,stoploss,SL,pos_op_price;
//+------------------------------------------------------------------+
CTrade mytrade;
CSymbolInfo mysymbol;
CPositionInfo myposition;
//+------------------------------------------------------------------+voidOnTick()
{
mysymbol.Name(_Symbol);
mytrade.SetDeviationInPoints(Deviation);
mytrade.SetExpertMagicNumber(Magic);
mysymbol.RefreshRates();
bid = NormalizeDouble(mysymbol.Bid(),_Digits);
ask = NormalizeDouble(mysymbol.Ask(),_Digits);
stoploss = NormalizeDouble(myposition.StopLoss(),_Digits);
SL = NormalizeDouble(mysymbol.StopsLevel()*_Point*3,_Digits); // Три минимальных стопа???
pos_op_price = NormalizeDouble(myposition.PriceOpen(),_Digits);
//+------------------------------------------------------------------+ if (myposition.Select(_Symbol)==false)
{
mytrade.Sell(Lot,NULL,bid,ask + SL,0,"Sell");
if(mytrade.ResultRetcode()==10009 || mytrade.ResultRetcode()==10008)
{
Alert("Position Sell успешно помещен, тикет ордера #:",mytrade.ResultDeal(),"!!");
}
else
{
Alert("Запрос на установку Position Sell не выполнен - код ошибки:",mytrade.ResultRetcode(),
"сообщение об ошибке - ",mytrade.ResultRetcodeDescription());
return;
}
}
//+------------------------------------------------------------------+if (myposition.Select(_Symbol))
{
if (myposition.Type() == POSITION_TYPE_SELL)
{
if (ask + SL < stoploss)
mytrade.PositionModify(_Symbol,NormalizeDouble(ask + SL,_Digits),0);
if(mytrade.ResultRetcode()==10009 || mytrade.ResultRetcode()==10008)
{
Alert("Stoploss Position Sell успешно помещен :",stoploss);
}
else
{
Alert("Запрос на установку Stoploss Position Sell не выполнен - код ошибки:",mytrade.ResultRetcode(),
"сообщение об ошибке - ",mytrade.ResultRetcodeDescription());
return;
}
}
}
//+------------------------------------------------------------------+Comment("ask ",ask,"\n","bid ",bid,"\n","SL ",SL,"\n","stoploss ",stoploss,
"\n","pos_op_price ",pos_op_price,"\n","slsell ",NormalizeDouble(ask + SL,_Digits));
//+------------------------------------------------------------------+
}
//+------------------------------------------------------------------+
Dans le testeur Version:5.00 Build 655 (06.Jun.2012) Aucune modification de vente stoploss, aucune erreur affichée. A l'achat, aucun problème, tout fonctionne
Essayez les modifications suivantes
if (myposition.PositionType() == POSITION_TYPE_SELL)
Si vous n'avez pas de compte, veuillez vous inscrire
Autorisez l'utilisation de cookies pour vous connecter au site Web MQL5.com.
Veuillez activer les paramètres nécessaires dans votre navigateur, sinon vous ne pourrez pas vous connecter.
Vous êtes connecté. L'authentification à deux facteurs a été désactivée. Configurez-la à nouveau et scannez un nouveau code QR, ou continuez avec l'authentification à deux facteurs désactivée.
Si vous exécutez ce code, le terminal affiche une erreur " Invalid EX5 file":
Merci, nous allons nous en occuper.
Arcs de Fibonacci
Lamodification du niveau provoque une erreur de compilation
Arcs de Fibonacci
Lamodification du niveau provoque une erreur de compilation
OBJPROP_LEVELVALUEil s'agit d'une propriété Integer ?et vous êtes sûr que
c'est une propriété Integer ?
Dans le testeur Version:5.00 Build 655 (06.Jun.2012) Aucune modification de vente stoploss, aucune erreur affichée. A l'achat, aucun problème, tout fonctionne
Quel serveur ?
Quel serveur ?
Dans le testeur Version:5.00 Build 655 (06.Jun.2012) Aucune modification de vente stoploss, aucune erreur affichée. A l'achat, aucun problème, tout fonctionne
Essayez les modifications suivantes
Essayez ces modifications