does the ordermodify is realized when included in an "if" loop?
Yes, of course . . . OrderModify() returns a bool . . . my code says . . .
if(! bool) // not bool, so . . . if falsePrint("Order Modify failed, error # ", GetLastError() ); // the {} are not needed for a single line (except in some else conditions)
The way you are using functions doesn't make a lot of sense . . . if a function is designed to returns a value then you should use that return value . . .
TradeAllowed = fTradeAllowed (iTimeDebut, iTimeFin);
bool fTradeAllowed (int iTimeDebut, int iTimeFin)
{
iTimeSeconds = Hour()*3600 + Minute()*60 + Seconds(); // Conversion de l'heure actuelle en secondes ;if(iTimeSeconds >= iTimeDebut && iTimeSeconds < iTimeFin) // Vérification si l'heure est dans la plage horaire du filtre horairereturn(true);
elsereturn(false);
}
. . . you can also use local variables in the function instead of globally declared variables.
Do i have to call the function fTradeAllowed before if (TradeAllowed)... or is it useless ?
You have to call the function, it sets the value of TradeAllowed . . . the way the function is currently written is not very logical and it makes no use of returning it's type.
RaptorUK: You have to call the function, it sets the value of TradeAllowed . . . the way the function is currently written is not very logical and it makes no use of returning it's type.
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 use the tradeallowed function : And trade is allowed between 9am to 20pm so yes actually it is true.
OK, it seems your position size calculations are not working properly, try 1% risk instead of 5% . . .
This is a bad idea . . .
Read this thread: Can price != price ?
Ok! thank you very much, the problem lied in the size positions... not enought money...
but when you wrote :
does the ordermodify is realized when included in an "if" loop?
indeed do the 2 blocks are tantamount ?
does the ordermodify is realized when included in an "if" loop?
Yes, of course . . . OrderModify() returns a bool . . . my code says . . .
indeed do the 2 blocks are tantamount ?
In this code . . . .
. . . you are calling OrderModify() twice .. .
ok! thank you :)
and last question, in the EA i wrote :
Do i have to call the function fTradeAllowed before if (TradeAllowed)... or is it useless ?The way you are using functions doesn't make a lot of sense . . . if a function is designed to returns a value then you should use that return value . . .
. . . you can also use local variables in the function instead of globally declared variables.
ok! thank you :)
and last question, in the EA i wrote :
Do i have to call the function fTradeAllowed before if (TradeAllowed)... or is it useless ?You have to call the function, it sets the value of TradeAllowed . . . the way the function is currently written is not very logical and it makes no use of returning it's type.
ok thank you :)