Error 130 on OrderModify || order modified few times and then start sending error
and
Error 130
void ModifyPendingOrderSar() { if(OrderType()==OP_SELLSTOP)C=Red;if(OrderType()==OP_BUYSTOP)C=Lime; for(int cnt=0;cnt<OrdersTotal();cnt++) { if( OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_SELLSTOP||OrderType()==OP_BUYLIMIT) { if(openprice_SS<Bid-Step*pt&&!CheckStopLoss_Takeprofit(ORDER_TYPE_SELL_STOP,OrderStopLoss(),OrderTakeProfit()))bool k=OrderModify(OrderTicket(),Bid-Step*pt,NormalizeDouble(openprice_SS+StopLoss*pt,Digits),OrderTakeProfit(),0,Red); } if(OrderType()==OP_BUYSTOP||OrderType()==OP_SELLLIMIT){ if(openprice_BS>Ask+Step*pt&&!CheckStopLoss_Takeprofit(ORDER_TYPE_BUY_STOP,OrderStopLoss(),OrderTakeProfit()))bool h=OrderModify(OrderTicket(),Ask+Step*pt,NormalizeDouble(openprice_BS-StopLoss*pt,Digits),OrderTakeProfit(),0,Lime); } } } }
The problem is with this code and I don't know how to fix it
If you can help put the correct code here and thank you for the help
The problem is with this code and I don't know how to fix it
If you can help put the correct code here and thank you for the help
error 130 is related to improper entry sl tp.
1. you try to create sell stop order below current bid price.
2. you try to create sell limit order above current bid price.
3. you try to set stop loss above entry level in buy order.
.
.
.
and all these should be checked before calling OrderModify
error 130 is related to improper entry sl tp.
1. you try to create sell stop order below current bid price.
2. you try to create sell limit order above current bid price.
3. you try to set stop loss above entry level in buy order.
.
.
.
and all these should be checked before calling OrderModify
Can you put the correct code and thanks for the help
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
void ModifyPendingOrderSar() { ⋮ if(OrderType()==OP_SELLSTOP||OrderType()==OP_BUYLIMIT) { if(openprice_SS<Bid-Step*pt&&!CheckStopLoss_Takeprofit(ORDER_TYPE_SELL_STOP,
There is no such thing in MT4 as ORDER_TYPE_SELL_STOP. You already know there is only OP_SELLSTOP.
There is no such thing in MT4 as ORDER_TYPE_SELL_STOP. You already know there is only OP_SELLSTOP.
void ModifyPendingOrderSar() { if(OrderType()==OP_SELLSTOP)C=Red;if(OrderType()==OP_BUYSTOP)C=Lime; for(int cnt=0;cnt<OrdersTotal();cnt++) { if( OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber) { if(OrderType()==OP_SELLSTOP||OrderType()==OP_BUYLIMIT)//NormalizeDouble(openprice_SS+StopLoss*pt,Digits) { if(!CheckStopLoss_Takeprofit(OP_SELLSTOP,NormalizeDouble(openprice_SS+StopLoss*pt,Digits),OrderTakeProfit())&&openprice_SS<Bid-Step*pt&&OrderModifyCheck(OrderTicket(),Bid-Step*pt,NormalizeDouble(openprice_SS+StopLoss*pt,Digits),OrderTakeProfit()))bool k=OrderModify(OrderTicket(),Bid-Step*pt,NormalizeDouble(openprice_SS+StopLoss*pt,Digits),OrderTakeProfit(),0,Red); } if(OrderType()==OP_BUYSTOP||OrderType()==OP_SELLLIMIT){//NormalizeDouble(openprice_BS-StopLoss*pt,Digits) if(!CheckStopLoss_Takeprofit(OP_BUYSTOP,NormalizeDouble(openprice_BS-StopLoss*pt,Digits),OrderTakeProfit())&&openprice_BS>Ask+Step*pt&&OrderModifyCheck(OrderTicket(),Ask+Step*pt,NormalizeDouble(openprice_BS-StopLoss*pt,Digits),OrderTakeProfit()))bool h=OrderModify(OrderTicket(),Ask+Step*pt,NormalizeDouble(openprice_BS-StopLoss*pt,Digits),OrderTakeProfit(),0,Lime); } } } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Thank you for your help