Olosta
OP_BUY and OP_SELL are immediate orders to go in at the price right now
STOP orders wait at a price to come to them and go on in the same direction (you hope)
LIMIT orders wait at a price to come to them and go in the opposite direction (you hope)
So....
> ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,StopLoss,ProfitTarget,"My order #1",16384,0,Green);
Sends one order to be executed immediately
> OrderSend(Symbol(), OP_BUYSTOP, Lot, Ask+Distance*Point, 1, Ask, 0, "My main order", 16384, 0, CLR_NONE); //executed order
Sends one pending order waiting at price Ask+Distance*Point
etc, etc
OrderClose will cancel one order at a time - but the order has to be selected first
See the code examples here 'BARROW BOY, PLEASE CAN YOU HELP ME CHECK OUT THIS CODE?'
Good Luck
-BB-
Let Google be your friend :)
http://www.alpari-idc.com/en/new_to_markets/trade/mt4_userguide/stop_loss.html
-BB-
> Is the stoploss, and the profit target send to the market as pending orders
No, these values are parts of the same order so you can leave the PC off once the order is placed
If you want the EA to trail stops or do an OrderClose before the SL or TP is hit, you will need to leave the PC on and the internet connection to stay up..
-BB-
mmmm ok thank you very much for the answer.
My example was a little stupid, because my EA needs to be activated everytime, so I cannot leave the pc shutdown, but I need your answer, to know if I have to cancel independently the stoploss, the profit target, and the main order.
Thank you ;)
Excuse me to disturb you again. But for example, if I use OrderClose() to close, do u think that the stoploss order, and the profittarget order will get cancelled automatically ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I would like to know something about the function Ordersend().
When I write :
ticket=OrderSend(Symbol(),OP_BUY,1,Ask,3,StopLoss,ProfitTarget,"My order #1",16384,0,Green);
How many orders this function delivers ? 1 or 3 (one executed order, and two pending orders ? )
Is it the same as this ? :
BuyStop:
OrderSend(Symbol(), OP_BUYSTOP, Lot, Ask+Distance*Point, 1, Ask, 0, "My main order", 16384, 0, CLR_NONE); //executed order
SellStop:
OrderSend(Symbol(), OP_SELLSTOP, Lot, StopLoss, 1, 0, 0, "SL", Magic, 0, CLR_NONE);//pending order
SellLimit:
OrderSend(Symbol(), OP_SELLLIMIT, Lot, ProfitTarget, 1, 0, 0, "PT", Magic, 0, CLR_NONE);//pending order
If yes, if I use orderclose(), do you think it cancel the two pending orders (SL and PT)?
Many thanks.