Jump to content

how to determine, in an expert advisor, if the closeby function is supported


klod

Recommended Posts

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.

Link to comment
Share on other sites

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 by klod
Link to comment
Share on other sites

  • 3 weeks later...
Guest FloridaTrader
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.

Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...