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

Multiple EMA lines plot but in different period

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

    Multiple EMA lines plot but in different period

    Hi,

    I am trying to develop an indicator which can plot some 17 EMA lines in different period, for e.g. EMA(6), EMA(9), EMA(12), etc.

    However, I have no idea on how to start this with reference to the standard single EMA indicator that is available in the NinjaTrader.

    Can anyone please enlighten me with some examples?

    Thanks in advance.

    Regards,
    Eric

    #2
    Hello Eric,

    Thank you for writing in and welcome to the NinjaTrader Support Forum!

    Here is an example below of how you can plot EMA(6), EMA(9), and EMA(12) lines from one indicator:

    Code:
    protected override void Initialize()
    {
            Add(new Plot(Color.Red, PlotStyle.Line, "EMA(6)"));
    	Add(new Plot(Color.Green, PlotStyle.Line, "EMA(9)"));
    	Add(new Plot(Color.Blue, PlotStyle.Line, "EMA(12)"));
    }
    
    protected override void OnBarUpdate()
    {
    	Values[0].Set(EMA(6)[0]);
    	Values[1].Set(EMA(9)[0]);
    	Values[2].Set(EMA(12)[0]);
    }
    We first need to add out plots in Initialize(). This is done through the Add() method call: https://ninjatrader.com/support/helpGuides/nt7/?add.htm

    With our plots added, we'll need to assign values to our plots. We'd use the Values collection to do this: https://ninjatrader.com/support/help...t7/?values.htm

    To obtain the values needed for the plots, I am simply calling the EMA() method with the period desired: https://ninjatrader.com/support/help...onential_e.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Hi Zachary,

      Thanks for your quick reply!
      May I know if there is a skeleton template for a custom indicator which I can refer to and add these codes to get this custom indicator works?
      I am just not too sure on how these codes should be integrated.

      With thanks,
      Eric

      Comment


        #4
        Hello ericmar,

        There isn't a skeleton template for indicators

        We do have resources to help you begin creating NinjaScript Strategies/Indicators.

        The best way to begin learning NinjaScript is to use the Strategy Wizard. With the Strategy Wizard you can setup conditions and variables and then see the generated code in the NinjaScript Editor by clicking the View Code button.

        I'm also providing a link to a pre-recorded set of videos 'Strategy Wizard 301' and 'NinjaScript Editor 401' for you to view at your own convenience.
        Strategy Wizard 301
        NinjaScript Editor 401

        There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under Tools--> Edit NinjaScript--> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)

        We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
        Click here to see our NinjaScript Reference Samples
        Click here to see our NinjaScript Tips

        These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

        Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
        Alphabetical Reference

        We also have a few tutorials in our help guide for both Indicators and Strategies.
        Indicator tutorials
        Strategy tutorials
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Hi Eric,

          The GMMA should contain what you are looking for. It runs with 12 EMAs but you could add even more. See attached.

          sandman
          Attached Files

          Comment


            #6
            Hi Ericmar,

            Did you eventually managed to develop your indicator ?
            If yes could you tell me how you did it ?

            Thanks a lot for your help

            Comment


              #7
              Hi Sandman, thanks for your great work !
              But unfortunately can't manage to compile it :-( Is it just for NT7 ?

              My idea would be creating something close to the "SuperGuppy" great work of JustUncleL on TradingView (without the arrows and alerts) :
              Browse scripts to find best strategies, indicators, or even libraries built using Pine Script. Over 100,000 publications to go beyond ordinary in market research.

              * a first group of 11 fast EMAs : 3,5,7,9,11,13,15,17,19,21,23
              * a second group of 16 slow EMAs : 25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70
              I'm really new to NT8 and kinda lost on the path to do it, just getting more and more compiling errors here...
              Could you help me on this one ? Or as least tell me where to start ?
              Thanks a lot for your help

              Comment


                #8
                Zananas.
                The earlier GMMA is for NT7. I do not use NT8 so can't help.
                BTW: the GMMA was not created by me.
                sandman

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by ZenCortexCLICK, Today, 04:58 AM
                0 responses
                5 views
                0 likes
                Last Post ZenCortexCLICK  
                Started by sidlercom80, 10-28-2023, 08:49 AM
                172 responses
                2,280 views
                0 likes
                Last Post sidlercom80  
                Started by Irukandji, Yesterday, 02:53 AM
                2 responses
                17 views
                0 likes
                Last Post Irukandji  
                Started by adeelshahzad, Today, 03:54 AM
                0 responses
                5 views
                0 likes
                Last Post adeelshahzad  
                Started by Barry Milan, Yesterday, 10:35 PM
                3 responses
                13 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X