Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set rule: Look no further back than beginning of new session

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

    Set rule: Look no further back than beginning of new session

    1. A plot line value is set in the indicator by the user.
    2. It's default value is zero. If so desired, the user enters a value in the indicator's parameters user interface.
    3. The indicator code is if the value is greater than zero, the indicator plots the line on the chart.
    4. The line price level value is hence pulled and used in a standard horizontal line plot: Draw.HorizontalLine(this, "Line1", true, myLine, Brushes.DarkGreen, DashStyleHelper.Solid, 1);
    5. Now as this is a horizontal line plot, visually it goes back indefinitely, which is a non-issue.
    6. The draw object that it now is, is also used as a numerical value.
    7. An objective is for this same indicator to be using this object value for other analysis purposes, but to look at conditions no earlier than the beginning of the latest session in which it is executing conditional statements.

    So: User entered a value for 'Level 1 'in the interface say at 1000 AM.

    Indicator will use this value for other purposes but needs instruction to look no further back than this most current session beginning.


    Thanx jM


    #2
    Hello johnMoss,

    You would have to use logic to do that and also use a plot instead of a drawing object. You would need to make a condition that checks if the Time[0] date is the same as todays date to make sure it only plots on the current day. In that condition you would set the plot to the value you wanted.

    Comment


      #3
      Actually there's nothing for bars? Reason is the session covers two dates. Does the system know this inherently & thus would back to yesterday starting at 5:01PM CST?
      Last edited by johnMoss; 02-13-2025, 09:07 AM.

      Comment


        #4
        Hello johnMoss,

        You can use the SessionIterator to get the start and end times of the session https://developer.ninjatrader.com/do...essioniterator

        Comment


          #5
          Thank you..

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X