Trade FOREX with FXCM

  • Award-Winning Platform
  • 24/7 Customer Support
  • Trade Directly on Charts
  • Free $50K Practice Account
Register


Results 1 to 15 of 17
Page 1 of 2 1 2 LastLast

Thread: View Format of Time Fields in Strategy Backtester

  1. #1
    fishstick is offline Member
    Join Date
    Oct 2011
    Posts
    54

    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

  2. #2
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    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.

  3. #3
    fishstick is offline Member
    Join Date
    Oct 2011
    Posts
    54
    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

  4. #4
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    Hi fishstick,

    To avoid unnecessary misunderstanding, please tell me if your strategy works correctly in the Marketscope?

    Best regards,
    Ekaterina

  5. #5
    fishstick is offline Member
    Join Date
    Oct 2011
    Posts
    54
    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

  6. #6
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    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

  7. #7
    fishstick is offline Member
    Join Date
    Oct 2011
    Posts
    54
    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

  8. #8
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    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.

  9. #9
    fishstick is offline Member
    Join Date
    Oct 2011
    Posts
    54
    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

  10. #10
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    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.

    Name:  Untitled.png
Views: 143
Size:  50.3 KB

    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

  11. #11
    fishstick is offline Member
    Join Date
    Oct 2011
    Posts
    54
    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

  12. #12
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    Hi FishStick,

    Quote Originally Posted by fishstick View Post

    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

  13. #13
    fishstick is offline Member
    Join Date
    Oct 2011
    Posts
    54
    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

  14. #14
    Ekaterina is offline Member
    Join Date
    Nov 2011
    Posts
    364
    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.

    Quote Originally Posted by fishstick View Post
    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:

    Name:  Real.png
Views: 92
Size:  214.8 KB

    The History tab is sorted:

    Name:  Untitled.png
Views: 95
Size:  151.2 KB

    • 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.

  15. #15
    fishstick is offline Member
    Join Date
    Oct 2011
    Posts
    54
    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

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.