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

Multiple IDataSeries input for indicator

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

    #16
    Originally posted by NinjaTrader_Lance View Post
    You would either need to pass in the two doubles from C as you have (or pass them as two separate inputs)

    Unfortunately passing a data series as input is not supported and you would need to do a type conversion for it to work with the UI
    OK, so the only way is passing Close[0] and Close[1] as separate variables or pass the difference (Close[0]-Close[1]) as one variable from C. Slightly less elegant than being able to pass the DataSeries itself but I can live with it

    This thread shows how you can expose different series values for access and may be the work around you're looking for



    Let me know if I can be of further assistance.
    I had found that thread already some time ago, but if I understand it correctly this goes in the opposite way: it can be used to make indicators OUTPUT more than one DataSeries but not to accept more than one DataSeries as INPUT. However, the stuff in that thread is really useful and I'm using it already in some indicators

    Thanks again for your help!

    Comment


      #17
      Originally posted by FireFly View Post
      I have a new question related to this. Suppose that in TestA I want to use not Close[0] but (Close[0]-Close[1]). How can I do that?

      Of course I could do this in TestC:
      Plot0.Set( TestA( TestB(Close,2),Close[0] - Close[0])[0] );

      But can I do the calculation ( Close[0]-Close[1] ) inside TestA by passing Close as a DataSeries? How can I do that?

      So basically I want to have multiple DataSeries as inputs where normally an indicator works on only one.

      Just some suggestions that I have never tried myself in your exact setup.
      1. Have you tried using a PriceType variable for input, and a switch statement to branch depending on such input value? ref: my response in this thread: http://www.ninjatrader.com/support/f...ad.php?t=44605
      2. Have you tried using the BarsArray Get functions?
        Code:
        BarsArray[0].GetClose(CurrentBar);
        BarsArray[0].GetLow(CurrentBar); //et.c.,

      Comment


        #18
        Originally posted by koganam View Post
        [*]Have you tried using the BarsArray Get functions?
        Code:
        BarsArray[0].GetClose(CurrentBar);
        BarsArray[0].GetLow(CurrentBar); //et.c.,
        This is the solution. It works Perfect! Thanks!

        Btw, I found that there was also an unpleasant side effect to the previous method (passing Close[0] and Close[1] through the "normal" parameters): I noticed that for every bar the whole indicator gets re-calculated for all previous historical bars, so a big hit on performance. Using BarsArray doesn't have that issue.

        My indicator works smoothly now and the solution with BarsArray is very elegant.
        Last edited by FireFly; 03-07-2013, 01:13 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        48 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Started by samish18, 04-17-2024, 08:57 AM
        16 responses
        61 views
        0 likes
        Last Post samish18  
        Started by jordanq2, Today, 03:10 PM
        2 responses
        9 views
        0 likes
        Last Post jordanq2  
        Started by traderqz, Today, 12:06 AM
        10 responses
        21 views
        0 likes
        Last Post traderqz  
        Working...
        X