klod Posted February 23, 2013 Report 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.
klod Posted February 26, 2013 Author Report 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
Guest FloridaTrader Posted March 14, 2013 Report 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now