• 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

Referencing an MTF indicator in another indicator

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

  • 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[].

  • 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:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Hanstanz, Today, 04:44 AM
0 responses
9 views
0 likes
Last Post Hanstanz  
Started by juniortut, Today, 04:38 AM
0 responses
5 views
0 likes
Last Post juniortut  
Started by rojiinko, Today, 03:58 AM
0 responses
4 views
0 likes
Last Post rojiinko  
Started by mreanuzlazx, Today, 01:30 AM
0 responses
4 views
0 likes
Last Post mreanuzlazx  
Started by xinepev, Today, 12:33 AM
0 responses
4 views
0 likes
Last Post xinepev
by xinepev
 
Working...
X