Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

have a strategy find if it is running in the tester
 Post subject: have a strategy find if it is running in the tester Post rating: 0   New post Posted: Mon 06 Sep, 2010, 17:38 

User rating: 0
Joined: Tue 10 Nov, 2009, 16:58
Posts: 65
Hi,

there are some cases where I would like my strategy to know if it is running in the tester or for real. For example, in the tester, the strategy might want to use data from a database, indexed by date, and for, say the last month.

When running for real, we can use a Calendar object (it initializes to the current time and date), substract one month and use that.

However, the same will not work in the tester since the strategy really would like to know what the current time is _in the tester context_

One workaround I found is to use the timestamp of the current tick received, that is a good approximation of real and "tester" current time. However, to differentiate the tester/non-tester cases, to use more accurate means, and also to allow the same code to run without difference in the tester or for real, it would be useful to be able to interrogate the context or something else to find out.


 
 Post subject: Re: have a strategy find if it is running in the tester Post rating: 0   New post Posted: Mon 06 Sep, 2010, 22:26 
User avatar

User rating: 3
Joined: Wed 18 May, 2011, 16:25
Posts: 331
Location: SwitzerlandSwitzerland
Hi brainstorm,

you can determine the tpye of the run by using IEngine.getType()

Best, RR.


 

Jump to:  

cron
  © 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