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

Compare traded Volume of a 1 Minute Bar with a given Value

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

    Compare traded Volume of a 1 Minute Bar with a given Value

    Hello,

    I am trying to develop an Idicator which compares the Volume of the previous Bar with a given Threshold Value. The Indicator is based on the NT7 VOL Indicator. Currently I am unsing the Code below, on a 1 Minute Chart:

    if (Volume[0] > Threshold && OnOff == true)
    {
    Back ColorAll = Color.Cyan;
    }

    Volume returns a double value, so I also defined "Threshold" as double.

    The Problem:
    Compilation is OK. But: Indicator ignores the Threshold Variable for size Comparison. The complete Chart will be painted Cyan. I defined the Thershold in Parameters:

    public double Threshold
    {
    get { return threshold; }
    set { threshold = Math.Max(1, value); }
    }

    I also use the threshold value to draw a horizontal Line - it works.

    As soon as I replace the Threshold Variable by a figure, e.g. 300 in the code, re-Compile it works perfectly:

    if (Volume[0] > 300 && OnOff == true)
    {
    Back ColorAll = Color.Cyan;
    }


    I would like to be able to set the Threshold Value in the Indicator Settings Window.

    How can I solve the issue?
    Thanks in advance
    Helmut

    #2
    Hello Helmut,

    Thank you for writing in.

    Please ensure that your Threshold property includes the following attribute above it:
    Code:
    [GridCategory("Parameters")]
    Example:
    Code:
    [GridCategory("Parameters")]
    public double Threshold
    {
         get { return threshold; }
         set { threshold = Math.Max(1, value); }
    }
    This will allow the property to appear within the Indicators window. Feel free to change "Parameters" to a different string if you would like.

    When changing the value from the indicator window to 300, does the behavior match as when using a hardcoded 300 value?
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Hello ZacharyG,
      thanks for Your answer. the issue is not that the Value does not show up in the Indicator Window. It already shows up. I can even change it. But nothing happens. It seems, that the used Threshold value is 0, although I put eg. 300 in.
      As soon as I hardcode the Value to e.g. 300 the behaviour does match my expectations.
      Helmut

      Comment


        #4
        Hello Helmut,

        I'm not able to reproduce this on my end.

        Can you please attach your indicator to your response so I may investigate further?
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Reply to Thread : Compare traded Volume of a 1 Minute Bar with a given Value

          Hello ZacharyG,
          here we are. The cs file in the attachment.
          Variables are in German...Schwellwert means Threshold
          Best Regards
          Helmut
          Attached Files

          Comment


            #6
            Hello Helmut,

            It looks like you have the following attributes above your Schwellwert property:
            Code:
            [Browsable(false)]
            [XmlIgnore()]
            You will need to remove these as these were made for the default DataSeries property that was removed from your code.

            Once these are removed, the Schwellwert property will appear within your Indicator window. Additionally, any changes made to the value of the property will appear, as expected, on your chart.

            Please, let me know if you are still seeing the unexpected behavior.
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              Hello ZacharyG,
              did not solve the issue, as the Options were already shwon in the indicator window.

              Now I separated the Variable for the horizontal Line and the Thershold. I initially wanted to set the value of one variable and use it for both, the Line (which shows visually the Threshold) and the Thersold for for the calculation. This did not work.

              After introducting a separate Variable for the Threshold it works.

              The Issue is closed.

              Thanks for Your super fast replys!

              Helmut

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by terofs, Yesterday, 04:18 PM
              1 response
              22 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by CommonWhale, Today, 09:55 AM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by Gerik, Today, 09:40 AM
              2 responses
              7 views
              0 likes
              Last Post Gerik
              by Gerik
               
              Started by RookieTrader, Today, 09:37 AM
              2 responses
              13 views
              0 likes
              Last Post RookieTrader  
              Started by alifarahani, Today, 09:40 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X