Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing object at the bottom of the price panel chart

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

    Drawing object at the bottom of the price panel chart

    Hello
    I was adding 3 array to build colored bar at the bottom of the price panel chart.

    AddPlot(new Stroke(Brushes.Red, DashStyleHelper.Solid, 20), PlotStyle.Square, "RTDownTrend");
    AddPlot(new Stroke(Brushes.Gold, DashStyleHelper.Solid, 20), PlotStyle.Square, "RTNoWhere");
    AddPlot(new Stroke(Brushes.Green, DashStyleHelper.Solid, 20), PlotStyle.Square, "RTUpTrend");

    RTUpTrend[0] = 1; ...

    but when it draws the object it drwas on Price 0 and distroy the scale of the chart.
    How can i position the built bar on the bottom of the chart without changing the chart scale?


    Click image for larger version

Name:	bad.png
Views:	375
Size:	61.8 KB
ID:	1147729

    Click image for larger version

Name:	good.png
Views:	252
Size:	92.9 KB
ID:	1147730 ​​​​​​​

    Thanks
    Oren


    #2
    Hello Oren,
    Seems like you're placing your indicator on Panel 1 itself, you can use new panel for your indicator & keep DrawOnPricePanel = true; so your draw objects are on proce panel & your plot are in panel 2 & your scaling will not be affected. Hope it helps!

    Comment


      #3
      Hello Oren, thanks for your post.

      You would need to use SharpDX in the OnRender method to draw objects on the chart panel without the scaling getting messed up. The ChartPanel object contains the coordinates of the chart panel that you can use to draw graphics in OnRender.

      https://ninjatrader.com/support/help..._rendering.htm - SharpDX guide

      There is also an example indicator called "SampleCustomRender" for a working reference sample.

      Best regards,
      -ChrisL

      Comment


        #4
        s.kinra - this code is from starategy (not from an indocator).
        i tried to implement the code from indicator - i did use
        DrawOnPricePanel = true;
        if i load the indicator from GUI it positions well on price panel but when i try load it from strategy by AddChartIndicator it lost its scale as looks above.
        Chris L - wow i looked at the manual looks like somthing complex i will back to it later after finishing critical blocks at my strategy.

        Thanks alot for both of you!
        Oren

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        88 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        134 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X