Post subject: Strategy Constructors called multiple times?
Post rating: 0
Posted: Mon 06 Aug, 2012, 22:51
User rating: 98
Joined: Mon 23 Jul, 2012, 02:02 Posts: 656 Location: United States, Durham, NC
Hi,
I had done some critical initialization within the top level constructor implementing IStrategy.
I noticed that the constructor seemed to be called by JForex twice or even 3 times sometimes. I put in a static counter to verify this. Is this a bug or is this by design? JForex API ver. 2.6.71
Normally one would expect a constructor to be called only once, but this may be by design.
Workaround: So I moved all of my initialization to the onStart event, and this is called only once on strategy startup.
Just wondered whether this was a well-known behavior to watch out for?
Thanks! HyperScalper
API Support
Post subject: Re: Strategy Constructors called multiple times?