Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              581 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              338 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              554 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              552 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X