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 goodknight777, Today, 11:39 AM
      0 responses
      2 views
      0 likes
      Last Post goodknight777  
      Started by MohammedAmine, Today, 10:44 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by Nolyn, Today, 10:59 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by Gkomi, Today, 10:02 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by JTizz, Today, 08:58 AM
      11 responses
      34 views
      0 likes
      Last Post JTizz
      by JTizz
       
      Working...
      X