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

Input Type Help

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

    Input Type Help

    I have a Indicator with inputs for value


    [NinjaScriptProperty]
    [Range(0, int.MaxValue)]
    [Display(Name="Preferred Min Chop Points", Order=1, GroupName="Parameters")]
    public int PreferredMinChopPoints
    { get; set; }

    I would like to input a decimal in steady of whole number, right now It will not take .50 only 1 and above

    [Range(0.01, int.MaxValue)]

    I tried to change Range to allow but still will only take 1 and above

    H1 and L1 are prev pivots as you might see in a ZigZag Plot, so the sum is in dollar values, so if the sum is < 30 for example on NQ that is 30 Points which is fine

    BUT FOR STOCKS needs to be maybe under 1 dollar or 1 Point, it would be much better to express in ticks

    double h1l1sumrangecheckC1 = H1[0]-L1[0];

    h1l1sumrangecheckC1 < PreferredMinChopPoints

    SHOULD I BE CHANGING THE FORMULA AND TRY TO EXPRESS IN TICKS

    double h1l1sumrangecheckC1 = ((H1[0]-L1[0] * 100);// FOR STOCKS

    double h1l1sumrangecheckC1 = ((H1[0]-L1[0] * 4);/FOR ES AND NQ

    LOOKING FOR IDEA OR VERIFICATION OF MY LAST THOUGHTS
    THANKS
    Happy Holidays

    #2
    Hello DTSSTS,

    Thank you for your post.

    An input set up as an int will only be able to accept whole numbers. Int is simply short for integer which is just a whole number with no decimals. If you want to use a decimal in that input, it would need to be changed to a double:

    Code:
    [NinjaScriptProperty]
    [Range(0, double.MaxValue)]
    [Display(Name="Preferred Min Chop Points", Order=1, GroupName="Parameters")]
    public double PreferredMinChopPoints
    { get; set; }
    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thanks for quick response, Can I also so as

      double h1l1sumrangecheckC1 = ((H1[0]-L1[0]) * 100);// FOR STOCKS

      double h1l1sumrangecheckC1 = ((H1[0]-L1[0]) - 4);/FOR ES AND NQ

      and then express as ticks


      [NinjaScriptProperty]
      [Range(0, int.MaxValue)]
      [Display(Name="Preferred Min Chop Ticks", Order=1, GroupName="Parameters")]
      public int PreferredMinChopTicks
      { get; set; }


      thanks again

      Comment


        #4
        Hello DTSSTS,

        Thank you for your reply.

        I'm a little confused by your calculations there - if I'm understanding correctly H1[0] - L1[0] gives you a price difference in currency, is that correct? And you wish to express that difference in ticks? If so you can just divide that by the TickSize to get the number of ticks difference:

        double h1l1sumrangecheckC1 = ((H1[0]-L1[0]) /TickSize);// FOR STOCKS

        double h1l1sumrangecheckC1 = ((H1[0]-L1[0])/TickSize);/FOR ES AND NQ

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Great Idea, I never did it that way or knew you could. Awesome solution.

          Have a wonderful Holiday

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by gcztraders, Yesterday, 03:58 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by reynoldsn, 05-10-2024, 07:04 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by franciscog21, 05-10-2024, 05:27 PM
          1 response
          30 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by llanqui, Today, 11:10 AM
          0 responses
          9 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Started by llanqui, Today, 10:29 AM
          0 responses
          9 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Working...
          X