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

Custom Indicator Line

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

    Custom Indicator Line

    I've created a modified EMA indicator that composites every x (period) bars. However since it only has a value every x bars, it doesn't plot on the chart since there are missing values. I would like the indicator to manually draw the plots it has on the chart. In C# I would use the DrawCurve method and pass in the array of plots. However DrawCurve has not been overloaded to support NinjaTrader charts like many of the other C# Graphics library methods.

    Is there a way to draw a curved polyline on the chart in NinjaTrader with a custom set of plots?

    #2
    Hello DeepCSystems,

    Thank you for your post.

    You can use the Plot override to achieve this. You can find an example under Tools > Edit NinjaScript > Indicator > CustomPlotSample and Pivots.

    Please let me know if you have any questions.

    Comment


      #3
      Patrick,

      Thanks for your response. The sample code you pointed out was helpful as it showed examples of the undocumented functions ChartControl.GetXByBarIdx and ChartControl.GetYByValue. However the examples only draw either straight lines from bound corners or horizontal lines to indicate pivot prices. They do not show examples of plotting an indicator line on a chart (like that of the @EMA indicator).

      Does NinjaTrader provide any way to draw a curved polyline on the chart with a custom set of coordinates (ie. bar/price or bar/Y, etc)? Is there any other way to draw a curved polyline in NinjaTrader other than to use C#'s Graphics.DrawCurve?

      Comment


        #4
        Originally posted by DeepCSystems View Post
        Patrick,

        Thanks for your response. The sample code you pointed out was helpful as it showed examples of the undocumented functions ChartControl.GetXByBarIdx and ChartControl.GetYByValue. However the examples only draw either straight lines from bound corners or horizontal lines to indicate pivot prices. They do not show examples of plotting an indicator line on a chart (like that of the @EMA indicator).

        Does NinjaTrader provide any way to draw a curved polyline on the chart with a custom set of coordinates (ie. bar/price or bar/Y, etc)? Is there any other way to draw a curved polyline in NinjaTrader other than to use C#'s Graphics.DrawCurve?
        You will have to use a DrawPath() to draw a GraphicsPath().

        ref: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cmtjoancolmenero, Today, 02:31 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by tradebot, Today, 01:25 PM
        2 responses
        7 views
        0 likes
        Last Post tradebot  
        Started by merc410, Today, 03:41 AM
        4 responses
        27 views
        0 likes
        Last Post merc410
        by merc410
         
        Started by Graci117, Yesterday, 11:40 PM
        2 responses
        17 views
        0 likes
        Last Post Graci117  
        Started by Taddypole, Today, 02:25 PM
        0 responses
        1 view
        0 likes
        Last Post Taddypole  
        Working...
        X