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 Brevo, Today, 01:45 AM
      0 responses
      6 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      241 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      6 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Working...
      X