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:	406
Size:	61.8 KB
ID:	1147729

    Click image for larger version

Name:	good.png
Views:	262
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 kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        57 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        39 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        45 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        35 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        156 views
        0 likes
        Last Post SalmaTrader  
        Working...
        X