• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 HiddenPhilosopher, Yesterday, 11:58 PM
      3 responses
      17 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by Mykro, Yesterday, 09:48 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by Brillo, Today, 12:40 PM
      0 responses
      3 views
      0 likes
      Last Post Brillo
      by Brillo
       
      Started by authenticx, 05-29-2020, 03:51 PM
      3 responses
      62 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by nikolaalx, Today, 07:31 AM
      10 responses
      41 views
      0 likes
      Last Post bltdavid  
      Working...
      X