I had my account temporarily suspended because my bot made too many server attempts. Help on modification.

 

I had my account temporarily suspended because my bot made too many server attempts.

It checks "ontick" to see if the position needs to have the stop loss moved and then sends a modification order if appropriate.

The key here is that "ontick" is too often.  I was doing some reading and discovered that there could be several ticks a second, and so my bot may want to make changes every tick the way I have it programed.

So now I'm going to put my bot on a diet and calm the number of queries. 

Is anyone aware of what should be an appropriate threshold? Most of the calculations of an EA occur locally right? And only the modifyorder gets sent to the server?

What would be an appropriate query level if not ontick?

Thank you for your insight. 

 
Robert Victor Huizar:

I had my account temporarily suspended because my bot made too many server attempts.

It checks "ontick" to see if the position needs to have the stop loss moved and then sends a modification order if appropriate.

The key here is that "ontick" is too often.  I was doing some reading and discovered that there could be several ticks a second, and so my bot may want to make changes every tick the way I have it programed.

So now I'm going to put my bot on a diet and calm the number of queries. 

Is anyone aware of what should be an appropriate threshold? Most of the calculations of an EA occur locally right? And only the modifyorder gets sent to the server?

What would be an appropriate query level if not ontick?

Thank you for your insight. 

The problem is not the OnTick(). The problem is in having too much network traffic to the the trading server to update when updating the stops.

To resolve the issue, use a "trailing step" and/or a "time step", so that the trailing stop-loss is not modified so often.

The "trailing step" helps to only update the stop-loss only once it has been displaced more that the "step" value, and the "time step" helps to only update the stop-loss only after a minimum time has passed.

Both methods can be used in conjunction to reduce network traffic.

 

Here are some related posts ...

Forum on trading, automated trading systems and testing trading strategies

Validation error MT5

Fernando Carreiro, 2023.04.01 17:36

Also, if the log overflow is due to trade order activity then refactor your strategy.

  • If you are constantly deleting and replacing pending orders, then don't. Improve the strategy, preferably by using market orders instead of pending orders if possible.
  • If you are updating stops continuously, the don't. Use a trailing step or a time step or any other method to reduce the update activity.

Forum on trading, automated trading systems and testing trading strategies

What is trailing step? [Solved]

Fernando Carreiro, 2022.07.19 18:19

In basic terms, the trailing step is just the amount of price change that is required before a trailing stop is adjusted.  Normally a trailing sop would adjust continuously every time the maximum favourable excursion increases. With a trailing step, that trailing stop only updates if excursion has been in units of the trailing step amount.

Forum on trading, automated trading systems and testing trading strategies

simple explaination for TRAILING STEP pls (example included)

Fernando Carreiro, 2023.03.14 19:12

The trailing step is the range by which a favourable price needs to advance, before a trailing stop is updated.

So if the trailing stop is 100 pips and the trailing step is 20 pips, then every time the price moves favourably 20 pips from the previous "step" level, then the stop-loss is updated to be 100 pips from the current price "step" level.

Example, assuming no take-profit and only a trailing stop-loss

  • @1.0000, SL: 0.9900
  • @1.0005, SL: 0.9900 (no change)
  • @1.0015, SL: 0.9900 (no change)
  • @1.0020, SL: 0.9920
  • @1.0030, SL: 0.9920 (no change)
  • @1.0040, SL: 0.9940
  • @1.0060, SL: 0.9960
  • @1.0080, SL: 0.9980
  • @1.0100, SL: 1.0000 (break-even)
  • @1.0120, SL: 1.0020
  • etc.
 
Fernando Carreiro #:

The problem is not the OnTick(). The problem is in having too much network traffic to the the trading server to update when updating the stops.

To resolve the issue, use a "trailing step" and/or a "time step", so that the trailing stop-loss is not modified so often.

The "trailing step" helps to only update the stop-loss only once it has been displaced more that the "step" value, and the "time step" helps to only update the stop-loss only after a minimum time has passed.

Both methods can be used in conjunction to reduce network traffic.

Fantastic! Thank you

Reason: