Announcement

Collapse
No announcement yet.

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.





    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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      563 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      329 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      548 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X