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

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

    Click image for larger version

Name:	good.png
Views:	175
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
      Chris L.NinjaTrader Customer Service

      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 benmarkal, Yesterday, 12:52 PM
        3 responses
        22 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by helpwanted, Today, 03:06 AM
        1 response
        18 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        11 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        6 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        244 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Working...
        X