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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        47 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        15 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        21 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X