Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using the AddHeikenAshi() without hard coding the instrument in the parameters.

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

    Using the AddHeikenAshi() without hard coding the instrument in the parameters.

    Hello,

    Is there a way to use AddHeikenAshi() without hard coding the instrument in the parameters?

    #2
    Hi kal1212, thanks for writing in. The help guide suggest hard coding the instrument value in case the strategy needs to be used in the Strategy Analyzer, but you can take a look at the built in "Correlation" indicator for an example of how to take an input parameter for the Instrument name.

    Kind regards,
    -ChrisL

    Comment


      #3
      Thanks. I'm confused. I want to be able to use the strategy across any instrument without having to go into the code and and change it each time? Can you please give me an example of how using the Correlation indicator achieves this? Thanks

      Comment


        #4
        Hi kal1212, the Correlation indicator has code within the file that shows you how to use an Input value in AddDataSeries(). You can access the source code of Correlation through the NinjaScript Editor>Indicators folder.

        In Correlation they have a property CorrelationSeries:

        Code:
                [NinjaScriptProperty]
                [Display(ResourceType = typeof(Custom.Resource), Name = "NinjaScriptMarketAnalyzerColumnNameInstrument", GroupName = "NinjaScriptParameters", Order = 0)]
                [PropertyEditor("NinjaTrader.Gui.Tools.UppercaseTextEditor")]
                public string CorrelationSeries { get; set; }​
        
        //Use this value in AddDataSeries:
        
        else if (State == State.Configure && !string.IsNullOrWhiteSpace(CorrelationSeries))
                        AddDataSeries(CorrelationSeries);
        
        Or, in the case of AddHeikenAshi, use it in the instrumentName parameter:
        
        AddHeikenAshi(CorrelationSeries, Data.BarsPeriodType baseBarsPeriodType, int baseBarsPeriodTypeValue, Data.MarketDataType marketDataType)​

        Kind regards,
        -ChrisL
        Last edited by NinjaTrader_ChrisL; 10-12-2022, 12:47 PM.

        Comment


          #5
          Thanks. That works.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          80 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          40 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          63 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          54 views
          0 likes
          Last Post CarlTrading  
          Working...
          X