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

Indicator value to be referred in another indicator

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

    Indicator value to be referred in another indicator

    Hello

    I am trying to refer value of one indicator in another indicator.
    1.If the name of the indicator is "a" (The indicator whose bullish and bearish signal/value is to be referred)
    2.Indicator "a" have bullish and bearish value.(Bullish signal and bearish signal)
    3.I wish to refer this value i.e bullish value of indicator "a" in another indicator.And in the same way also bearish value in another indicator.
    4.How to do this.
    5.Is it possible with coding as
    a.bullish[0] FOR REFERRING BULLISH SIGNAL

    a.bearish[0 FOR REFERRING BEARISH SIGNAL

    Pl correct me if wrong and advise.

    Thanks.

    #2
    Hello profitabletrader306,

    I would recommend naming the indicator class something longer than the letter a.

    However the general syntax in the host script (that calls the hosted script) would be:

    In #region Variables:
    private a myA;

    In OnStateChange() when State is State.DataLoaded:
    myA = a();

    In OnBarUpdate():
    Print(myA.Bullish[0]);


    For an indicator to have a plot you can call by name in a hosted script there must be a public series.
    In the MACD indicator included with NinjaTrader see lines 112 through 117 where a public series is declared, line 56 where the plot is created, and 85 where a value is set for the plot on the current bar.

    Also below are public links to the help guide on AddPlot() and Value/Values.





    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks a lot.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by gaz0001, Today, 10:09 AM
      1 response
      5 views
      0 likes
      Last Post Red_70
      by Red_70
       
      Started by sofortune, Today, 10:28 AM
      3 responses
      6 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by DawnTreader, 05-08-2024, 05:58 PM
      11 responses
      41 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by tkaboris, Today, 06:27 AM
      4 responses
      13 views
      0 likes
      Last Post tkaboris  
      Started by marcus2300, Today, 10:21 AM
      2 responses
      4 views
      0 likes
      Last Post NinjaTrader_Erick  
      Working...
      X