Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Creating a Strategy Using Decimal inputs

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

  • bltdavid
    replied
    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?

    Leave a comment:


  • NinjaTrader_Jim
    replied
    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, 08:30 PM.

    Leave a comment:


  • pborg05
    started a topic Creating a Strategy Using Decimal inputs

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by ezrollin, Yesterday, 08:51 PM
1 response
31 views
0 likes
Last Post bltdavid  
Started by Rubix, Yesterday, 09:31 PM
0 responses
18 views
0 likes
Last Post Rubix
by Rubix
 
Started by ark321, Yesterday, 05:12 PM
1 response
27 views
0 likes
Last Post NinjaTrader_EricB  
Started by futurenow, Yesterday, 09:08 PM
0 responses
4 views
0 likes
Last Post futurenow  
Started by fafafdenis, Yesterday, 04:56 PM
1 response
7 views
0 likes
Last Post NinjaTrader_EricB  
Working...
X