Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter positions only after script has been started

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

    Enter positions only after script has been started

    How can a script be coded to avoid having positions entered when script is started on a chart and chart contains past data which would have met entry (and exit) criteria already in the past? In other words, the first entry should only be possible at or after the script was launched.

    #2
    Hello BillCh,

    I suggest to review the information at the forum thread below.


    You will need to use:

    if (Historical)
    return;

    Comment


      #3
      Thanks Jason

      When I put this at the beginning of my OnBarUpdate() loop I assume it just returns and loops until live data is being processed, so no "executions" on historical data. But I assume that a lookback period would still work on the first live bar, like SMA(14), as long as at least 13 histroical bars are available, right?

      Btw, your reference is a link to this thread here, I guess you wanted to refer to another link?

      Comment


        #4
        Hello BillCh,

        I see . Please see the link below.


        Correct, it will loop and return on historical data in your chart.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        29 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        117 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        69 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        227 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        309 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X