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

Referencing an MTF indicator in another indicator

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

  • NinjaTrader_ChelseaB
    replied
    Hello zeller4,

    Are you referring to line 47 in the MTFCallieExample that I have provided you?

    Is this line causing an error on your machine? (Currently, with this line in my code I am not getting any errors on my end)


    (edit)
    To clarify this line is setting a value for the default plot

    This is not a custom exposed series, but I could easily make this an exposed series.
    Last edited by NinjaTrader_ChelseaB; 09-10-2015, 09:29 AM.

    Leave a comment:


  • zeller4
    replied
    Does this line in your code
    Code:
    Value.Set(CurrentBar);
    have something to do with exposing a variable like other samples I've seen?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello zeller4,

    You are likely running into a logic issue.

    If this file is not causing any issues, then I wouldn't imagine anything needs to be recoded.

    The example is just to show that as long as you are checking that there are enough bars for as far back as you are calling then there shouldn't be an error.

    If you are calling an object that doesn't exist, such as too many bars back, or trying to call an object that is null, then you are going to get an error.


    My suggestion would be to reduce your code until the error stops. Then add the code back line by line until the error returns. This should let you know what line has the object that is being called that doesn't exist.

    Leave a comment:


  • zeller4
    replied
    No and no, I was trying to make the sample closer to the reality of what I'm trying to fix...

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello zeller4,

    Is the code sample I gave you giving you errors?

    Is the code sample you just posted giving you errors?

    Leave a comment:


  • zeller4
    replied
    Thanks Chelsea,
    Here's my quick files of a similar nature, showing what I'm trying to accomplish.
    Not sure if there needs to be something else besides
    Code:
    if (CurrentBar < BarsRequired)
    in the Caller code.

    Anything else that stands out that could cause the problems from Post#1?
    Attached Files

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello zeller4,

    I've made a quick example to show adding a secondary series to a target script and then calling this script should work without issue.

    Please import this package and try running the MTFCallerExample script on a chart. This will print to the output window.

    Are you finding any issues with this example?
    Attached Files

    Leave a comment:


  • zeller4
    started a topic Referencing an MTF indicator in another indicator

    Referencing an MTF indicator in another indicator

    Hello,
    I'm referencing a MTF indicator which has this:

    Code:
    if (CurrentBar < BarsRequired || CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired || CurrentBars[2] < BarsRequired)
    It's being called into an indicator which only has this:
    Code:
    if (CurrentBar <  BarsRequired)
    I'm using try/catch blocks to see where it stops working.
    I'm getting the effor "Object reference not set to an instance of an object" and since I've tried nearly everything else I can think of, I'm wondering if the BarsRequired is maybe not set correctly or something related to the differing sets of CurrentBars[].

Latest Posts

Collapse

Topics Statistics Last Post
Started by judysamnt7, 03-13-2023, 09:11 AM
4 responses
59 views
0 likes
Last Post DynamicTest  
Started by ScottWalsh, Today, 06:52 PM
4 responses
36 views
0 likes
Last Post ScottWalsh  
Started by olisav57, Today, 07:39 PM
0 responses
7 views
0 likes
Last Post olisav57  
Started by trilliantrader, Today, 03:01 PM
2 responses
21 views
0 likes
Last Post helpwanted  
Started by cre8able, Today, 07:24 PM
0 responses
10 views
0 likes
Last Post cre8able  
Working...
X