Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indexes in live i backtest

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Indexes in live i backtest

    Hi,

    I'm interested in problem of last price in live and backtest when CalculateOnBarClose=false.

    If I test strategy in strategy analyzer and call eg Close[0] - it return price of last closed bar - not current one (open but not closed yet) - in live trading it return last price ?

    How should I write index of price in order to correctly check condition on closed bar in backtest and in live trade also ? if I use Close[1] in backtest it return price of 2 bars ago, when in live one bar ago ?

    Please help me understand this problem.

    Andrew
    Last edited by Andrew_e; 10-20-2011, 05:35 AM.

    #2
    Hi Andrew, correct that would be expected for working on CalculateOnBarClose = false - this would not be available in backtesting, here this property is set to 'true' by default since in backtesting only the OHLCV data of the data series you're running on is known.

    Comment


      #3
      Thanks for answer.
      Is there any function I can use in strategy to check if this is test or live ?

      Comment


        #4
        Yes, you could distinguish real time vs historical bars with the Historical property :

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        656 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        371 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        579 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X