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 NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          56 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          132 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          73 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X