Backtesting on 2 minutes – how to get more data?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #91502 quote
    David Hall
    Participant
    New

    Hello I am trying to backtest a 2 min strategy how can I get data from further back in time than the period shown on the screen,

     

    Thanks

     

    Dave Hall

    #91504 quote
    robertogozzi
    Moderator
    Master

    Please update your country flag. Thank you.You can change dates as from attached pic.

    x-8.jpg x-8.jpg
    #91507 quote
    Vonasi
    Moderator
    Master

    If you want to go back beyond the 100k or 200k bars (the amount depends on your PRT platform type) then you can’t. You get the most recent 100k or 200k bars whether that is 100k times 2 minute candles or 100k times 1 day candles.

    #91508 quote
    David Hall
    Participant
    New

    Thanks the trouble is using a 2min time frame it only lets me go back to 10th Jan even with 10,000 bars selected

    #91509 quote
    David Hall
    Participant
    New

    Thanks that ‘s a bit of a shame as with 2min strategy I can’t get much meaningful data, I can get back as far as August 1 2018 but thats it

    #91514 quote
    Vonasi
    Moderator
    Master

    Unfortunately this is one of the disadvantages of back testing on faster time frames – the history available is very limited. All you can really do is create a strategy based on the data available and then forward test it by running it live in demo. Not ideal and a very slow way of testing but it is the only way unfortunately. The good news is that if it is curve fitted to the data sample you used then on a fast time frame it shouldn’t be too long before forward testing confirms this especially if it opens a lot of trades. You may have to include emergency get out of the market conditions in case of black swan moments that your back test was never developed on but that it might have to trade through one day in the future.

    Note: I changed your topic title to something a little more meaningful.

    David Hall thanked this post
    #91515 quote
    David Hall
    Participant
    New

    Sorry one last question if  I want to set trading hours ie between 19:00 – 21:00 uk time is this possible to add to my code?

    #91516 quote
    Vonasi
    Moderator
    Master

    Yes you can use the following:

    Defparam FlatBefore = 190000
    Defparam FlatAfter = 210000

    These will not allow trading before 190000 and close all trades at 210000 and not allow any trades after that time.

    Alternatively you can just set a condition to allow or disallow trading:

    Timeok = time >= 190000 and time < 210000
    
    if Timeok and (your conditions) then
    buy 1 contract at market
    endif

    Most answers to coding questions and examples can be found here:

    https://www.prorealcode.com/prorealtime-documentation/

    #91519 quote
    David Hall
    Participant
    New

    That,s great thanks very much

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Backtesting on 2 minutes – how to get more data?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
David Hall @david_hall Participant
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by David Hall
7 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/16/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...