Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dataseries : Static?

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

    Dataseries : Static?

    Hello,
    I am trying to store the opening price into a dataseries and then access it for my entry conditions.
    1. Can I use the time function to limit the time a value is stored into my dataseries?
    e.g

    if((ToTime(Time[0]) >= 160000 && ToTime(Time[0]) < 160030))
    {
    myDataSeries.Set( Open[0]);
    }

    2. Does this object store a static value or will it have to update OnBarUpdate?

    3. If I use the Reset method to reset the dataseries at a certain time ( say close) will my data series be having a value of 0 or null?

    I'm trying to enter the market if the price crosses a certain threshold from open:

    if (Close[1] > myDataSeries[1] + trigger * TickSize);
    {
    EnterLong(Quantity, "Long A");
    }
    -Kiriru

    #2
    Kiriru, yes you can use the Time() to limit setting values for your DataSeries, however I'm not sure why you need to work with a series, wouldn't storing your price value to a double variable do?

    Comment


      #3
      Bertrand,
      Thank you for your quick response.
      Is there a reference sample or thread you can recommend.
      I can only find this that refers to barsAgo

      double sum = 0;
      for (int barsAgo = 0; barsAgo < Period; barsAgo++)
      {
      sum = sum + Input[barsAgo];
      }
      How can I refer to the Open or close of the FirstBarOfSession?
      Thanks again.
      Kiriru

      Comment


        #4
        You're welcome - I'm not aware of a specific sample, just save the value to a variable at your desired time then -

        Code:
         
        if (Bars.FirstBarOfSession)
        myOpen = Close[0];
        You can also access this value as defined by your session times from the CurrentDayOHL indicator.

        Comment


          #5
          Thanks Bertrand,
          This was very helpful.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          637 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          366 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          569 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          571 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X