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

Access custom Indicators across multiple scripts

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

    Access custom Indicators across multiple scripts

    I am new to programming Indicators in NinjaScript. I've made some progress, but still have a few blind spots. Can someone help me to see what I am doing wrong?

    The problem is that I am trying to reference Indicators that I've built in a couple of other scripts. Summarizing - I am trying to write "BO1MStop.cs". It needs Indicators from 2 other scripts. They are "BO1MTrigger.cs" and "BO1MEntry.cs". Both of these scripts are debugged and run OK. I have plots of their data. However, when I reference the Entry and Trigger Indicators from within BO1MStop, BO1MTrigger is visible, but BO1MEntry is not. After several hours of looking and re-reading the relevant bits of NinjaScript learning resources, I've just about given up.

    The 3 .cs files are attached. The code is simple. I hope someone out there can take a look and recognize the problem in short order.

    Thanks,
    Les Munson
    Attached Files

    #2
    Hello lm44179,

    In the BO1MStop script I don't see that you are calling your indicator correctly, the code as it is now should not be valid.

    Code:
    int entryBars = BO1MEntry[0];// This Indicator
    This would need to be called in the same way as your other indicator:

    Code:
    double trigger = BO1MTrigger()[0];
    or
    Code:
    double entryBars = BO1MEntry()[0];
    An easy way develop scripts that call other indicators is to use the strategy builder to generate the code needed for your indicators. If you make a condition in the builder that uses these indicators and then click View Code that will show the correct syntax to set up the indicators and access their data. you can always copy/paste the relevant code for the indicators from that strategy into your indicator as well.





    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse, thanks for the response. This gives me a couple of things to try. If I get jammed up, will post again.
      Les

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by xiinteractive, 04-09-2024, 08:08 AM
      5 responses
      13 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by swestendorf, Today, 11:14 AM
      2 responses
      5 views
      0 likes
      Last Post NinjaTrader_Kimberly  
      Started by Mupulen, Today, 11:26 AM
      0 responses
      2 views
      0 likes
      Last Post Mupulen
      by Mupulen
       
      Started by Sparkyboy, Today, 10:57 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by TheMarlin801, 10-13-2020, 01:40 AM
      21 responses
      3,918 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Working...
      X