• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does NinjaScript process Core Indicators Different From 3rd Party Indicators?

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

    Does NinjaScript process Core Indicators Different From 3rd Party Indicators?

    I'm not sure that I phrased the question propely, but I'm experimenting with some NS and ran into a problem. If I'm using a Moving Average in a Script, I can write

    Code:
    private SMA smaFast;
    and there is no problem. But if I call a 3rd party MA and write"

    Code:
    private amaEHMA amaehmaFast
    where amaEHMA is the Exponential HMA written by Harry, I get an error that says

    'NinjaTrader.NinjaScript.Strategies.Strategy.amaEH MA(int)' is a 'method' but is used like a 'type'
    So why can I call the SMA indicator with no problem, but get an error when I call amaEHMA?

    Here's more of a snippet. The offending code is line 44 "private amaEHMA amaehmaFast;"

    Code:
      
    public class LMACross : Strategy
        {
            ///private HMA hmaFast;
            private HMA hmaSlow;
            private amaEHMA amaehmaFast;
    
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description    = NinjaTrader.Custom.Resource.NinjaScriptStrategyDescriptionSampleMACrossOver;
                    Name           = "LMACross";
                    Fast            = 8;
                    Slow            = 21;
                    //Adj            = 13;
                    // This strategy has been designed to take advantage of performance gains in Strategy Analyzer optimizations
                    // See the Help Guide for additional information
                    IsInstantiatedOnEachOptimizationIteration = false;
                }
                else if (State == State.DataLoaded)
                {
                    amaehmaFast     = amaEHMA(Fast);                
                    hmaSlow             = HMA(Slow);
                    //hmaFast            = HMA(Fast);
    
                    amaehmaFast.Plots[0].Brush      = Brushes.Red;
                    hmaSlow.Plots[0].Brush              = Brushes.Cyan;
                    //AMAehmaAdj.Plots[0].Brush     = Brushes.Yellow;
    
                    AddChartIndicator(amaehmaFast);
                    AddChartIndicator(hmaSlow);
    //              AddChartIndicator(hmaFast);
                }
            }
    TIA

    #2
    Hello dmking,

    You should be able to call most custom indicators in the same way as system indicators however it will depend on how the item was developed. Is an indicator which is available for free download so that I could test? The syntax to call this indicator may just be different than what you have used.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello dmking,

      No, system indicators are not called different than custom indicators.

      Are you certain the custom indicator is in the Indicators namespace?

      Attached is an example of a custom indicator called in a strategy.
      Attached Files
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thanks Jesse.

        There is a bundle of indicators from LizardIndicators. These indicators were developed by NT User Harry. I paid a fee to get access to his tools - They're very good. Harry has made many contributions on the forum, but I don't know if you guys have access from him. Is there a way that I can help out?

        D

        Comment


          #5
          Chelsea thanks for responding. I downloaded the zip file from his site and then imported the zip file into NT8. When I look at the indicators that are available to me, there is a Folder called Lizardindicators that contain all of his indicators. Hmm, Does it mak any difference that his indicators are in a folder? Do I have to call the indicator in a different way if it's in a folder?

          Comment


            #6
            Jesse and Chelsea, A question Chelsea asked got me wondering so I move the indicator from the LizardIndicator folder and put it down with all the other indicators and recompiled it. That did the trick. So the question I have is, if an indicator is contained in a folder and you want to call it, what's the syntax for doing that?

            Comment


              #7
              If you have questions regarding our "ama"-indicators, please contact me via a private message or contact LizardIndicators support. I will answer your questions.

              All "ama"-indicators are using a separate namespace "NinjaTrader.NinjaScript.Indicators.LizardIndi cato rs".

              When you call the amaEHMA, you need to add a line to the "Using directions":

              Code:
              using NinjaTrader.NinjaScript.Indicators.LizardIndicators;
              However, it is not a good idea to move the indicator out of the namespace.

              In that case the indicator will no longer appear in the LizardIndicators folder, and other scripts calling the indicator may stop working.
              Last edited by Harry; 04-03-2019, 01:31 AM.

              Comment


                #8
                Harry, Thanks for responding. Your suggestion is just what I needed and everything works as expected. I put the indicator back in the folder. Thanks for the heads up on that.

                As I've said, I'm very glad that I joined you guys as a member. Your work on the tools/indicators is VERY useful both from a standpoint of enhanced functionality AND from a heuristic standpoint of seeing what the best NT coding practices look like. Now, get to work on coding strategies. I'd gladly pay for anything that you do there.

                Kindest regards to a smart and giving guy.

                D

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by dr0832, 01-04-2019, 10:34 AM
                7 responses
                141 views
                0 likes
                Last Post Lancer
                by Lancer
                 
                Started by cbentrikin, Today, 07:46 PM
                0 responses
                4 views
                0 likes
                Last Post cbentrikin  
                Started by RedDuke, Today, 06:14 PM
                0 responses
                4 views
                0 likes
                Last Post RedDuke
                by RedDuke
                 
                Started by DariusDeck, Today, 04:22 PM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_Marco  
                Started by pstrusi, Today, 05:05 PM
                1 response
                3 views
                0 likes
                Last Post pstrusi
                by pstrusi
                 
                Working...
                X