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