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

There is no condition in the Value Plot line!

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

    There is no condition in the Value Plot line!

    Hello
    I ask your help!

    I created the color of the indicator (see the first attachment)

    BUT!
    When creating a condition in Strategy Builder , there is nothing !!!!
    How to submit in Value Plot coloring -Long-Short-Flatt ???

    There is no condition in the Value Plot line!
    How to submit in Value Plot coloring -Long-Short-Flatt ???

    thanks to!
    Last edited by alex@n; 03-18-2017, 11:13 AM.

    #2
    Hello alex@n,

    Thanks for your post.

    In the indicator you have created 3 plots however in the OnBarUpdate() you are only using the first plot labeled Long1 and it is associated with Value. By using PlotBrushes you are changing the color of Value which is the first plot labeled Long1.

    I think it would be easier for you if instead of trying to determine a plots color, that you instead use a numeric value to describe if the plot is rising, falling or flat. Typically these conditions would be indicated by a plot value of +1 = Rising, -1 = falling and 0 = flat. Doing this would allow you to use the indicator in the market analyzer as well.

    To accomplish this, in your indicator code:
    1) Delete the 3rd AddPlot "flat" as it is not needed
    2) Change the color of the 2nd plot from Red to Transparent to keep it hidden.
    3) Change the name of the 2nd plot to "EMASignal".
    4) In the OnBarUpdate() change the code as follows:

    if (IsRising(Value))
    {
    PlotBrushes[0][0] = Brushes.Blue;
    EMASignal[0] = 1; // for strategy
    }
    else if (IsFalling(Value))
    {
    PlotBrushes[0][0] = Brushes.Red;
    EMASignal[0] = -1; // for strategy
    }
    else
    {
    PlotBrushes[0][0] = Brushes.Yellow;
    EMASignal[0] = 0; // for strategy
    }


    You will need to go into the properties section and comment out or delete the properties for the 3rd plot as it is no longer used and you will also need to change the name of the 2nd plot from Short to EMASignal.

    Once these changes are made and you have successfully compiled, the indicator will perform the same in the way it is coloring the plot. In the strategy builder you would then be able to select the indicator and EMASignal for plot and then check to see if +1, -1, or 0 for rising, falling or flat.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul !

      Thanks for your reply!

      Corrections give an error KS0103!
      The name "EMASignal" is missing in the current context.
      Please see link ;
      Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


      What did I do wrong?

      Maybe there are more superfluous { }?

      Sincerely .
      Last edited by alex@n; 03-17-2017, 02:30 AM.

      Comment


        #4
        Hello alex@n,

        Thanks for your reply.

        The first thing I see is that you have named the first plot the same as the second plot. Each plot must be named uniquely. As we are using the second plot for the signal, I recommend changing the name of the first plot to perhaps EMAplot and leaving the 2nd plot as EMASignal.

        If after making that change you still have issues, it would be helpful if your screenshot also showed the "Properties" section which is below the OnBarUpdate() code by clicking on the "+" to the left of "Properties".
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Paul View Post
          Hello alex@n,

          Thanks for your reply.

          The first thing I see is that you have named the first plot the same as the second plot. Each plot must be named uniquely. As we are using the second plot for the signal, I recommend changing the name of the first plot to perhaps EMAplot and leaving the 2nd plot as EMASignal.

          If after making that change you still have issues, it would be helpful if your screenshot also showed the "Properties" section which is below the OnBarUpdate() code by clicking on the "+" to the left of "Properties".
          Hello _Paul !

          I did as you say.
          The result is the same , something is wrong.

          Please see file.
          Last edited by alex@n; 03-18-2017, 11:11 AM.

          Comment


            #6
            Hello alex@n,

            Thanks for your reply.

            Line 51 - Change the color from Red to Transparent
            Line 51 - Change the name from EMASSignal to EMASignal

            Line 79 change MASignal to EMASignal

            Change your region properties to look like this:

            #region Properties
            [Range(1, int.MaxValue), NinjaScriptProperty]
            [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
            public int Period
            { get; set; }

            [Browsable(false)]
            [XmlIgnore]
            public Series<double> Long
            {
            get { return Values[0]; }
            }

            [Browsable(false)]
            [XmlIgnore]
            public Series<double> EMASignal
            {
            get { return Values[1]; }
            }
            #endregion

            After you compile, add to a chart, should only see the EMA plot. When you add to the strategy builder, make sure you select EMASignal as the value plot, do not change colors.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Paul View Post
              Hello alex@n,

              Thanks for your reply.

              Line 51 - Change the color from Red to Transparent
              Line 51 - Change the name from EMASSignal to EMASignal

              Line 79 change MASignal to EMASignal

              Change your region properties to look like this:


              After you compile, add to a chart, should only see the EMA plot. When you add to the strategy builder, make sure you select EMASignal as the value plot, do not change colors.
              Poul Thanks for your reply.
              Yes, it works!
              Thank you very much !
              It's amazing that in "ValuePlot" only Long and Transparent.
              Please see the file.

              One question ;
              If you create a condition "ValuePlot" -> Long -> EnterLong; - With this it is clear.

              If you create a condition "ValuePlot" -> Transparent -> EnterShort? Is this condition true?
              Last edited by alex@n; 03-18-2017, 11:14 AM.

              Comment


                #8
                Hello alex@n,

                Thanks for your reply.

                In the strategy builder please select only the transparent plot. Its value will be 1 when rising, 0 when flat or -1 when falling. I assume you want to enter long when the plot value is 1, enter short when plot value is -1.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Paul View Post
                  Hello alex@n,

                  Thanks for your reply.

                  In the strategy builder please select only the transparent plot. Its value will be 1 when rising, 0 when flat or -1 when falling. I assume you want to enter long when the plot value is 1, enter short when plot value is -1.
                  Yes ,thank you !


                  My question;
                  Last edited by alex@n; 03-18-2017, 11:16 AM.

                  Comment


                    #10
                    Hello alex@n,

                    Thanks for your reply.

                    Here is a short video that I hope will answer your questions: https://www.screencast.com/t/zcWBqZydebvG
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Paul View Post
                      Hello alex@n,

                      Thanks for your reply.

                      Here is a short video that I hope will answer your questions:
                      Yes, it's understandable!
                      Thank you very much !
                      Last edited by alex@n; 03-18-2017, 11:15 AM.

                      Comment


                        #12
                        Originally posted by alex@n View Post
                        Yes, it's understandable!
                        Thank you very much !
                        Hello _Paul

                        I had the setup of your video.
                        Please see attached:Scren1
                        The difference is noticeable!
                        Please see attached:Screnn2
                        What could be the error code?
                        But , this is great! )

                        It made me think
                        Is it possible to adjust, Dot, show only at extremes bars ( example for 1000- 3000 bars)????


                        Regards,
                        Last edited by alex@n; 03-20-2017, 06:55 AM.

                        Comment


                          #13
                          Hello alex@n,

                          Thanks for your post.

                          Glad to see your progress.

                          Please review again the video provided as it shows how to add CurrentBar to the tag name to create a unique tag name. Otherwise, if you use the same tag name only the latest dot will be shown and this is what you are showing.

                          The dots can be drawn as you wish however you would need to create the code that allows the dots to be drawn at the extremes you noted. You might want to test/use the indicator "Swing" as it will automatically draw dots at the swing points you have noted.
                          Paul H.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by aa731, Today, 02:54 AM
                          1 response
                          6 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Started by BarzTrading, Today, 07:25 AM
                          0 responses
                          2 views
                          0 likes
                          Last Post BarzTrading  
                          Started by i019945nj, 12-14-2023, 06:41 AM
                          5 responses
                          65 views
                          0 likes
                          Last Post i019945nj  
                          Started by ruudawakening, Today, 12:58 AM
                          1 response
                          8 views
                          0 likes
                          Last Post NinjaTrader_Jesse  
                          Started by thread, Yesterday, 11:58 PM
                          1 response
                          8 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Working...
                          X