- let old EA work on Build 600+ on MT4
- return value should be checked?
- Counting open positions within mt4 teminal
Request to solve warning error in the code please provide a solution of the error !!
You don't check if OrderSelect is successful, or not.
Replace:
OrderSelect(ticket, SELECT_BY_TICKET);
by:
if ( OrderSelect(OrderPosition, SELECT_BY_TICKET)){continue;}
or by:
if ( ! OrderSelect(OrderPosition, SELECT_BY_TICKET)){return;}
Hi debar
I use software which use block diagrams to make EA !! It works fine with MT4 previous build but now I want to compile an EA for MT4 build 600+ n it doesn't recognise those errors so i have to edit in code,as I am not a programmer so even if its a minor error I am unable to solve,that must be fine.
Now please help with another error evolved after replacing with as you guided the error says
"empty controlled statement found"
{ if(OrderSelect(ticket, SELECT_BY_TICKET)); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); }
{ if(OrderSelect(ticket, SELECT_BY_TICKET)); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); }
There is no code between the if( ) and the ;
That is the empty statement, remove the ; and you should be ok.
Hi,Gumrai
Thank you very much !! error is resolved now;
Suggest any guide for updating code(ea) from MT4 previous builds to MT4 600+
Thanks once again!!!!!!!!!!!!!Cheers!!!
hi every one.i got this error on this code,and it is not going away.when running the expert it orders continiously and only buy.please help me.
extern double Lots=0.01; int totals[]; void OnTick() { if (totals[OP_BUY]==0) {OrderSend (_Symbol,OP_BUY,Lots,Ask,3,NULL,0,0,Green); if (totals[OP_SELL]==0) {OrderSend (_Symbol,OP_SELL,Lots,Ask,3,NULL,0,0,Red); } } }
- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor - So do it. Check your return codes for errors, and report them including GLE/LE,
your variable values, and the market. That way we would know that at least you are calling your code.
Don't look at GLE/LE unless you have an error. Don't just silence the compiler, it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles - You buy at the Ask and sell at the Bid.
- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
- Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To
trigger at a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
bool OrderSelect( int index, int select, int pool=MODE_TRADES );
bool OrdSelCh; //variable for write true or false
OrdSelCh=OrderSelect(index,select,MODE...)
int OrderSend( string symbol, // symbol int cmd, // operation double volume, // volume double price, // price int slippage, // slippage double stoploss, // stop loss double takeprofit, // take profit string comment=NULL, // comment int magic=0, // magic number datetime expiration=0, // pending order expiration color arrow_color=clrNONE // color );
How does your order in any way relate to the documentation? Where is the SL and TP?
OrderSend (_Symbol,OP_BUY,Lots,Ask,3,NULL,0,0,Green);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use