I need your helps please .I cant use English so correctly, that's why ,
I use the
google translation service.
if you find some errors.
I am a
beginner in programming, I just studied the language mql4.
I am training to create some functions,
I want to
program a very easy code:
I want Metatraider to execute a buy order without any conditions.
then if the price go up or down by 30 points, it opens a second sale order.
By doing a
backtest, the code opens multiples buy orders knowing that I gave it the order
to open a single buy order.
the error please ???
You can use a check function to see if there are already any orders with the same magic number and symbol
like this one
bool AreThereOrders ()
for (i=OrdersTotal()-1; i>=0; i--)
if( OrderMagicNumber()== magic && OrderSymbol()==Symbol())
return (false) ;
in the trading conditions just add AreThereOrders()==false
RefreshRates(); // on raffraichit la valeur de Ask
ticket_buy=OrderSend(Symbol(),OP_BUY,lot_buy,Ask,slippage,0,0,NULL,magic_buy,0,0); //executer l'ordre d'achat
if (price == price_open_buy + (distance*pip))
it works ,
thank you Stanislav Ivanov, I used your function and it works very well.
thank you whroeder1, i followed all your valuable advice and i visited all the links you put.
I am currently working on the equality of double.
I hope to benefit from your help