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

Need help drawing arrows

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

    Need help drawing arrows

    Hello, hoping to get an answer to this. I've spent a lot of time on something I think should (probably will be) simple. Trying to show arrows on chart below/above bar when RSI is below 30 or above 70. I got a RSI code to compile with the following but nothing is showing on chart... any help appreciated. I'd make a new post but dont know how

    if (CrossAbove(RSI(14, 1), 50, 1))
    DrawArrowUp("rsi up" + CurrentBar, false, 0, Low[0], Color.Green);
    else if (CrossBelow(RSI(14, 1), 50, 1))
    DrawArrowDown("rsi down" + CurrentBar, false, 0, High[0], Color.Red);
    RayNinjaTrader Customer Service

    #2
    Hello,

    Your code worked for the 50 line. You just needed to change it to 70 and 30 (also see attached screen shot):

    if (CrossAbove(RSI(14, 1), 70, 1))
    DrawArrowUp(
    "rsi up" + CurrentBar, false, 0, Low[0], Color.Green);
    elseif (CrossBelow(RSI(14, 1), 30, 1))
    DrawArrowDown(
    "rsi down" + CurrentBar, false, 0, High[0], Color.Red);
    Attached Files
    DenNinjaTrader Customer Service

    Comment


      #3
      Ben, your display is what I want but it doesnt plot on screen for me, does it matter where I insert the snipet? I put it on lines 50-57 after the plot area... I'd like the arrows to continue to print untill RSI crosses 70/30line again as well, probably can use some loop type statement that I believe I could do but the real issue for me is just to get the arrows to show...thx

      Comment


        #4
        this is what i have, highlighted in red is code that was entered for desired arrows, thx


        Add(new Plot(Color.Green, "RSI"));
        Add(
        new Plot(Color.Orange, "Avg"));
        Add(
        new Line(System.Drawing.Color.DarkViolet, 30, "Lower"));
        Add(
        new Line(System.Drawing.Color.YellowGreen, 70, "Upper"));



        PriceTypeSupported =
        true;

        DrawOnPricePanel =
        true;

        if (CrossAbove(RSI(7, 1), 70, 1))
        DrawArrowUp(
        "rsi up" + CurrentBar, false, 0, Low[0], Color.Green);
        else
        if (CrossBelow(RSI(7, 1), 30, 1))
        DrawArrowDown(
        "rsi down" + CurrentBar, false, 0, High[0], Color.Red);




        ......

        Comment


          #5
          Ben I moved the code down to lines 100- below indictors calculated where it has header
          ///<summary>
          /// Calculates the indicator value(s) at the current index.
          ///</summary>

          That did it! now it works! thanks

          Comment


            #6
            One last question, is it possible to continue to print the arrows at bottom/top of bar as long as the condition exists(RSI above 70 or below 30)? I tried the return funcion but didnt write it correctly I guess.

            Thanks Again,
            Bert

            Comment


              #7
              Hello,

              Yes, you can. So if it is above or below 70/30 draw? Just build a condition that compares RSI right now (use this index: [0]) to 70/30, then it will draw the entire time it is above/below 70/30.

              Give it a try or pay me to code it for ya. *wink*

              Comment


                #8
                Sounds like a plan! Thanks again :-)

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by cre8able, Today, 03:20 PM
                0 responses
                5 views
                0 likes
                Last Post cre8able  
                Started by Fran888, 02-16-2024, 10:48 AM
                3 responses
                47 views
                0 likes
                Last Post Sam2515
                by Sam2515
                 
                Started by martin70, 03-24-2023, 04:58 AM
                15 responses
                114 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by The_Sec, Today, 02:29 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by jeronymite, 04-12-2024, 04:26 PM
                2 responses
                31 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X