| -
View Format of Time Fields in Strategy Backtester
Hi all,
In Marketscope/Trading Station, you can change the time format between UTC/Local/Server/Financial. Is this possible with Strategy Backtester? I've been having issues with using historical data, which I think is in EST time, so results in trades going on at wrong times as I require UK Local time.
Unfortunately because the clocks go forward/backward at different times in the US and UK I can't just change the time by a flat 5 hours in the parameters, as sometimes the difference is 6. Is there a way I can use: Code: core.host:execute("convertTime"...) to change it?
Thanks,
FishStick
-
Hi FishStick,
1.
In Marketscope/Trading Station, you can change the time format between UTC/Local/Server/Financial. Is this possible with Strategy Backtester?
No, there is no such option in Backtester.
2.
Is there a way I can use:
Code:
core.host:execute("convertTime"...)
to change it?
Yes, you can use this method to convert the date and time from Local to EST. Please use tzFrom:core.TZ_LOCAL and tzTo:core.TZ_EST.
3.
I've been having issues with using historical data, which I think is in EST time, so results in trades going on at wrong times as I require UK Local time.
Please note: strategies always use EST timezone for all functions and calculations regardless of the time displayed in TS\Marketscope. So, if you want to use UK time in your strategy code and as a timezone in TS, core.host:execute("convertTime"...) should be used in order a strategy works properly.
Best regards,
Ekaterina
Last edited by Ekaterina; 06-26-2012 at 11:40 PM.
-
Ekaterina,
Thanks for your help again, always grateful!
Just to clarify, I need to convert from Local to EST? I thought it was the other way round - the EST time used by the strategy needs to be converted into Local?
Also, my strategy doesn't use any time parameters, its just the indicator. Should I convert it in the indicator?
Thanks,
FishStick
-
Hi fishstick,
To avoid unnecessary misunderstanding, please tell me if your strategy works correctly in the Marketscope?
Best regards,
Ekaterina
-
Yeah, it works fine, converting from EST to Local. Which is why I was wondering it had to be the other way around?!
Thanks,
FishStick
-
Yes you are absolutely right. You need to convert from EST to Local of course! It was my misunderstanding of what you are required. Sorry for the confusion!
Just to remind: you cannot change time format in Backtester. It is always EST.
Best regards,
Ekaterina
-
Thanks Ekaterina!
Does that mean that if I run a strategy that enters a position at 0800 GMT, it SHOULD show up as 0300 on Backtester? I'm sure I've had it before where its been 0800 and still correct?
Thanks,
FishStick
-
Hi fishstick,
if you use core.host:execute("convertTime"...) function, it means that a strategy that enters a position at 08:00 GMT, shows up as 03:00 on Backtester.
Please see the simple strategy for an example. The strategy opens position at 8 AM in local time. open_8am_local.lua
Best regards,
Ekaterina
Last edited by Ekaterina; 06-29-2012 at 03:52 AM.
-
Ekaterina,
Realised why it is different. Running the Backtester on a UK Live account results in the correct time of 0800. Running the same strategy on a GBDEMO account results in the EST time of 0300. Both accounts time are set to Server. Is there a reason for this?
Thanks,
FishStick
-
Hi FishStick,
1) Which one strategy are you running: open_8am_local.lua or some own? If the first one, could you please send us screen-shots with the Backtester History Tab results.
2)
Both accounts time are set to Server
The time cannot be set to an account.
Two time formats are displayed in the TS Status bar. The first one determines how time stamp fields are displayed in the TS and Marketscope, and you can choose from: UTC, Server, Local or Financial. And the second one always displays Server time.
Besides, for Backtester it doesn't matter which time is set in the TS, because it always displays results in EST.
Please clarify what have you meant? Where Server time is set?
Best regards,
Ekaterina
-
Ekaterina,
In response to 1), it is my own strategy.
In response to 2), apologies, I meant that there are 2 Trading Stations running, one logged into a UK Live account and the other logged in to a GBDEMO account. Both display times are set to Server. If I run the Backtester from each Trading Station, with different accounts running, this is when the times are different.
Is this enough information? Let me know if you need more.
Thanks,
FishStick
-
Hi FishStick,  Originally Posted by fishstick
Is this enough information? Let me know if you need more.
1. Please try to backtest our open_8am_local.lua strategy from your both Real and Demo accounts. Check whether the results are equal. If not, please report us and send screen-shorts with results. If the results are equal, then point 2.
2. Please send us the code of your strategy by e-mail. That is the only one quick way to solve the problem. If you have some secret formulas or calculations, please change them or delete. But the strategy must work in order we can reproduce the issue.
Best regards,
Ekaterina
-
Ok, this was using open_8am_local on Backtester. Settings were:
Account Currency - USD
Initial Balance - 10000
Account Lot Size - Micro Account
Maintenance Type: Non Fifo Account with Hedging
From: 02/07/2012
To: 06/07/2012
Pair: EUR/USD
Account: TESTACCT
MMR: EUR/USD 5.00
Below is the screen shot of the Live account: Live
And below is the screen shot of the Demo account: Demo
Look at the first times that are shown for the first History entry. Demo has 05:00 and Live has 00:00. So, it isn't just my code ;-)
Thanks,
FishStick
-
Hi FishStick!
I do apologize in advance for the long post, but it is necessary to find out that we understand each other.
Ok, let's try to find out the problem! 1.First of all I want to refresh the situation.
We have developed the strategy that opens long positions at 08:00 in Local time. Just a simple example to explain you how it works. 2. How the results will be displayed in TS/Marketscope and Backtester?
As you can see from the strategy code: Code: local localDatetime = core.host:execute("convertTime", core.TZ_EST, core.TZ_LOCAL, estDatetime); We used the time converter from Local to EST. Why? Because your local time is different from the EST (the one which is set on the computer) and you want to see the strategy results at 08:00 in UK time. That is what we suppose you are required.
If you run this strategy in TS/Marketscope, you will see that it opens positions at 08:00 GMT (if it is a local time of course).
If you run this strategy in Backtester, you will see that it shows results of open positions at 03:00. Why? Because Backtester always displays results in EST time. But results are correct because 03:00 EST = 08:00 GMT (in Summer time).
3.  Originally Posted by fishstick Look at the first times that are shown for the first History entry. Demo has 05:00 and Live has 00:00. So, it isn't just my code ;-)
FishStick - We have studied your screen-shots and your Backtester results on the live account are correct.
By default Backtester shows all actions of the Strategy. To see the ticks with necessary actions (in our case "Open long position" action) please click the button with funnel and you will see that the strategy has opened all positions at 03:00. It can also be checked on the Graph with the Buy\Sell arrow. See the pictures below.
Your Live account results: 
The History tab is sorted:  - As for the Demo account results, we see that all positions have been opened at 08:00, which can mean that the local time on the computer is set to EST.
Thereby we have a question. Do you run your second TS with Demo account on the other computer? If so, please check whether your computer time is set to GMT?
Best regards,
Ekaterina
Last edited by Ekaterina; 07-12-2012 at 03:33 AM.
-
Demo account is run on the same computer as the backtest on the live account, in a different TradingStation. Computer is set to local time, which is BST (GMT+1). Probably doesn't help you much with finding a solution!
Thanks,
FishStick
|