Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

High Daily, High Weekly , High Month in intraday

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

    High Daily, High Weekly , High Month in intraday

    my chaart is setting 5 minutes

    2 question :

    1)
    and i want to know the High Daily, High Weekly , High Month

    I write in State.Configure add

    AddDataSeries(BarsPeriodType.Daily,1);
    AddDataSeries(BarsPeriodType.Weekly,1);
    AddDataSeries(BarsPeriodType.Month,1);

    or there is a better code

    2)there is a method already built to calculate it intraday of daily ..monthy and weekly?
    Last edited by turbofib; 09-14-2017, 05:46 AM.

    #2
    Hello turbofib,

    Thanks for your post.

    For live data only, you can add the bars as you have shown and use the setting of Calculate.OnPriceChange to then access the current day bar, week bar and month bar, highs. using Highs[n][0] where n would be the related BarsArray of the added bars. Please see attached.

    The only existing method that relates would be CurrentDayOHL which will work historically and live

    Please note that your AddDataSeries() examples have syntax errors, here are the corrections:
    AddDataSeries(BarsPeriodType.Day,1);
    AddDataSeries(BarsPeriodType.Week,1);

    References:


    Attached Files
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks you for pics

      Comment


        #4
        You say:
        "The only existing method that relates would be CurrentDayOHL which will work historically and live"


        but i see there is a problem

        i print in the chart this indicator
        if (CurrentBar > 3) Print(Time[0] + " days 0 " + CurrentDayOHL().CurrentHigh[0] + " days -1 " + CurrentDayOHL().CurrentHigh[1] + " days -2 " + CurrentDayOHL().CurrentHigh[2]);
        Look pics



        it take High but intraday not daily....Look Ninjascript Output..its intraday not daily
        (session begin 9:00 and finish 22:00)

        CurrentDayOHL().CurrentHigh[0] is the same of CurrentDayOHL().CurrentHigh[1] and this is the same of CurrentDayOHL().CurrentHigh[2] (we are in last candle in the chart 14/09 17:00)


        I want to know for example the HIGH of the last 4 sessions
        high of session 14/09...High of session 13/09...High of session 12/09

        What do you advise me to use? Thank you
        Last edited by turbofib; 09-16-2017, 12:38 PM.

        Comment


          #5
          Hello turbofib,

          Thanks for your reply.

          The method CurrentDayOHL will return the value of the bar index [n]. If you are applying the indicator to 5 minute bars the [0] will be the current High, [1] will be the current high 1 bar ago, [2] would be the bar before that so your results are as expected IE the current high is the same.

          A way to obtain the current high per day would be as this example shows:

          protected override void OnBarUpdate()
          {
          if (CurrentBar < 1) return;

          if (Bars.IsFirstBarOfSession)
          {
          Print ("On : "+Time[1].Day+" the high was: "+CurrentDayOHL().CurrentHigh[1]);
          }


          In the example, on the first bar of the session, we check the bar index[1] (prior bar) which would provide the CurrentDayOHL high for the prior session. You could then accumulate these into an array that you can then access as needed for the last 4 days.
          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CortexZenUSA, Today, 12:53 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by CortexZenUSA, Today, 12:46 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Started by usazencortex, Today, 12:43 AM
          0 responses
          5 views
          0 likes
          Last Post usazencortex  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          168 responses
          2,265 views
          0 likes
          Last Post sidlercom80  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          12 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X