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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        67 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        36 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        60 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        62 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        53 views
        0 likes
        Last Post CarlTrading  
        Working...
        X