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.
    JimNinjaTrader Customer Service

    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 jaybedreamin, Today, 05:56 PM
      0 responses
      3 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      6 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Working...
      X