JermyRec points you to a logical error made by you. It is necessary to check whether the order has been selected. The OrderSelect() function returns true if the order was selected and false if not selected. If you do not do this check, it is possible that the order with the specified ticket does not exist. Then you can get an unpredictable result of your entire function.
int CloseOrder( int ticket, double prce){
//+--------------------------------------------------------------------------------------------------------------+double price;
int slippage;
double p = prce;
int maxtry = RequoteAttempts;
color CloseColor;
if (!OrderSelect (ticket, SELECT_BY_TICKET , MODE_TRADES )) return(-1);
int ordtype = OrderType ();
if (ordtype == OP_BUY ) {price = NormalizeDouble ( Bid ,
.........
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I do not understand friend
JermyRec points you to a logical error made by you. It is necessary to check whether the order has been selected. The OrderSelect() function returns true if the order was selected and false if not selected. If you do not do this check, it is possible that the order with the specified ticket does not exist. Then you can get an unpredictable result of your entire function.
That's a work around, add 1 extra line
Please don't write ur - it's "you are" or "your" - MQL4 programming forum 2014.03.04
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor
help me????????????????????????????
string cheekmoving()
{
if(iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,2)<iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,1)&&
iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,2)<iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,1))
if(iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,2)<iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,2)&&
iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,1)>iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,1))
return ("BUY");
if(iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,2)>iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,1)&&
iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,2)>iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,1))
if(iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,2)>iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,2)&&
iMA(NULL,0,MAs,0,MODE_SMA,PRICE_CLOSE,1)<iMA(NULL,0,MAl,0,MODE_SMA,PRICE_CLOSE,1))
return ("SELL");
else return ("NO");
}
Please edit your post and
use the code button (Alt+S) when pasting code
Hello,
Same problem here!
Can anyone help me, please?
{ if (MathMod(FractalPeriod,2)==0) FractalPeriod = FractalPeriod+1; SetIndexBuffer(0,UpperBuffer); SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1); SetIndexArrow(0,234); SetIndexBuffer(1,LowerBuffer); SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1); SetIndexArrow(1,233); }Hello,
Same problem here!
Can anyone help me, please?
you need to post all of the code to be able to see your problem, it is not in the code you have posted so far
That's a work around, add 1 extra line