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

Indicator plot

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

    Indicator plot

    I tried to build a simple indicator using current bar and 3 bars ago. However, I don't get any plot display in the Charts window. Compile was clean.

    The code snippet looks something like:

    Plot0.Set(SMA(34)[0]/SMA(34)[3]);

    It works if I remove "SMA(34)[3]".

    #2
    Hello,


    Please note that the value that will be plotted will be near 1 since SMA(34)[0] will likely be close to the value of SMA(34)[3]; therefore you will need to plot something like this on a lower panel (not on the price panel) as the price you have on the chart is not likely to be around the value of 1. To plot on the price chart you will want to keep your values very near the current price.

    To get the value to plot on the lower panel please change Overlay = true; to false in the Initialize() block of your code.

    This link will help with this:


    To get the value to plot on price you will need to come up with some other calculation that returns a value near the current price.

    Also, be sure that you have if(CurrentBar < 3) return; at the beginning of your OnBarUpdate() code block. This link will help:
    DenNinjaTrader Customer Service

    Comment


      #3
      Thank you, Ben.
      I will make these changes and give a try.
      In the plot parameter window, I did specify Panel3. Not sure if
      this makes the Overlay=false in the code.
      I will double check.

      Thanks,

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by r68cervera, Today, 05:29 AM
      0 responses
      3 views
      0 likes
      Last Post r68cervera  
      Started by geddyisodin, Today, 05:20 AM
      0 responses
      3 views
      0 likes
      Last Post geddyisodin  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      6 responses
      35 views
      0 likes
      Last Post JonesJoker  
      Started by GussJ, 03-04-2020, 03:11 PM
      12 responses
      3,239 views
      0 likes
      Last Post Leafcutter  
      Started by AveryFlynn, Today, 04:57 AM
      0 responses
      6 views
      0 likes
      Last Post AveryFlynn  
      Working...
      X