hello
I had developed an EA for some customers. then, some of them claimed that when this EA is running on one chart(say EURUSD), it has long lags for executing commands on another symbol (say GBPJPY). they are correct becasue tick intervals of the two symbols is different.
So, I decided toi put every thing in a loop wiith sleepin interval of 5 seconds, then regardless of tick, command is executed on 5sec intervals. There is no problem now, but I want to check if connection with server is ok when trading command is executed.
I'm doing like this now:
int start()
{
while (true)
{
AccountFreeMarginCheck( "EURUSD", OP_BUY, 0.01);
int i=GetLastError();
while(i==134)
{
Sleep(10000);
AccountFreeMarginCheck("EURUSD", OP_BUY, 0.01);
i=GetLastError();
}
Do();
Sleep(2500);
}
return(0);
}
but I'm not sure is this the correct way? for example some brokers don't accept 0.01 lot. could you please advice?
Regards
You can use the function MarketInfo() with MODE_MINLOT to retrieve the information of min lots of your brokers.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hello
I had developed an EA for some customers. then, some of them claimed that when this EA is running on one chart(say EURUSD), it has long lags for executing commands on another symbol (say GBPJPY). they are correct becasue tick intervals of the two symbols is different.
So, I decided toi put every thing in a loop wiith sleepin interval of 5 seconds, then regardless of tick, command is executed on 5sec intervals. There is no problem now, but I want to check if connection with server is ok when trading command is executed.
I'm doing like this now:
int start()
{
while (true)
{
AccountFreeMarginCheck( "EURUSD", OP_BUY, 0.01);
int i=GetLastError();
while(i==134)
{
Sleep(10000);
AccountFreeMarginCheck("EURUSD", OP_BUY, 0.01);
i=GetLastError();
}
Do();
Sleep(2500);
}
return(0);
}
but I'm not sure is this the correct way? for example some brokers don't accept 0.01 lot. could you please advice?
Regards