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 argusthome, 03-08-2026, 10:06 AM
        0 responses
        93 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        48 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        31 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        34 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        70 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X