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

Help w/Strategy Wizard Please

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

    Help w/Strategy Wizard Please

    I was hoping someone could help me. I have tried to build a simple MACD strategy using the Strategy Wizard to no avail. It is as follows:

    If fast MACD Line crosses slow line above 0 then go long. If fast MACD line crosses slow line below 0 go short.

    I also would like to go long if both lines move through the 0 line from below it or short if both lines move through the 0 line from above it. In this case they could have crossed earlier I am just looking for both lines to move through.

    Can this be done in the wizard and if so would someone be willing to get me started in the right direction? If not does anyone know if this strategy has been written before or something like it?

    Thanks in advance.

    Thanks...

    #2
    Hello,

    Yes, you can do this in the Strategy Wizard. Please review this link:


    Then try to set it up yourself again. If you get stuck please provide me with screen shots of your actions and conditions window and tell me what is not working. I will assist you with some suggestions.
    DenNinjaTrader Customer Service

    Comment


      #3
      Thanks and quick question.

      How do I represent the 0 line using the MACD indicator? This is one of the problems I am having . If I look in the Strategy Wizard and add the MACD I don't see the 0 line as a parameter.

      Comment


        #4
        Hi pclark,

        MACD does not have a zero line plot, but if you wanted to run checks against a zero line you can use the "Misc" section and select "Numeric value".
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          In the directions that Ben told me to look at there is an example of an EMA indicator on indicator and I understand how to specify one EMA over the other EMA in the example because I would change the values but how do I pick one MACD and tell it what to do on another MACD because the values are the same. Does this make sense?

          For example if I were using EMA I would make one value 9 and the other 12 and just specify when 9 crosses 12 but w/the MACD my values will not change from the default. How would I write this?

          If you guys could point me to some strategies that were written in the wizard that would be a big help. The one that came w/the software does not have anything I can build upon. If I can disect something I work better. It does not have to be what I am looking for it just needs to be something similar.

          Thanks for your help.

          Comment


            #6
            Hello,

            When you say:
            "w/the MACD my values will not change from the default. How would I write this?"

            It is not clear what your signal is. Perhaps this will help:
            - if you are using the default MACD, the default MACD has parameters. They are 12/26/9.

            - are you trying to compare the MACD value of one bar to another bar for the same MACD indicator? If so, use the bars ago field to determine which bar you are referring to. For example if you unchecked calculate on bar close at the beginning of the Wizard, "0" bars ago means the current building bar, and "1" bars ago means the bar just to the left of that (which is closed), "2" bars ago means the bar to the left of the "1" bar.
            If you have calculate on bar close checked, then "0" refers to the first closed bar (the bar to the left of the currently building bar), "1" refers to the bar to the left of that, etc.

            If you provide details on exactly what your MACD signal is, I can help you better.

            The only samples we have are the sample strategies you see in Strategies and the tutorial I linked you to before.
            DenNinjaTrader Customer Service

            Comment


              #7
              Thanks Ben and Josh. I got it working. I may have more questions but the info you provided helped me. I am just trying to learn the possibilities of the Strategy Wizard and it takes some working with to get the thought process going for me.

              Paul

              Comment


                #8
                Strategy Wizard Problems

                Hello, I'm having major issues with the Strategy Wizard. I tried putting in a simple moving avgerage cross and I"m getting like 20 errors in the code even though I did everything through the strategy wizard. It shouldn't be this hard but I'm having trouble with this thing even doing something so very simple. I get an "error on generating strategy" message and I did everything through the Wizard. HELP!

                Here is what the wizard spat out which does not work:

                #region Using declarations
                using System;
                using System.ComponentModel;
                using System.Diagnostics;
                using System.Drawing;
                using System.Drawing.Drawing2D;
                using System.Xml.Serialization;
                using NinjaTrader.Cbi;
                using NinjaTrader.Data;
                using NinjaTrader.Indicator;
                using NinjaTrader.Gui.Chart;
                using NinjaTrader.Strategy;
                #endregion

                // This namespace holds all strategies and is required. Do not change it.
                namespace NinjaTrader.Strategy
                {
                /// <summary>
                /// Brian 004 trying to do this from scratch
                /// </summary>
                [Description("Brian v004 trying to do this from scratch")]
                public class v004 : Strategy
                {
                #region Variables
                // Wizard generated variables
                private int vEMA8 = 8; // Default setting for VEMA8
                private int vVWMA20 = 20; // Default setting for VVWMA20
                private int vSMA50 = 50; // Default setting for VSMA50
                private int vSMA200 = 200; // Default setting for VSMA200
                // User defined variables (add any user defined variables below)
                #endregion

                /// <summary>
                /// This method is used to configure the strategy and is called once before any strategy method is called.
                /// </summary>
                protected override void Initialize()
                {
                Add(VWMA(Close, 20));
                Add(SMA(Close, 50));
                SetProfitTarget("20maX50maUP", CalculationMode.Ticks, 40);
                SetStopLoss("20maX50maUP", CalculationMode.Ticks, 12, false);

                CalculateOnBarClose = false;
                }

                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
                protected override void OnBarUpdate()
                {
                // Condition set 1
                if (CrossAbove(VWMA(Close, 20), SMA(Close, 50), 1))
                {
                DrawArrowUp("20vwmaX50smaUP" + CurrentBar, false, 0, 0, Color.Lime);
                EnterLongLimit(5, 0, "20maX50maUP");
                }
                }

                #region Properties
                [Description("8EMA")]
                [Category("Parameters")]
                public int VEMA8
                {
                get { return vEMA8; }
                set { vEMA8 = Math.Max(1, value); }
                }

                [Description("20VWMA")]
                [Category("Parameters")]
                public int VVWMA20
                {
                get { return vVWMA20; }
                set { vVWMA20 = Math.Max(1, value); }
                }

                [Description("50SMA")]
                [Category("Parameters")]
                public int VSMA50
                {
                get { return vSMA50; }
                set { vSMA50 = Math.Max(1, value); }
                }

                [Description("200SMA")]
                [Category("Parameters")]
                public int VSMA200
                {
                get { return vSMA200; }
                set { vSMA200 = Math.Max(1, value); }
                }
                #endregion
                }
                }

                Comment


                  #9
                  Brian, as NinjaTrader does always compile all present NinjaScript files (not only the one you're currently working on) you could see errors being reported even if you're current work is flawless, to resolve this please check into this link -

                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks

                    NinjaTrader_Bertrand,

                    Thanks, that's exactly what it was. I had a few scripts that i had started transferring from eSignal onto NT and they weren't complied correctly and that was causing the errors with script that was actually perfect. I created another directory in my NT folder under My Documents and just moved the stille needed to be edited scripts in to that folder and everything then worked as it should.

                    Thanks for the link to the error message post, THAT was a big help.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by DawnTreader, 05-08-2024, 05:58 PM
                    22 responses
                    81 views
                    0 likes
                    Last Post DawnTreader  
                    Started by Mathias79, Today, 03:44 PM
                    0 responses
                    17 views
                    0 likes
                    Last Post Mathias79  
                    Started by Austiner87, Today, 03:42 PM
                    0 responses
                    11 views
                    0 likes
                    Last Post Austiner87  
                    Started by lorem, 04-25-2024, 09:18 AM
                    19 responses
                    83 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by joselube001, 05-10-2024, 12:17 PM
                    6 responses
                    29 views
                    0 likes
                    Last Post joselube001  
                    Working...
                    X