Dukascopy
 
 
Wiki JStore Search Login

Strategy Constructors called multiple times?
 Post subject: Strategy Constructors called multiple times? Post rating: 0   New post Posted: Mon 06 Aug, 2012, 22:51 
User avatar

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


 
 Post subject: Re: Strategy Constructors called multiple times? Post rating: 0   New post Posted: Tue 07 Aug, 2012, 10:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
hyperscalper wrote:
Just wondered whether this was a well-known behavior to watch out for?
It is a platform feature.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com