I like, to avoid brokers possible excessive slippage, make a routine that continuously check for my open positions and:
1. if profit of a position is above the wanted profit, close that position with minimal deviation.
if the position is not successfully closed due to the deviation unachievable, then no problem, the next time my function runs, it will try and close it
2. same logic to exit position if loss above max loss.
Now my question is:
1. is it enough to use CTrade class with such commands as:
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 like, to avoid brokers possible excessive slippage, make a routine that continuously check for my open positions and:
1. if profit of a position is above the wanted profit, close that position with minimal deviation.
if the position is not successfully closed due to the deviation unachievable, then no problem, the next time my function runs, it will try and close it
2. same logic to exit position if loss above max loss.
Now my question is:
1. is it enough to use CTrade class with such commands as:
does this work? is the closing price updated automatically be MT5 software so I do not have to precise the level at which i want to exit?
2. or should i instead
MyTrade.BuyLimit(LotSize,MyPrice,MyPair,MySL,MyTP,ORDER_TIME_GTC,expire,Mynote);The truth I am confused about placing limit orders: what if they are not fulfilled, shall I continuously update the prices?
what if I update the price and then these orders are filled twice (ie the old one is still in memory, and price reach both prices)?
Thanks.