- Please help!!!!Close current position when having a new signal
- [ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4.
- [Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2.
How To Ask Questions The Smart Way. 2004
Prune pointless queries.
You have only four choices:
-
Search for it. Do you expect us to do your research for you?
- Beg at:
- Coding help - MQL4 programming forum
- Make It No Repaint Please! - MQL4 programming forum
- MT4 to MT5 code converter - MQL5 programming forum
- Please fix this indicator or EA - General - MQL5 programming forum
- Requests & Ideas (MQL5 only!) - Expert Advisors and Automated Trading - MQL5 programming forum
-
MT4: Learn to code it.
MT5: Begin learning to code it.If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
-
or pay (Freelance) someone to code it. Top of every page is the link Code Base.
Hiring to write script - General - MQL5 programming forum 2019.08.21
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
No free help 2017.04.21
After some coding :
#property copyright "" #property link "" extern double LevelExposure1 = 12400; extern double LevelExposure2 = 12400; extern double Lots = 1.0; extern int Slippage = 2000; int ID=234; int init() { return(0); } int deinit() { return(0); } int getCurrentOrderType() { int semua=OrdersTotal(); for(int a=semua-1;semua>=0;a--) { if(OrderSelect(a,SELECT_BY_POS)) { if(OrderSymbol()!=Symbol()) continue; if(OrderType()>1) continue; return OrderType(); break; } } return; } void OnTick() { int tiketnya; int tipe; tipe = getCurrentOrderType(); // currently one selling trade, but now price > target => close + open a buy if(tipe==OP_SELL && Ask>=LevelExposure1) { Print("sell ouvert, a fermer"); if(close_positions(OP_SELL)==true) { tiketnya=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"TheGuardian",ID,0,DeepSkyBlue); } } // currently one buying trade, but now price < target 2 => close + open a sell if(tipe==OP_BUY && Bid<=LevelExposure2) { if(close_positions(OP_BUY)==true) { tiketnya=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"TheGuardian",ID,0,Red); } } return(0); } int close_positions(int t) { int hasil=false; int semua=OrdersTotal(); for(int a=semua-1;semua>=0;a--) { if(OrderSelect(a,SELECT_BY_POS)) { if(OrderSymbol()!=Symbol()) continue; if(OrderType()==t&&OrderType()==OP_SELL) { hasil=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,CLR_NONE); } if(OrderType()==t&&OrderType()==OP_BUY) { hasil=OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,CLR_NONE); } break; } } return(hasil); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use