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

Fibonacci Retracement Alert

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

    Fibonacci Retracement Alert

    Please, I need your assistance in relation to the Ninjascript that I need to use to check to see whether price has retraced/touched the 50% Level of a Fibonacci retracement.
    In other words, I want to send an alert to myself whenever price has retraced to the 50% level of a Fibonacci tool.





    For Example

    If (price retraced to 50% of Fibonacci)
    {
    Alert(string id, Priority priority, string message....)
    }

    #2
    Hello cryfgg,

    Thank you for your post.

    To clarify, is the Fibonacci retracement in question drawn by a NinjaScript indicator or strategy, or would you be drawing this manually and then applying an indicator or strategy to monitor the price?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello cryfgg,

      Thank you for your post.

      To clarify, is the Fibonacci retracement in question drawn by a NinjaScript indicator or strategy, or would you be drawing this manually and then applying an indicator or strategy to monitor the price?

      Thanks in advance; I look forward to assisting you further.

      The Fibonacci retracement will be drawn via Ninjascript Indicator (using the code Draw.FibonacciRetracements (....) applied to swing points)

      Comment


        #4
        Hello cryfgg,

        Thank you for your reply.

        I'm attaching a simple example indicator that draws a fibonacci retracement between the high and low of the past 100 bars and then gets the 50% level value that should get you going in the correct direction.

        Please let us know if we may be of further assistance to you.
        Attached Files
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Kate View Post
          Hello cryfgg,

          Thank you for your reply.

          I'm attaching a simple example indicator that draws a fibonacci retracement between the high and low of the past 100 bars and then gets the 50% level value that should get you going in the correct direction.

          Please let us know if we may be of further assistance to you.
          I couldn't figure it out using your codes (I'm still a novice in programming)... Here is my code (below). How do I modify it to what i want? thanks for the assistance

          private int strength = 7; // Default setting for Strength

          private int lastHighBar ()
          {
          return Swing(strength).SwingHighBar(1,1,200);
          }
          private double lastHighBarValue ()
          {
          return Swing(strength).SwingHigh[strength+1];
          }
          private int lastLowBar ()
          {
          return Swing(strength).SwingLowBar(1,1,200);
          }
          private double lastLowBarValue ()
          {
          return Swing(strength).SwingLow[strength+1];
          }
          private double length ()
          {
          return lastHighBarValue() - lastLowBarValue();
          }
          private double curLength()
          {
          return lastHighBarValue() - MIN(Low,nbars)[0];
          }
          private double curLLength ()
          {
          return MAX(High,nbars)[0] - lastLowBarValue();
          }


          protected override void OnBarUpdate()
          {

          if (lastLowBar() > lastHighBar() )
          &&

          )
          {
          Draw.FibonacciRetracements(this, "line" + CurrentBar, false, lastLowBar(), lastLowBarValue(), lastHighBar(), lastHighBarValue());

          Alert(@"Fib Retracement_1", Priority.Low, @"Fib Retracement", NinjaTrader.Core.Globals.InstallDir+@"\sounds"+Al ertWavFileName, 0, Brushes.Cyan, Brushes.Black);
          }

          }

          if (lastLowBar() < lastHighBar() && Close[0] < lastHighBarValue() && length())
          {

          Draw.FibonacciRetracements(this, "line" + CurrentBar, false, lastHighBar(),lastHighBarValue(),lastLowBar(),last LowBarValue());

          if(soundAlert1==true)
          {
          Alert(@"Fib Retracement_1", Priority.Low, @"Fib Retracement", NinjaTrader.Core.Globals.InstallDir+@"\sounds"+Al ertWavFileName, 0, Brushes.Cyan, Brushes.Black);
          }


          }

          Comment


            #6
            Hello cryfgg,

            Thank you for your reply.

            You'd want to make sure you're saving your drawn fib retracement to a variable so you can easily loop through the price levels and get that 50% level. I'm attaching an example strategy that builds upon the logic in my example indicator I previously posted and submits long or short orders depending on whether the price crosses above or below the 50% level and sets a 10 tick stop loss and a profit target at either the 0 or 100 level depending on the direction of entry. There's a number of comments in the code to explain what's going on that should be helpful to you.

            Please let us know if we may be of further assistance to you.
            Attached Files
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Hello! I am new Ninja trader user and I like to make some change to Fibonacci retracement as shown as attachment below. Can anyone help?
              Attached Files

              Comment


                #8
                Hello Eunha Kim,

                Thank you for your reply.

                While we in the Support department cannot create a strategy on your behalf, I would take a look at the example strategy above which will allow you to get the price levels of whichever % line you wish. From there, you can calculate the number of shares/contracts according to your formula and then enter using that calculated value for the quantity.

                If you are interested in services in having the code written for you, I can have a representative of our EcoSystem reach out with more information on NinjaScript consultants who will be happy to do so.

                Please let us know if we may be of further assistance to you.
                Kate W.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                18 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                1 view
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                6 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Started by alifarahani, Today, 09:40 AM
                6 responses
                41 views
                0 likes
                Last Post alifarahani  
                Working...
                X