Hello , i have problem with coding , when i attach EA on other currency , the EA not running , but when i closed previous currency , the lates currency will run by EA. How it could be? What must i put on my EA?
- Receive by SMS the trading signals of my subscription to an MT4 trader ?
- EA problems
- VPS Help
Unfortunately nobody knows without seeing the code.
extern double Lots = 0.01; extern int Slippage = 3; extern double TP = 0.00200; extern int MagicNumber=11111; string text = "Forex Mudah"; int init() { return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } int start() { if(OrdersTotal() == 1){ is_order_open() ; } int ticket = 0; for (int i=OrdersTotal(); i < 1; i++) //Ñþäà ìû âòûêàå èíäèêàòîðà { //if((OrderType() == OP_SELL||OrderType() == OP_BUY) && OrderSymbol () ==Symbol()) //ticket++; ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Ask - 0.00200,text,MagicNumber,0,Green); ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Bid + 0.00200,text,MagicNumber,0,Green); } //if(ticket>0){ //if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)){}; //} return(0); } bool is_order_open(){ int OrderCnt,total=OrdersTotal(); if(total == 2){ //sell and buy both are open, wait until 1 is close return; } for(OrderCnt=0;OrderCnt<total;OrderCnt++) { OrderSelect(OrderCnt,SELECT_BY_POS,MODE_TRADES); if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber && OrderType() == OP_BUY) { //sell order close, and buy order is still open OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Ask - 0.00200,text,MagicNumber,0,Green); } if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber && OrderType() == OP_SELL) { //buy order close, and sell order is still open OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Bid + 0.00200,text,MagicNumber,0,Green); } } return false; }
sorry , this is my code
otai97: when i attach EA on other currency ,
if(OrdersTotal() == 1){ | Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum |
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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