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

Piping multiple indicator results to separate panes ...

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

    Piping multiple indicator results to separate panes ...

    Let's say that I have created an indicator called Scalp6E(1, 5000, 1, 25, 1) which performs a complicated series of calculations that spawn a large number of related metrics: met0, met1, met2 ... met19. Of course the values of these metrics depend upon the arguments to Scalp6E(). Due to their number and widely different scales, these metrics cannot all be conveniently displayed in a single pane, and so for efficiency I expose them for public access as Series<T> objects named _met0, _met1, _met2 ... _met19 on the assumption that other indicators will be able to access them for display without repeating the entire series of calculations. Now I can create additional indicators for display called (for example) ShowMet13 to display selected metrics met1 and met3. Within ShowMet13 I can define individual plots in the new indicator pane like this (State.SetDefauts):

    AddPlot(..., "showMet1");
    Addplot(..., "showMet3");

    and bring the data for these plots to display thus (OnBarUpdate):

    showMet1[0] = Scalp6E(1, 5000, 1, 25, 1)._met1[0];
    showMet3[0] = Scalp6E(1, 5000, 1, 25, 1)._met3[0];

    This works well enough, but I have observed that it requires me to specify a full complement of arguments for Scalp6E to retrieve the metric values, and that if I specify slightly different arguments then I get different values for the metrics (i.e. Scalp6E and resultant Series<T> objects are recalculated). So now I cannot imagine that NT8 is arbitrarily recomputing the values stored in these Series<T> objects at each successive public access. Can you confirm that recalculation is not done unless the Scalp6E parameters are _different_ from those of previously computed instances of the object.

    Sure would be nice if NT8 would allow piping indicator data to multiple display panes from a single indicator.

    #2
    Hello jvanelli,
    Thanks for your post.

    Yes, I would expect for the indicator to recalculate anytime it was applied to a new data series, new settings were applied, or a method such as OnBarUpdate() is run from within the indicator.

    What specifically are you trying to do with your indicators panels?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Just trying to automate some aspects of my trading activity. All this stuff will eventually be embodied in a strategy. The only problem was that some things need to draw on the main panel whereas others have widely different ranges. The only remaining problem might be changing parameters on the fly without re-writing code, but I have a work around (planned but not yet coded). I'll create an indicator specifically to accept parameter inputs then expose them to the main indicator Scalp6E for access as public variables. Technically then, Scalp6E would expose no calling parameters and the OnBarUpdate code snippet above reduces to:

      showMet1[0] = Scalp6E()._met1[0];
      showMet3[0] = Scalp6E()._met3[0];

      At least that's the plan ...

      Comment


        #4
        I have actually successfully used Memory Mapped Files (>= .Net 4.0) instead of pipes to do just that. MMF uses shared memory so it's very quick. I've even saved entire historical data into memory. I prefer this method over public variables as you can use a unique name to identify the MMF thus using a public property in the GUI to link the 'sender' and 'getter'. The only issue I had was the 'sender' chart did not always update before the 'getter' chart, so a quick workaround is to 'send' on price change and 'get' on each tick, which was acceptable to me.

        Click image for larger version  Name:	MMF.jpg Views:	1 Size:	46.9 KB ID:	1044095
        Last edited by Sim22; 01-03-2019, 04:01 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by f.saeidi, Yesterday, 12:14 PM
        9 responses
        23 views
        0 likes
        Last Post f.saeidi  
        Started by Tim-c, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post Tim-c
        by Tim-c
         
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        3 views
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,772 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        31 views
        0 likes
        Last Post Max238
        by Max238
         
        Working...
        X