Pls Help, Why does this code open more orders at similar price
-
Finish your loop setting a bool if there is; then test it. If any (not all) of the open orders are not in your range, you open a new order.
-
{for (int x=0; x <= OrdersTotal(); x++){ OrderResult=OrderSelect(x,SELECT_BY_POS,MODE_TRADES);Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014 - If there are n orders, their positions are [0 … n-1]. You try and fail to select n but continue anyway.
Hi,
My objective is that if there is an existing open order at a price between (PB1-PBDip1) and (PB1+PBDip1) then the loop should not open another order.
When i test this code it keeps opening new orders every second irrespective of existing open order price
Kindly guide