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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    49 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    67 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X