Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Inputs and indicators

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

    Inputs and indicators

    Hi!

    I'd like to ask, is there a way in strategy builder that I can make the value of a parameter vary depending on the value of the ATR indicator (or any other indicator)?

    For example: When the ATR has a value of 2, the RSI has a period of 5, if the ATR exceeds the value of 4, the RSI period changes to 15.
    This is just an example that would not be the specific case​. ​

    #2
    Hello Carlos19,

    Thanks for your post.

    Yes, it would be possible to create a variable named something like 'Period' in the Inputs and Variables screen of the Strategy Builder. Then, in the conditions could be made in the Conditions and Actions screen that checks if an indicator value is Greater/Less than a numerical value and you could set the 'Period' variable to the value you want in the Actions section of that screen.

    The 'Period' variable could then be used for the Period value of an indicator, such as the RSI, later in the script.

    Please see the attached example script demonstrating what this might look like. We create a variable named 'Period' in the Inputs and Variables screen of the Builder.
    • In Set 1 of the Conditions and Actions window we create a condition that checks if the ATR indicator value is Greater than 1 and assign our 'Period' variable a value of 15 in the Actions section of the screen.
    • In Set 2, we create a condition that checks if the ATR indicator value is Less than 1 and assign our 'Period' variable a value of 5.
    • In Set 3, we create a condition that checks if the ATR indicator is Equal to 1 and assign the 'Period' variable a value of 10.
    • In Set 4 we use the Draw.TextFixed() method to draw the value of our 'Period' variable on the bottom right corner of the chart so we can view it.
    • In Sets 5 and 6 we use the 'Period' variable as the Period value of an RSI indicator condition and draw a dot on the chart. We also print out the 'Period' variable so that we can see it in a New > NinjaScript Output window.
      • A blue dot is drawn above the High price of of the candle when the RSI's Avg plot is Greater than the RSI's RSI plot.
      • A pink dot is drawn below the Low price of the candle if the RSI's Avg plot is Less than the RSI's RSI plot.
    See the help guide documentation below for more information about working with the Strategy Builder.

    Inputs and Variables screen: https://ninjatrader.com/support/help...ariablesScreen
    Conditions: https://ninjatrader.com/support/help...on_builder.htm
    Actions: https://ninjatrader.com/support/help...t8/actions.htm

    Please let me know if you have further questions.​
    Attached Files
    Last edited by NinjaTrader_BrandonH; 12-07-2022, 01:56 PM.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Oh great. I was ignoring that in indicator parameters variables can also be assigned, and not only inputs.

      Problem solved.

      Thanks for the attention.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      52 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      43 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      47 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X