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

How to do this type of plot?

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

    How to do this type of plot?

    am converting a custom eSignal indicator written in Java Script to NinjaScript.
    Have the logic working.. working on the plot.
    The indicator is a stop indicator. as the the price changes the stop moves.. the stop always should be plotted as a horizontal line, and when the stop moves up, there should not be a continuous line connected two successive horizontal segments.
    In Java Script there is nice way to do this as follows:

    setPlotType( PLOTTYPE_FLATLINES, 0 );
    Then you plot the line but assigning a value to plot0. When a new value is assigned, a new horizontal line is drawn at the new value.

    I can't find a "flatlines" plot type in NinjaScript... How would one do this?

    bigtee

    #2
    Originally posted by bigtee View Post
    am converting a custom eSignal indicator written in Java Script to NinjaScript.
    Have the logic working.. working on the plot.
    The indicator is a stop indicator. as the the price changes the stop moves.. the stop always should be plotted as a horizontal line, and when the stop moves up, there should not be a continuous line connected two successive horizontal segments.
    In Java Script there is nice way to do this as follows:

    setPlotType( PLOTTYPE_FLATLINES, 0 );
    Then you plot the line but assigning a value to plot0. When a new value is assigned, a new horizontal line is drawn at the new value.

    I can't find a "flatlines" plot type in NinjaScript... How would one do this?

    bigtee
    Code:
    Plots[x].PlotStyle = PlotStyle.Hash;
    where "x" is the zero-based index of the relevant Plot in the Plots collection.

    Comment


      #3
      Hello bigtee,

      Thank you for your post.

      In NinjaScript you can use PlotStyle.HLine where the syntax for the plot is Plot(Color color, PlotStyle plotStyle, string name) or Plot(Pen pen, PlotStyle plotStyle, string name).

      For information on the PlotClass in NinjaScript please visit the following link: http://www.ninjatrader.com/support/h...plot_class.htm

      Please let me know if I may be of further assistance.

      Comment


        #4
        Thanks to both of you..
        koganam, your suggestion of using the "Hash" works perfectly.... does exactly what I need.

        PatrickH, yours will plot but draws lines across the entire chart.. whereas the "Hash" draws a line only until the value changes... the value can change every few bars.... so the HLINE is not what I was looking for.



        bigtee

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X