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 funk10101, Today, 09:43 PM
      0 responses
      6 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      44 views
      0 likes
      Last Post bill2023  
      Started by yertle, Today, 08:38 AM
      6 responses
      26 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      24 views
      0 likes
      Last Post algospoke  
      Working...
      X