- Hedging
- How:Order Modify Take Profit.
- How to modify stop loss and take profit when market is closed
Right click on the line. |
Right click on the line. |
Thanks for your reply. I just need a code to modify previous order of similar symbol in ea.
I try this code too.
for(int i = 0 ; i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol() == Symbol() && OrderMagicNumber() == magicNumber)
{
tempcount++;
if(tempcount == count)
{
if(OrderType() == OP_BUY)
{
modify = OrderModify(OrderTicket(),OrderOpenPrice(),0,0,0,clrRed);
placeorder();
break;
}
}
}
}
}
This code works. But it modify the previously opened order not similar symbol which it currently placed.
-
Play videoPlease edit your post.
For large amounts of code, attach it.
- In the presence of multiple orders (one EA multiple charts, multiple EAs, manual
trading)
- You must count down when closing/deleting/modifying in a position loop. Get in the habit of always counting down. Loops and Closing or Deleting Orders - MQL4 forum
- and check OrderSelect. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- You must RefreshRates after sleep and between multiple server calls if you want to use the Predefined Variables (Bid/Ask) or OrderClosePrice() instead.
- Drop your counting code. Either you want all open orders to have a SL or you don't. If you don't, then change orders that do.
- What you wrote above is unintelligible.
Thanks for your reply. I just need a code to modify previous order of similar symbol in ea.
I try this code too.
for(int i = 0 ; i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol() == Symbol() && OrderMagicNumber() == magicNumber)
{
tempcount++;
if(tempcount == count)
{
if(OrderType() == OP_BUY)
{
modify = OrderModify(OrderTicket(),OrderOpenPrice(),0,0,0,clrRed);
placeorder();
break;
}
}
}
}
}
This code works. But it modify the previously opened order not similar symbol which it currently placed.
-
Please edit your post.
For large amounts of code, attach it.
- In the presence of multiple orders (one EA multiple charts, multiple EAs, manual
trading)
- You must count down when closing/deleting/modifying in a position loop. Get in the habit of always counting down. Loops and Closing or Deleting Orders - MQL4 forum
- and check OrderSelect. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- You must RefreshRates after sleep and between multiple server calls if you want to use the Predefined Variables (Bid/Ask) or OrderClosePrice() instead.
- Drop your counting code. Either you want all open orders to have a SL or you don't. If you don't, then change orders that do.
- What you wrote above is unintelligible.
Ganesh Kumar:
If you can't understand means, my question is not unintelligable. Thanks for your reply.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use