Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Using Variables in Strategy Builder

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

    Using Variables in Strategy Builder

    I have a suspicion this is outside the scope of the wizard, but since an opportunity to add variables is included in the strat builder (NT8. ) I'm curious as to their application. To wit:

    1) One can enter variables yes, but the in entry box itself one can only enter the usual parameters offered above as user inputs.
    2) As there are no other questions asked by the wizard as to what to do with it; it appears to simply be nothing more than a static object. A true variable is of course typically surrounded by an argument which upon evaluation the variable value is declared.
    3) My objective:
    On execution, (bar close for example) capture a real-time numeric value derived from one indicator, take this value and multiply it by the 'variable', and then use it to set a period value for another indicator; for further entry evaluation & potential execution. Clearly order of execution matters in this case as well. In the moment I intend on deriving the value of this variable multiplier manually through a series of tests. Once derived however I still need to apply it into the execution sequence.
    4) So, if possible with the wizard, how do I capture (value 'A 'from indicator A) | multiply this value by static (Variable V) | take this value and use it to set indicator B lookback period (BP) ?
    5) I know what to do to call the BP variable into play, so question is really about creating an instance of "A * V new value; storing it momentarily as "variable 2" and calling this V2 to become the indicator B period setting upon which evaluation continues.


    "A * V = BP

    If not possible in the builder, anyone have a piece of code laying around ?

    Thanx

    JM
    Last edited by johnMoss; 04-08-2020, 10:55 PM.

    #2
    Hello johnMoss,

    Thank you for your post.

    It would not be possible to achieve what you've described using the Strategy Builder - its calculation abilities are pretty limited.

    That being said, it wouldn't be impossible to achieve this with manual coding. I'm attaching an example strategy that shows how this could be achieved.

    Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

    Note — To import NinjaScripts you will need the original .zip file.

    To Import:
    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Once you've imported this, you can view it in the NinjaScript editor to see how it's set up.

    Please let us know if we may be of further assistance to you.
    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you Kate, perfect...

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by gravdigaz6, Today, 11:40 PM
      0 responses
      4 views
      0 likes
      Last Post gravdigaz6  
      Started by MarianApalaghiei, Today, 10:49 PM
      3 responses
      9 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by XXtrader, Today, 11:30 PM
      0 responses
      3 views
      0 likes
      Last Post XXtrader  
      Started by love2code2trade, Yesterday, 01:45 PM
      4 responses
      28 views
      0 likes
      Last Post love2code2trade  
      Started by funk10101, Today, 09:43 PM
      0 responses
      9 views
      0 likes
      Last Post funk10101  
      Working...
      X