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

Stochastic Alerts

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

    Stochastic Alerts

    Hello
    I Have a request. I have been looking for a Stochastic with cross over alerts. One that will paint an up and down arrow on my chart near the price bars when the lines cross over. It seems simple enough that it must be out there already but I haven't been able to find it. And I know nothing about programming. Can someone please help me with it?
    Thank you
    Tom

    #2
    Hi Tom, there are lots of scripts working with a stochastic setup shared here - http://www.ninjatrader.com/support/f...chastic&desc=1

    You will likely be able to find a good starting point then for your own custom works.

    As alternative start customizing the default Stochastics script, for example right click in it and select to 'Save as' under a new new (so you have a copy) and then add this snippet as last part in the OnBarUpdate() -

    Code:
    if (CrossAbove(K, D, 1))
    				DrawArrowUp("upArrow" + CurrentBar, 0, Low[0] - TickSize, Color.Blue);

    This will draw an up arror on the price bar one tick below the low bar which produced the K,D crossover.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Hi Tom, there are lots of scripts working with a stochastic setup shared here - http://www.ninjatrader.com/support/f...chastic&desc=1

      You will likely be able to find a good starting point then for your own custom works.

      As alternative start customizing the default Stochastics script, for example right click in it and select to 'Save as' under a new new (so you have a copy) and then add this snippet as last part in the OnBarUpdate() -

      Code:
      if (CrossAbove(K, D, 1))
      				DrawArrowUp("upArrow" + CurrentBar, 0, Low[0] - TickSize, Color.Blue);

      This will draw an up arror on the price bar one tick below the low bar which produced the K,D crossover.
      Thanks for the tip Bertrand. I will try it over the weekend.
      Last edited by TomTrades; 11-22-2014, 04:01 PM.

      Comment


        #4
        Still need help.
        That code didn't work. I created this code.

        // Condition set 1
        if (CrossAbove(Stochastics(3, 6, 3).K, Stochastics(3, 6, 3).D, 1))
        {
        DrawArrowUp("My up arrow" + CurrentBar, false, 0, 0, Color.Lime);
        }

        // Condition set 2
        if (CrossBelow(Stochastics(3, 6, 3).K, Stochastics(3, 6, 3).D, 1))
        {
        DrawArrowDown("My down arrow" + CurrentBar, false, 0, 0, Color.Red);
        }

        With the help of strategy builder and it checked out OK but didn't plot on my chart.
        Any suggestions?

        Comment


          #5
          Hello TomTrades,

          Thank you for your response.

          Both of your DrawArrow methods are drawing at zero. You need to set a value like given in Bertrand's example:
          Code:
          DrawArrowUp("upArrow" + CurrentBar, 0, [B]Low[0] - TickSize[/B], Color.Blue);

          Comment


            #6
            Originally posted by NinjaTrader_PatrickH View Post
            Hello TomTrades,

            Thank you for your response.

            Both of your DrawArrow methods are drawing at zero. You need to set a value like given in Bertrand's example:
            Code:
            DrawArrowUp("upArrow" + CurrentBar, 0, [B]Low[0] - TickSize[/B], Color.Blue);
            Thank you Patrick.
            I'm almost there. How do I make the plot arrow X number of ticks away from the current bar?
            Thank you
            Tom

            Comment


              #7
              Hi Tom, you could just set a multiplier here to multiple into the ticksize to use as offset.

              Code:
              DrawArrowUp("upArrow" + CurrentBar, 0, Low[0] - 4 * TickSize, Color.Blue);
              The 4 could also be made a user integer input so you can control on the fly from the UI.

              BertrandNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Bertrand View Post
                Hi Tom, you could just set a multiplier here to multiple into the ticksize to use as offset.

                Code:
                DrawArrowUp("upArrow" + CurrentBar, 0, Low[0] - 4 * TickSize, Color.Blue);
                The 4 could also be made a user integer input so you can control on the fly from the UI.

                http://www.ninjatrader.com/support/f...ead.php?t=5782
                My indicator looks great!
                Thanks guys
                Tom

                Comment


                  #9
                  Originally posted by TomTrades View Post
                  My indicator looks great!
                  Thanks guys
                  Tom
                  Anyone interested I added the following to a standard Stochastic indicator and called it StochasticAlerts

                  // Condition set 1
                  if (CrossAbove(Stochastics(3, 6, 3).K, Stochastics(3, 6, 3).D, 1))
                  {
                  DrawArrowUp("My up arrow" + CurrentBar, 0, Low[0] - 2 * TickSize, Color.Lime);
                  }

                  // Condition set 2
                  if (CrossBelow(Stochastics(3, 6, 3).K, Stochastics(3, 6, 3).D, 1))
                  {
                  DrawArrowDown("My down arrow" + CurrentBar, 0, High[0] + 2 * TickSize, Color.Red);
                  }

                  Comment


                    #10
                    thank you very much

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Waxavi, Today, 02:00 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post Waxavi
                    by Waxavi
                     
                    Started by elirion, Today, 01:36 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post elirion
                    by elirion
                     
                    Started by gentlebenthebear, Today, 01:30 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post gentlebenthebear  
                    Started by samish18, Yesterday, 08:31 AM
                    2 responses
                    9 views
                    0 likes
                    Last Post elirion
                    by elirion
                     
                    Started by Mestor, 03-10-2023, 01:50 AM
                    16 responses
                    391 views
                    0 likes
                    Last Post z.franck  
                    Working...
                    X