EA overwhelming broker's server?

afeudale
Trader
Posts: 59
Joined: Mon Aug 08, 2016 1:23 pm

EA overwhelming broker's server?

Post by afeudale »

Got this message from my broker today:

"Our IT department is indicating that we are receiving an excessive number of messages to the server. The high number of messages are resulting in a degradation of the service provided to other clients.
If you could please adjust the parameters of the Expert Advisor in order to reduce the messages that will be greatly appreciated."

My newest EA is quite short - only 200 lines of code. But I'm wondering how to figure out what is causing the excessive messages...the journal doesn't show me much happening...

Obviously calls like OrderSend or OrderClose will send messages to the server, but how about something like IsTradeAllowed()?

I also added in the Baluda/SteveH libcss.mqh to my code yesterday, but not sure if that makes server calls or processes everything internally.

Thanks!
User avatar
Jemook
Trader
Posts: 1075
Joined: Thu May 10, 2012 10:19 am
Location: Bondi, Sydney, Australia

EA overwhelming broker's server?

Post by Jemook »

It's probably modifying trades every tick / second. We automatically ban any IP on demo server that sends more than 20,000 messages a day. Live we have a chat first. Usually it's a rogue EA or script that needs modifying.

Regards
Jeremy
Please note I am no longer affiliated with Global Prime. I've moved on to my next adventure with Afterprime.

Catch me here: https://www.afterprime.com
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

EA overwhelming broker's server?

Post by SteveHopwood »

It is really easy to muck up code so that a call is endlessly repeated within a loop.

Finding the culprit can be a bugger. Guess how I know. Thomas knows even more about this. :arrrg:

Hehe. I attracted Jem's ire a few months ago. GP's servers were bombarded by about a gazillion calls to do something or other that had already been done and umpteen clients had their IP's frozen. Including me.

Jem's, "You couldn't sort this out could you, mate?" equated to one of my full page rants. :lol: A loose translations would have been, "Ok matey. We both know you cannot code your way out of a wet paper bag, but that is no excuse for inflicting the results of your inadequacy on us at Global Prime. We really would quite like our servers to be able to run from time to time without being subject to overwhelming bombardment from your latest bit of failed coding. Get a grip, feller." :oops:

If in doubt, post your code here and ask the guru's to take a look. There is no guarantee that they will spot the problem - note the trouble Thomas had working the gremlins out of my Dottybot code - but no harm in asking. Dimwit that I am, even I can occasionally spot something basic.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
afeudale
Trader
Posts: 59
Joined: Mon Aug 08, 2016 1:23 pm

EA overwhelming broker's server?

Post by afeudale »

Jemook » Tue Dec 06, 2016 6:35 pm wrote:It's probably modifying trades every tick / second. We automatically ban any IP on demo server that sends more than 20,000 messages a day. Live we have a chat first. Usually it's a rogue EA or script that needs modifying.

Regards
Jeremy
Thanks for the reply Jeremy!

That's what they were trying to suggest to - that modifying something on every tick could be causing it, but my code does nothing of that sort. It only sends or deletes trades under very specific conditions, no trade modify commands at all.

It's also on live account, not demo.

Do you know what mql commands send server messages? Is it only the open, close, modify? Or other commands too?

Oh well, wish me luck and thanks for the feedback :)
afeudale
Trader
Posts: 59
Joined: Mon Aug 08, 2016 1:23 pm

EA overwhelming broker's server?

Post by afeudale »

SteveHopwood » Tue Dec 06, 2016 7:34 pm wrote:It is really easy to muck up code so that a call is endlessly repeated within a loop.

Finding the culprit can be a bugger. Guess how I know. Thomas knows even more about this. :arrrg:

Hehe. I attracted Jem's ire a few months ago. GP's servers were bombarded by about a gazillion calls to do something or other that had already been done and umpteen clients had their IP's frozen. Including me.

Jem's, "You couldn't sort this out could you, mate?" equated to one of my full page rants. :lol: A loose translations would have been, "Ok matey. We both know you cannot code your way out of a wet paper bag, but that is no excuse for inflicting the results of your inadequacy on us at Global Prime. We really would quite like our servers to be able to run from time to time without being subject to overwhelming bombardment from your latest bit of failed coding. Get a grip, feller." :oops:

