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

Bars in progress live data and historical loading

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

    Bars in progress live data and historical loading

    I have this scenario that I am printing stochastics from Bars in progress 1 and Printing other information on bars in progress 0

    Bars in progress 0 is a non time frame chart and Bars in progress1 is a time based chart.


    The issue arises which I think that because Currentbar in BarsInSession 0 may have less than Barsinprogress1. When plotting I get an index error.

    If I just print live. I don't have an issue. What I want to do is paint some Stochastics back 5 bars so I can have a feel how the stochastics trend is.

    //live
    if(BarsInProgress == 1 && CurrentBar == Bars.Count - 1)

    {

    TimeChart[0] =( DoubleStochastics(10)[0];
    PlotBrushes[1][0] = pTimeTrendColor;
    }

    #2
    Hello ballboy11,

    Thank you for the note.

    You will have to do a real bars check instead of using the bar count to make sure that you have enough bars to process the command.

    if(CurrentBars[0] < 1 || CurrentBars[1] < 1) return;

    Please let me know if you see the same after implementing this.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hello ballboy11,

      Thank you for the note.

      You will have to do a real bars check instead of using the bar count to make sure that you have enough bars to process the command.

      if(CurrentBars[0] < 1 || CurrentBars[1] < 1) return;

      Please let me know if you see the same after implementing this.
      Hi ChrisL,

      On the same subject, the issue is that the slope colors on the secondary (larger time frame) indicator will start over at the Currentbar if any change is made to the chart (re-fresh, etc.) and the historical slope colors are reset to default color. However, the slope colors will be correct after that last chart refresh until any changes are made to the chart.

      I use the sample reference for a secondary indicator here, as suggested by CheseaB:



      Thanks.

      Comment


        #4
        Hello aligator,

        Thanks for the post.

        Could you please provide a code snippet here that describes the issue?

        I look forward to your reply.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChrisL View Post
          Hello aligator,

          Thanks for the post.

          Could you please provide a code snippet here that describes the issue?

          I look forward to your reply.
          Thanks ChrisL,

          Here is an example using SampleSecondarySeriesAsInputSeries indicator converted from SMA to CCI to show switching colors using 1M as primary and 5M as Secondary series.

          The indicator switches color when values are above or below 0 line.

          Notice the primary series 1m CCI switches color to orange and cyan normally. However, the secondary series colors switches from Red and Lime are not continuous, creating a stepped line which is filled with 4 minutes of the default green color and the 5th minute in Lime or Red.

          I assume this would also be the case for a SMA slope colors situation. How do we get a continuous custom coloring for the secondary series indicator? I know having the larger time frame as primary would fix the situation, but the smaller time frame is the normal primary series.

          Thanks.
          Attached Files
          Last edited by aligator; 04-26-2018, 11:44 AM.

          Comment


            #6
            Hello aligator,

            Thank you for that info.

            I was able to modify the script to plot different colors based on the plots values. Please see attached.

            Please let me know if this does not resolve your inpuiry.
            Attached Files
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            26 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, Yesterday, 09:53 PM
            2 responses
            49 views
            0 likes
            Last Post wzgy0920  
            Started by Kensonprib, 04-28-2021, 10:11 AM
            5 responses
            192 views
            0 likes
            Last Post Hasadafa  
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,234 views
            0 likes
            Last Post xiinteractive  
            Working...
            X