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

Plotting a Dot

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

    Plotting a Dot

    Hello,
    I'm trying to plot a Dot right on the CCI line itself after a condition has been met. This one doesnt seem to be working.
    Is the...CCI(Close,Period)[0]...not the correct way to do this?
    What changes do I need to make?

    DrawDot("Down Dot" + CurrentBar,false, 0, CCI(Close,Period)[0], Color.Red);


    Thanks

    #2
    dwalls,

    That should take the CCI's value and plots a dot right at that particular value. If the CCI moves afterwards, the dot does not necessarily update with the CCI move.

    If your CCI is not on the price panel be sure to use DrawOnPricePanel = false in Initialize().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Additionally, doesn't CurrentBar have to be CurrentBar.ToString()?

      Code:
      [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]DrawDot([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Down Dot"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] + CurrentBar.ToString(),[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2], CCI(Close,Period)[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]], Color.Red);[/SIZE][/FONT][/SIZE][/FONT]
      mrlogik
      NinjaTrader Ecosystem Vendor - Purelogik Trading

      Comment


        #4
        Originally posted by mrlogik View Post
        Additionally, doesn't CurrentBar have to be CurrentBar.ToString()?
        It depends wether the compiler complains or not. If not, then C# contains an overload for <string> + <long> -> <string>.

        Regards
        Ralph

        Comment


          #5
          Thanks guys.
          I got it to work.

          Thanks

          Comment


            #6
            Hi Guys,
            When I use the DrawDot and have the "Calculate on bar close" set to false the dots dont always plot correctly...they will sometimes plot in spots they are not suppose to...if I use the "Calculate on bar close" set to True...then they plot correctly.

            Is there a way to use the DrawDot with the indicator set to "Calculate on bar close" False...and still have the Dots plot correcty?
            Is there something I can add to the code to make this work correctly?

            if (CrossAbove(diff, avg,1))
            DrawDiamond("Up Diamond" + CurrentBar, 0, Difference, Color.Lime);

            Thanks

            Comment


              #7
              No, it takes a lot of extra code to test for the condition and remove the diamond when the condition doesn't exit anymore and reapply it after the candle closes if the condition is true again. You are better off using a Plot and the code is smaller and simpler. Hopefully NT7 will have more different Plot shapes available.
              eDanny
              NinjaTrader Ecosystem Vendor - Integrity Traders

              Comment


                #8
                Originally posted by dwalls View Post
                Hi Guys,
                When I use the DrawDot and have the "Calculate on bar close" set to false the dots dont always plot correctly...they will sometimes plot in spots they are not suppose to...if I use the "Calculate on bar close" set to True...then they plot correctly.

                Is there a way to use the DrawDot with the indicator set to "Calculate on bar close" False...and still have the Dots plot correcty?
                Is there something I can add to the code to make this work correctly?

                if (CrossAbove(diff, avg,1))
                DrawDiamond("Up Diamond" + CurrentBar, 0, Difference, Color.Lime);

                Thanks
                Very simple solution:

                if (CrossAbove(diff, avg,1))
                DrawDiamond("Up Diamond" + CurrentBar, 0, Difference, Color.Lime);
                else RemoveDrawObject("Up Diamond" + CurrentBar);

                Comment


                  #9
                  Hey,
                  Thanks roonius.
                  Can you check this for me.
                  I tried this and get a message that says "Statement expected"
                  I must have something wrong. This is how I have it now:

                  if (CrossAbove(diff, avg,1))
                  {
                  DrawDiamond("Up Diamond" + CurrentBar, 0, Difference, Color.Lime);
                  else RemoveDrawObject("Up Diamond" + CurrentBar);
                  }

                  Thanks

                  Comment


                    #10
                    Please provide the complete error message. Thank you.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Ok here it is.

                      Thanks
                      Attached Files

                      Comment


                        #12
                        if (CrossAbove(diff, avg,1))
                        {
                        DrawDiamond("Up Diamond" + CurrentBar, 0, Difference, Color.Lime);
                        }
                        else
                        {
                        RemoveDrawObject(
                        "Up Diamond" + CurrentBar);
                        }
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by dwalls View Post
                          Hey,
                          Thanks roonius.
                          Can you check this for me.
                          I tried this and get a message that says "Statement expected"
                          I must have something wrong. This is how I have it now:

                          if (CrossAbove(diff, avg,1))
                          {
                          DrawDiamond("Up Diamond" + CurrentBar, 0, Difference, Color.Lime);
                          else RemoveDrawObject("Up Diamond" + CurrentBar);
                          }

                          Thanks
                          Your curly brackets are wrong. In this case you can simply remove them

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Waxavi, Today, 02:10 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post Waxavi
                          by Waxavi
                           
                          Started by TradeForge, Today, 02:09 AM
                          0 responses
                          9 views
                          0 likes
                          Last Post TradeForge  
                          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  
                          Working...
                          X