Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Creating a Strategy Using Decimal inputs

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

    Creating a Strategy Using Decimal inputs

    Hi Team

    I have created a strategy where the user inputs the value of the Bollinger Band deviation but where the value is an integer it is not possible to input a decimal. Without decimals the strategy is no where near specific enough as changes in whole numbers makes a huge difference to the strategy. Is it possible to set the input so decimal numbers can be inputted.

    Many Thanks


    #2
    Hello pborg05,

    Thanks for your post.

    Integer variables do not have a decimal portion. Input variables would need to be doubles in order to have a decimal value.

    The BollingerBand indicator uses the Period integer input to create the StdDev and SMA indicators that it is based on. This describes the number of bars used, which cannot be a non integer value.

    You could consider copying this indicator, adding a double User Defined Input and using that input as a multiplier in the Upper and Lower plot calculations to achieve your goal.

    For example:

    Code:
    Upper[0] = sma0 + NumStdDev * stdDev0 * MyDouble;
    Middle[0] = sma0;
    Lower[0] = sma0 - NumStdDev * stdDev0 * MyDouble;
    An indicator can be copied by opening it in the NinjaScript Editor, right clicking in the code editor, and then clicking Save As.

    You could also consider modifying the NumStdDev variable so it is a double instead of an integer.

    Creating User Defined Inputs - https://ninjatrader.com/support/help...d_input_pa.htm

    We look forward to assisting.
    Last edited by NinjaTrader_Jim; 09-13-2020, 09:30 PM.

    Comment


      #3
      Originally posted by pborg05 View Post
      I have created a strategy where the user inputs the value of the Bollinger Band deviation but where the value is an integer it is not possible to input a decimal. Without decimals the strategy is no where near specific enough as changes in whole numbers makes a huge difference to the strategy. Is it possible to set the input so decimal numbers can be inputted.
      Change it to a double.

      Did you try that?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      76 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      45 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      26 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      32 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      62 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X