klod Posted February 23, 2013 Report Share Posted February 23, 2013 How to determine in an expert advisor if the closeby function is supported by the broker ? I have made a routine to close all the trades and the closeby function is called when SELLs and BUYs orders are opened. But the closeby function is broker dependant: FXCM doesn't support closeby but Activtrades, Yes... The method to determine if closeby is supported is to see the "new order" dialog box in the terminal I search an automatic method. Thanks you. Quote Link to comment Share on other sites More sharing options...
klod Posted February 26, 2013 Author Report Share Posted February 26, 2013 (edited) If OrderCloseBy is not allowed on the server, GetLastError() returns 3. so a possible code is: bool supporte_closeby; int init() { supporte_closeby=true; ... return(0); } int essai_maximum=4; int start() { ... int essai=0,err; kb=... // ticket BUY to close ks=... // ticket SELL to close lb=... // OrderLot() BUY ls=... // OrderLot() SELL // Info() is the information box routine. It returns always true; if(supporte_closeby) { while(Info()!=OrderCloseBy(kb,ks, Green) && essai<=essais_maximum) {err=GetLastError(); if(err==4108) break; if(err==3) {supporte_closeby=false; break;} else {Sleep(10); essai++;}} } else { while (Info()!= OrderClose(ks, ls, NormalizeDouble(Ask,Digits), slippage, Green) && essai<=essais_maximum) {if(GetLastError()==4108) break; else {Sleep(10); essai++;}} while (Info()!= OrderClose(kb, lb, NormalizeDouble(Bid,Digits), slippage, Green) && essai<=essais_maximum) {if(GetLastError()==4108) break; else {Sleep(10); essai++;}} } ... return(0); } Edited February 26, 2013 by klod Quote Link to comment Share on other sites More sharing options...
Guest FloridaTrader Posted March 14, 2013 Report Share Posted March 14, 2013 The days of Customizing EA as per our need has come true and this all thing is made possible by XStation3(web based) trading platform & best thing is its for free. I personally recommend it. Yes, you personally recommend it because your scamming us. Within a few hours, you joined under five (5) different usernames and are flooding our forum with junk spam. Darja Ivanov = Julia Nowak = Giles Gill = Florence Hollis = Anthony Price. ALL THE SAME PERSON PROMOTING SPAM HERE. All four (4) joined within hours of each other. Sorry ladies, this forum does have people smarter and brighter than you. This tells me that you are a con artist since you can't promote properly and are deceiving the forum. Quote Link to comment Share on other sites More sharing options...
klod Posted June 25, 2013 Author Report Share Posted June 25, 2013 I don't understood the previous post Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.