Single EA to manage trailing stop on all open orders on all symbols

 

Hi All

I am thinking about how to write an EA to manage trailing stops for all open orders. It will be attached to a single chart but will manage orders for every symbol.

It does not make sense to run the code from OnTick() because it will only execute when the attached chart has a new tick and may miss the new ticks for other symbols.

The only solution I can think of is to write the logic into a loop in the OnInit() function

I have two questions:

  1. Can I run all my code from OnInit()? Is this even feasible??
  2. What problems might I encounter?

Hoping you guys can help me figure out if this is doable or if there is a better way. My googling skills are not up to the task apparently..!

Many Thanks

David

 
OnTimer()
 
Keith Watford:
OnTimer()

Ah! That's great, thanks

Reason: