Hello, I'm coding a grid system and have a problem. The orders have only a stoploss and no takeprofit, after one stoploss gets hit the ea will close all pending orders to let the winning orders open ! Now I want to let him move the Stoploss of the winning orders to breakeven but he dont do that. Here is my code :
at the onTick:
my function : I let him print out TEST TEST to see if the ea open the function and he did but he doesent move the SL !
you didn't check modify succeed or failed
and if it failed you don't call GetLastError() to get info why modify has failed
What are Function return values ? How do I use them ? - MQL4 forum
- Of course it's possible, you just can't set it above the market.
for(int j=OrdersTotal()-1; j>=0;j--) { if(OrderSelect(j,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==magic) if(OrderType()==OP_BUY) OrderModify(OrderTicket(),OrderOpenPrice(),Kaufpreis+Pipstolockin*Point,OrderTakeProfit(),OrderExpiration(),CLR_NONE); Print("TEST TEST ");
This code will print TEST TEST for every open order order. (No braces.)- Test your return codes
- Print out your variables and find out why.
What is "Kaufpreis+Pipstolockin*Point"?
It doesn't appear to be calculated by using either OrderOpenPrice or current price

- 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'm coding a grid system and have a problem. The orders have only a stoploss and no takeprofit, after one stoploss gets hit the ea will close all pending orders to let the winning orders open ! Now I want to let him move the Stoploss of the winning orders to breakeven but he dont do that. Here is my code :
at the onTick:
if (currentOpenOrders < previousOpenOrders) {closeallorders(); MoveToBreakeven(); } previousOpenOrders = currentOpenOrders;
my function : I let him print out TEST TEST to see if the ea open the function and he did but he doesent move the SL !