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

difficulty plotting indicator

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

    difficulty plotting indicator

    Hello, I need some coding help. I was converting a thinkorswim indicator I use into NT and have run into a snag. I have the code compiling in ninjascript but I can't get it to plot any values on a chart. The sub-plot shows up but no data for the indicator. I think I'm just missing something easy. Can someone take a look and see if they can spot my issue? Thanks.

    The idea behind the indicator is: Look at the close of the current & last bar, if the close is higher, then all of the current bar volume is considered up volume, if the close is lower all of the volume is considered down volume (yes, it's very rudimentary but keep in mind this is all ToS can do so I'm trying to replicate it here). The up & down volume is summed up over 'x' bars to come up with the % up volume which is then smoothed with a HMA and plotted.

    I exported my compiled indicator and attached it if someone could take a look at it I'd appreciate it.

    Chris

    edited to correct the uploaded file
    Attached Files
    Last edited by zellersc; 02-28-2012, 09:59 AM.

    #2
    Hello zellersc,
    Welcome to the forum and I am happy to assist you.

    Your code is compiled in a dll. Can you upload the source or send it to support[AT]ninjatrader[DOT]com with Attn:Joydeep in the subject line and a reference of this thread in the body of the email.

    Please see the section “Exporting NinjaScript indicators or strategie as source files” from here http://www.ninjatrader.com/support/h...tml?export.htm

    I look forward to assisting you further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      I have developed a simple support and resistance indicator which plots red lines for resistance and green lines for support. I have created a separate plot which tries to show the latest value of the support and resistance below the main chart but there seem to be gaps in the plot. Please see attached image. Even if there is no calculated support or resistance at the current bar the plots should always store the last support or resistance calculated. I expect jumps in the plot as the S/R levels change but don't understand the gaps. Can you please advise thanks? Would like to see continuous plots but with jumps.
      Attached Files

      Comment


        #4
        Hi mballagan,

        When there is not a value to set, are you setting the plots current bar value to the previous value?

        For example:

        Value.Set(Value[1]);
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hi mballagan,

          When there is not a value to set, are you setting the plots current bar value to the previous value?

          For example:

          Value.Set(Value[1]);
          No I have created two class level variables to store the latest support resistance

          So for example :

          private double dblSupport;
          private double dblResistance;


          protected override void Initialize()
          {
          Add(new Plot(Color.Green, "Support"));
          Add(new Plot(Color.Red, "Resistance"));

          CalculateOnBarClose = true;
          Overlay = false;
          }


          protected override void OnBarUpdate()
          {
          if(Support())
          { dblSupport = CalculateSupportLevel();}


          if(Resistance())
          {dblResistance = CalculateResistanceLevel();}

          Support.Set( dblSupport);
          Resistance.Set(dblResistance);

          }


          So if a new support or resistance value is calculated then the plots are updated with the new values else they should contain the last values calculated as dblSupport and dblResistance are not modified in this case.
          Last edited by mballagan; 12-23-2014, 11:13 AM.

          Comment


            #6
            Hello mballagan,

            If you do not set a value, then there will not be a plot to that bar.

            I recommend that when the value is not going to be set with your logic, that you set the value to the previous value as I have suggested.

            Let me know if that does not work.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by andrewtrades, Today, 04:57 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            6 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            436 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            7 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            19 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X