Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DoubleStochastics trigger

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

    DoubleStochastics trigger

    Using the Strategy Wizard how would one trigger a buy and sell using the DoubleStochastics? I would want to buy when the line crosses above 10% for Buy and below 90% for a sell. I can program in the DoubleStochastics Indicator but there is no way I can find to set a trigger at a %

    #2
    Hello larrylwill,

    Thank you for your post.

    From the strategy builder, you will want to use Misc--> Numeric value and key in the value for the condition.

    If looking for 90%, you would use a whole value of 90.
    MatthewNinjaTrader Product Management

    Comment


      #3
      I got it to work although I have 2 problems.
      1st It does not plot the buy and sell on the chart. Even though I have made a buy and sell signal name. This has worked on my other strategies. Because I turned off the text and markers to get rid of all the old signals, I had to turn it back on. I got it.

      But not this one.
      2nd after the cross over and it makes a buy/sell and then I get a profit stop triggered it buys/sells a 2nd contract even though its way past the cross over.
      Last edited by larrylwill; 06-27-2011, 11:08 PM.

      Comment


        #4
        1st It does not plot the buy and sell on the chart

        How did you define this to plot the buy and sell on the chart? Through a chart market or text, other?

        2nd after the cross over and it makes a buy/sell and then I get a profit stop triggered it buys/sells a 2nd contract even though its way past the cross over.

        When applying the strategy, what are your Order Handling options set to? This would be entries per direction and entry handling.
        MatthewNinjaTrader Product Management

        Comment


          #5
          I found the problem of the missing signals I edited it in my last message.
          Answer:
          enter long default quantity which is 1.

          #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>
          /// Enter the description of your strategy here
          /// </summary>
          [Description("Enter the description of your strategy here")]
          public class Stoch : Strategy
          {
          #region Variables
          // Wizard generated variables
          private int profit = 20; // Default setting for Profit
          private int sstop = 15; // Default setting for Sstop
          // 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(DoubleStochastics(10));
          Add(DoubleStochastics(10));
          SetProfitTarget("", CalculationMode.Ticks, Profit);
          SetTrailStop("", CalculationMode.Ticks, Sstop, false);

          CalculateOnBarClose = false;
          }

          /// <summary>
          /// Called on each bar update event (incoming tick)
          /// </summary>
          protected override void OnBarUpdate()
          {
          // Condition set 1
          if (CrossAbove(DoubleStochastics(10).K, 10, 1))
          {
          EnterLong(DefaultQuantity, "Buy");
          }

          // Condition set 2
          if (CrossBelow(DoubleStochastics(10).K, 90, 1))
          {
          EnterShort(DefaultQuantity, "Sell");
          }
          }

          #region Properties
          [Description("")]
          [GridCategory("Parameters")]
          public int Profit
          {
          get { return profit; }
          set { profit = Math.Max(1, value); }
          }

          [Description("")]
          [GridCategory("Parameters")]
          public int Sstop
          {
          get { return sstop; }
          set { sstop = Math.Max(1, value); }
          }
          #endregion
          }
          }

          Comment


            #6
            I ran it again starting at about 95% and it sold one as it dropped to below 90% it hit the profit stop and continued down without any more sells, then when it got below 10% and started back up it made a buy then hit the profit stop and then made a 2nd buy.
            It made the 2nd buy at the profit target.

            Comment


              #7
              Hello,

              When enabling the strategy, please make sure you have EntryHandling set to UniqueEntries and the entries per direction set to 1.
              MatthewNinjaTrader Product Management

              Comment


                #8
                Im sorry I do not know how to set entry handling to a unique entry. I used the wizard and set it to EnterLong (defaultQuanity. "Buy" and the same for sell just the opposite.

                Comment


                  #9
                  larrylwill,

                  When you enable your strategy from a chart or from the control center, there are some additional parameters that are not set in the code of the strategy.

                  Please see our Help Guide on Understanding strategy properties:

                  MatthewNinjaTrader Product Management

                  Comment


                    #10
                    So far it has only done it on the first trade after start up.

                    Comment


                      #11
                      I have created the strategy with the wizard and started it within a chart. I found the entry handling box and set it to unique entries. I will test it further.
                      thank you

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      637 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      366 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      107 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      569 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      572 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X