Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Rectangle Issues (Int vs DateTime)

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

    Draw.Rectangle Issues (Int vs DateTime)

    NinjaTrader 8.0.0.12

    Hey guys having trouble coding this.

    Argument 4 & 6 are saying that it cannot convert System.DateTime to Int. But there are two ways this can be read with 10 arguments first is using 'int startBarsAgo & endBarsAgo' and the second is the way I want it read using 'DateTime startTime & endTime'. It seems to only default to the first.

    ARG 1 Draw.Rectangle(TSR,
    ARG 2 string.Concat(item.ToString(), " Resist"),
    ARG 3 false,
    ARG 4 Times[1][CurrentBar - CurrentHighPoint + resistDefinition],
    ARG 5 HighDrawPoint,
    ARG 6 Times[1][CurrentBar - CurrentHighPoint - resistDefinition],
    ARG 7 Highclose,
    ARG 8 resistColor,
    ARG 9 resistColor,
    ARG 10 resistOpacity);

    Added this to easily copy paste from your self -
    CurrentResist = Draw.Rectangle(TSR, string.Concat(item.ToString(), " Resist"), false, Times[1][CurrentBar - CurrentHighPoint + resistDefinition], HighDrawPoint, Times[1][CurrentBar - CurrentHighPoint - resistDefinition], Highclose, resistColor, resistColor, resistOpacity);


    Thanks,
    Rokz
    Last edited by IIIRokzIII; 07-28-2016, 06:51 PM.

    #2
    Hello IIIRokzIII,

    Thank you for writing in and welcome to the NinjaTrader Support Forum.

    Can you please provide your script so I may test it on my end? Simply copying and pasting the syntax you have provided would not compile on my end as I do not know the types of your variables that you are using or their values.

    You can find your script within (My) Documents\NinjaTrader 8\bin\Custom\Indicators if it is an indicator or (My) Documents\NinjaTrader 8\bin\Custom\Strategies if it is a strategy.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Hey mate thanks for the reply I have attached a completely ripped apart code that only shows you the broken piece.

      The problem part is in OnBarUpdate() where it attempts to Draw.Rectangle. For me it's not using the correct argument line. It even states that it doesn't match and it wants integers instead.

      Thanks,
      Rokz
      Attached Files

      Comment


        #4
        Hello IIIRokzIII,

        Thank you for providing that indicator.

        You will simply want to change the first parameter of your Draw.Rectangle() from RokzIndi to this.

        Example:

        Code:
        Draw.Rectangle(this, ......);
        The reason for the compile error is not because of the other parameters, but because you were attempting to just pass in the RokzIndi class rather than an object.

        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          OMG I <3 you, cannot believe I missed that. Embarrassing but thankful. Ill hit you up if I have more issues haha.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          577 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X