Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy determine if backtesting or live

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

    strategy determine if backtesting or live

    Is there a way to distinguish is a strategy is being used live vs trading in the strategy analyzer?

    In other words, I wanted to make sure that the user has performed some key training modules prior to going "live" - how could I tell if a user was attaching my strategy to a live chart?

    thanks,
    TODDL

    #2
    Hello TODDLINDSTROM,


    You could use the Historical property to check if your script is running on historical data. With a strategy, when running a backtest, this property will always return true. When running a live strategy, this property will be true until the strategy starts processing real-time data.


    Here is an example that will only the script to run on real-time data.
    Code:
    protected override void OnBarUpdate()
    {
        // Only run on real-time data
        if (Historical)
             return;
    }
    Here is the Historical Help Guide to assist you further.
    Shawn B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by timko, Today, 06:45 AM
    2 responses
    11 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by habeebft, Today, 07:27 AM
    0 responses
    4 views
    0 likes
    Last Post habeebft  
    Started by Tim-c, Today, 03:54 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by rocketman7, Today, 01:00 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by wzgy0920, 04-23-2024, 09:53 PM
    3 responses
    76 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X