Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help on DrawRectangle, can't get code with fill or opacity to compile

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

    Help on DrawRectangle, can't get code with fill or opacity to compile

    Hi,

    Can someone take a look at this line of code and let me know what's wrong.

    I can get the rectangle to draw but when I add parameters to change fill to red and opacity to '2', the code does not compile.

    This works:
    DrawRectangle("My rectangle" + CurrentBar, 0, EMA(13)[0], -3, EMA(13)[0] + RectangleHeight * TickSize, Color.Red);

    But when I add parameters as per DrawRectangle syntax for red areaColor and 2 areaOpacity, it does not compile
    DrawRectangle("My rectangle" + CurrentBar, 0, EMA(13)[0], -3, EMA(13)[0] + RectangleHeight * TickSize, Color.Red, Color.Red, 2);

    The compile error returned is "No overload for method "DrawRectangle" takes 8 arguments."

    Thanks in advance.

    #2
    Hello VLott,

    Thanks for your post.

    If you are going to use the opacity you will also need to specify the autoscale bool.

    For example:
    DrawRectangle("My rectangle" + CurrentBar, true, 0, EMA(13)[0], -3, EMA(13)[0] + RectangleHeight * TickSize, Color.Red, Color.Red, 2);

    DrawRectangle(string tag, bool autoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color, Color areaColor, int areaOpacity)
    http://www.ninjatrader.com/support/h...wrectangle.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Excellent. Thanks for the fast response. Worked like a charm,

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      134 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      75 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      119 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      114 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      90 views
      0 likes
      Last Post CarlTrading  
      Working...
      X