Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Offset of zero line for bar oscilator

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

    Offset of zero line for bar oscilator

    Hello,

    I am creating an oscilator based on other oscilator. I want to overlay a bar plot on top of the original line oscilator, so that it shows a status (the bars possible values are either 0,1,-1).

    Since the oscilator ranges 0-100 with signals generated from crosses around 50, I want the 0 value of the bars to match the 50 value of the line plot. Is this possible?

    Is there any other option to do this?

    #2
    Hello,

    If these are both being plotted from the same indicator, the axis used would be shared for the plots. Unfortunately there would not be a way to offset the value of a plot just visually as the visual is a direct representation of the data.

    I believe you would need to instead use 0, 50 and 100 for the values of the indicator that is currently -1, 0, 1.

    If these are two separate indicators, you may be able to overlay them in the same panel to achieve a similar effect.

    I look forward to being of further assistance.

    Comment


      #3
      Thanks Jesee,

      The issue of using 0,50,100 instead of -1,0,1 is that it will not look simetrical around the centerline. I was trying to get the bars up and down like the MACD, with an overlaying line indicator.

      I am attaching a pic of what I am trying to accomplish... but that is done with 2 indicators put one on top of the other and the scales are not connected in this way. The bars are actually two values , one that can be 0 or 1 and another one 0 or -1.

      Could this be done by shading the area in some way behind the line oscilator?
      Attached Files

      Comment


        #4
        Hello User1986,

        To accomplish what you have displayed in your attachment you could build a strategy which plots two other indicators in the same panel, setting the Scale Justification to Left for 1 indicator and to the right for the other indicator. Since the mid-point of both indicators would fall in the middle, 0 should match 50.

        I’ve demonstrated an example below using a Simple Moving Average but you’d replace SMA with the names and parameters of your indicators.

        else if (State == State.Configure)
        {
        AddChartIndicator(SMA(10));
        SMA(10).Panel=2;
        SMA(10).ScaleJustification = ScaleJustification.Left;
        AddChartIndicator(SMA(20));
        SMA(20).Panel=2;
        SMA(20).ScaleJustification = ScaleJustification.Right ;
        }

        You could use Custom Plotting to draw the plot you want. You can find information on custom plotting under Tools > Edit NinjaScript > Indicator > CustomPlotSample.

        Please let us know if you have any questions.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sjsj2732, Yesterday, 04:31 AM
        0 responses
        27 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        284 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        280 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        132 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        90 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X