• 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

  • dmking
    replied
    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

    Leave a comment:


  • Harry
    replied
    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.

    Leave a comment:


  • dmking
    replied
    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?

    Leave a comment:


  • dmking
    replied
    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?

    Leave a comment:


  • dmking
    replied
    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

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    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

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by digibob, Today, 03:00 PM
0 responses
1 view
0 likes
Last Post digibob
by digibob
 
Started by yeshujbp, Today, 02:50 PM
0 responses
2 views
0 likes
Last Post yeshujbp  
Started by tonynt, Today, 12:39 PM
0 responses
11 views
0 likes
Last Post tonynt
by tonynt
 
Started by Martyb, 06-13-2019, 05:14 AM
10 responses
78 views
0 likes
Last Post iq200
by iq200
 
Started by Erwin Beckers, 11-04-2018, 02:39 AM
4 responses
71 views
2 likes
Last Post brucerobinson  
Working...
X