Please,whats the code that makes a trade close if it has made 1pip profit if any.Thanks
- I'm getting a 80-85% winning trades a month!
- Identify remaining order of an OrderCloseBy request
- 100 pips
Heres a function to close and order if its closing price is above the opening price (as an exercise spot the error!)
void CloseOrder(int ticket) { int Slipage=0 ; if ( OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES) ) { if ( OrderType() == OP_BUY ) { if (Bid > OrderOpenPrice() ) OrderClose(OrderTicket(),OrderLots(),Bid,Slipage,Violet); } if ( OrderType() == OP_SELL ) { if (Ask > OrderOpenPrice() ) OrderClose(OrderTicket(),OrderLots(),Ask,Slipage,Violet); } } }
I tried inputing it in the attached ea but it doesn't work.I also tried making the OrderClose function invalid if takeprofit had a value >0 and also make OrderClose function valid if takeprofit had a value less than
Files:
gbpjpyseauscalper.mq4
19 kb
I said there was an error and asked you to spot it!
if ( OrderType() == OP_SELL ) { if (Ask > OrderOpenPrice() ) OrderClose(OrderTicket(),OrderLots(),Ask,Slipage,Violet); }
should be
if ( OrderType() == OP_SELL ) { if (Ask < OrderOpenPrice() ) OrderClose(OrderTicket(),OrderLots(),Ask,Slipage,Violet); }
Ickyrus:
I said there was an error and asked you to spot it!
should be
Nice.
It make us thinking about just ask "free" code without at least made some work.
=)
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