If in doubt, post your code here and ask the guru's to take a look. There is no guarantee that they will spot the problem - note the trouble Thomas had working the gremlins out of my Dottybot code - but no harm in asking. Dimwit that I am, even I can occasionally spot something basic.

:xm:
Thanks Steve! Haha, I guess we all have to crash our broker's server at some point! Must be a rite of passage...

I'll see how it goes the next few days and if I get another call/email, I'll post up the code (although I'm embarrassed by it's messiness...lol)

As mentioned above, do you know where I can find a comprehensive list of MQL4 functions that would send server messages? i.e. is it only the ordersend, close, modify? Or other functions make server calls too?

:)
User avatar
tomele
Administrator
Posts: 1166
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

EA overwhelming broker's server?

Post by tomele »

afeudale » 07 Dec 2016, 15:13 wrote:As mentioned above, do you know where I can find a comprehensive list of MQL4 functions that would send server messages? i.e. is it only the ordersend, close, modify? Or other functions make server calls too? :)
Hi.

I am sure about these function interacting with the server:

OrderClose()
OrderCloseBy()
OrderDelete()
OrderModify()
OrderSelect()
OrderSend()

IsConnected()
IsTradeAllowed() ***added by afeudale
IsTradeContextBusy()
TimeCurrent()

I am sure about the account queries that need realtime data (like AccountBalance()), but not sure about those that fetch static data (like AccountCompany()):

AccountBalance()
AccountCompany()
AccountCredit()
AccountCurrency()
AccountEquity()
AccountFreeMargin()
AccountFreeMarginCheck()
AccountFreeMarginMode()
AccountInfoDouble()
AccountInfoInteger()
AccountInfoString()
AccountLeverage()
AccountMargin()
AccountName()
AccountNumber()
AccountProfit()
AccountServer()
AccountStopoutLevel()
AccountStopoutMode()

Which of those server interactions are really considered as load must be answered by your broker or Crapperquotes. Every addition or comment to this list is highly appreciated.
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
afeudale
Trader
Posts: 59
Joined: Mon Aug 08, 2016 1:23 pm

EA overwhelming broker's server?

Post by afeudale »

Hi Tomele!

Thank you! I believe you confirmed what I suspected (and one more to add to your list):

IsTradeAllowed()

This is a function that I added to my OnTick() function and was therefor running every tick and querying the server. I believe that IsTradeAllowed() also incorporates an IsTradeContextBusy() (which was in your list) - and thus, the server message.

I now moved it to my OnTimer() function instead.

The reason I had it there is because I lost a bunch of trades only to realize that AutoTrading was disabled, so my EA didn't exit when it was suppose to. So I added a check for IsTradeAllowed().

I wonder, is there a non-server way to check if "AutoTrading" is enabled in Empty4?

Also, are you sure about OrderSelect()? I thought this would not require server interaction and just reads from current data in Empty4...

Thanks again :clap:
User avatar
tomele
Administrator
Posts: 1166
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

EA overwhelming broker's server?

Post by tomele »

afeudale » 07 Dec 2016, 17:12 wrote: I wonder, is there a non-server way to check if "AutoTrading" is enabled in Empty4?

Also, are you sure about OrderSelect()? I thought this would not require server interaction and just reads from current data in Empty4...
1. TerminalInfoInteger(TERMINAL_TRADE_ALLOWED)

2. Absolutely sure. OrderSelect() copies the actual data of the order from the server to the terminal.
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
afeudale
Trader
Posts: 59
Joined: Mon Aug 08, 2016 1:23 pm

EA overwhelming broker's server?

Post by afeudale »

Oooohhhh! Nice, thanks for that one! :clap:

That sucks about OrderSelect....I see so many EA's that do something like this:

Code: Select all

for(i=OrdersTotal();i>=0;i--) 
{  
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES); 
      {
           //Check trade status and exit conditions here
      }
}
Mine does this as well to determine exit points to close the trades. How do they get away with it if it's in the OnTick section?

Thanks again!
User avatar
tomele
Administrator
Posts: 1166
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

EA overwhelming broker's server?

Post by tomele »

To be more precise on OrderSelect() - historical orders are resolved locally, only open and pending orders are fetched from the server.

The Dotties are doing OrderSelect() gazillions of times. As I wrote, not every interaction with the server will be considered as load.
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
Post Reply

Return to “Automated trading systems”