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

Drawline

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

    Drawline

    I have the following code which I would like to draw a circle below the bar the crosses and also draw a line.

    if (CrossAbove(EMA(14), EMA(145), 1))
    DrawDot(CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Red);
    DrawLine("tag1", false, 10, 1000, 0, 1001, Color.LimeGreen, DashStyle.Solid, 1);

    When I run the indicator it works when just the drawDot line is in, when I add the drawline it does not draw the dot or the line.

    Is there a reason for this?

    Thanks

    #2
    wcmaria,

    You need to place them within { } brackets for the if-statement.

    Code:
    if (CrossAbove.....)
    {
         DrawDot(...);
         DrawLine(...);
    }
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the input.

      When I include the following code

      if (CrossAbove (EMA(14), EMA(145), 1) )
      {
      DrawDot(CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Red);
      Print((MAEnvelope(0.5,25).LowerBand[0]));
      DrawLine(CurrentBar.ToString(), false, 10, 1000, 0, 1001, Color.LimeGreen, DashStyle.Solid, 1);
      }

      it does not work (shows nothing on the screen), but when I hash out the print and drawline lines it prints the dot in the correct place.

      Comment


        #4
        It seems in my case I cannot use both the Drawdot and DrawTriangle within the same if statement. It will only work if I use one or the other.


        if (CrossAbove (EMA(14), EMA(145), 1) )
        {
        DrawDot(CurrentBar.ToString(), true, 0, High[0] + TickSize, Color.Red);
        //Print((MAEnvelope(0.5,25).LowerBand[0]));
        DrawTriangleDown(CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Red);

        }

        Is there a way to draw both a circle below and a several triangles at different prices above the same bar?

        Comment


          #5
          The reason is because you are using the exact same object name. You need to use separate names if you want two separate objects.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Try something like this:

            if (CrossAbove (EMA(14), EMA(145), 1) )
            {
            DrawDot("MyDot" + CurrentBar.ToString(), true, 0, High[0] + TickSize, Color.Red);
            //Print((MAEnvelope(0.5,25).LowerBand[0]));
            DrawTriangleDown("MyTriangle" + CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Red);

            }
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              Thanks for the responses everyone. It worked.

              Will

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Shansen, 08-30-2019, 10:18 PM
              24 responses
              942 views
              0 likes
              Last Post spwizard  
              Started by Max238, Today, 01:28 AM
              0 responses
              9 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by rocketman7, Today, 01:00 AM
              0 responses
              4 views
              0 likes
              Last Post rocketman7  
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              28 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 02-22-2024, 01:11 AM
              5 responses
              33 views
              0 likes
              Last Post wzgy0920  
              Working...
              X