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

Problems with trailing lines on chart

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

    Problems with trailing lines on chart

    Hi, i'm trying to write an indicator that draw trailing-like lines on a chart.

    Now, we have 2 Plots or output, ideally when a specific condition is met, the plot of the greenline should be somewhere below the current price, while the redline plot should be just null, in other words it must not be visible on the chart.

    The problem is, i don't know how to make them be not visible (just be an empty value), what happen is that if no value is assigned to a plot, it automatically become "0".

    However as you can see in this chart, the effect on chart is just wrong, i mean lines going to 0, they must disappear from the chart, not go to 0, deforming the whole chart.

    Any suggestion on what to do?

    i tried to assign "null" to the not used output, but the compiler say it is not possible to do it.
    Attached Files

    #2
    Hello w4rn1ng,

    Thanks for your post and welcome to the forums!

    You can make plot sections not visible by not assigning anything to them for that specific bar where it is not needed. So only assign a value to the plot when you want to see the plot.

    For example, if I had a plot called MidLine and did this:

    if (Close[0] > Open[0])
    {
    MidLine[0] = SMA(10)[0];
    }

    What will be plotted would be an SMA line when there is an upbar (Edit: More than one upbar in a row to draw the plot line). See attached visual example, Red line for upbars.
    Attached Files
    Last edited by NinjaTrader_PaulH; 12-07-2016, 03:33 PM.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Very great, thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,602 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      8 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      4 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      12 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X