- How to code?
- TakeprofitEAHiLoTradeAway
- Questions from Beginners MQL5 MT5 MetaTrader 5
hi guys im new in coding MQL4 and I have made an EA, but my problem is I have a function named "UpdateTPBuy". This function purpose is to change all take profit of my buy order to the NetMeanOpeningPrice the problem is every time it run it only changes 1of my buy orders. can you check on my code? thank you so much :)
It can be helpful if you add this code and write the result from the expert tab here.
void UpdateTPbBUY() { for(int i=OrdersTotal()-1;i>= 0 ;i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==true) { if(OrderSymbol()==Symbol() && OrderType() == OP_BUY) { result abd= OrderModify(OrderTicket(), OrderOpenPrice(),0,NetMeanOpeningPriceBuy(),0,0); Print(" TP :"+NetMeanOpeningPriceBuy()+" Error Codes "+GetLastError()); } } }
It can be helpful if you add this code and write the result from the expert tab here.
Thank you sir for your response. On the Experts tab this error appear "2021.07.09 14:22:40.881 TestEa EURUSD,H1: Error in OrderModify. Error code=1"
i think i solved it i put this "double BEbuy=NetMeanOpeningPriceBuy();" above for loop. but ill test it again. thanks :)
Thank you sir for your response. On the Experts tab this error appear "2021.07.09 14:22:40.881 TestEa EURUSD,H1: Error in OrderModify. Error code=1"
i think i solved it i put this "double BEbuy=NetMeanOpeningPriceBuy();" above for loop. but ill test it again. thanks :)
when using OrderModify
for example if you want change take profit
if the value of entered takeprofit be same and repeated...you will receive error 1
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use