ghobar:
Hi
I want the position to close when the position reaches 10 pips
What am I doing wrong?
int start() { Trail2(); return(0); } void Trail2() { bool rest; int total = OrdersTotal(); for(int i=total-1; i>=0; i--) { rest=OrderSelect(i, SELECT_BY_POS); int type = OrderType(); bool result = false; // Buy if( OrderMagicNumber()==Magic7 && (((Bid-OrderOpenPrice())/Point)>10) && OrderType()==OP_BUY ) result = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, CLR_NONE); // Sell if( OrderMagicNumber()==Magic8 && (((OrderOpenPrice()-Ask)/Point)>10) && OrderType()==OP_SELL ) result = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, CLR_NONE); } }
Mehmet Bastem:
Global thanks
The code you wrote works very well
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi
I want the position to close when the position reaches 10 pips
What am I doing wrong?