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 sjsj2732, Yesterday, 04:31 AM
          0 responses
          35 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          286 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          286 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          133 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          91 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X