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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    110 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    156 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    74 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    79 views
    0 likes
    Last Post PaulMohn  
    Working...
    X