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 cre8able, Yesterday, 07:24 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by cocoescala, 10-12-2018, 11:02 PM
        6 responses
        939 views
        0 likes
        Last Post Jquiroz1975  
        Started by gbourque, Today, 06:39 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by benmarkal, Yesterday, 12:52 PM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X