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

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 DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Started by alifarahani, Today, 09:40 AM
          6 responses
          41 views
          0 likes
          Last Post alifarahani  
          Working...
          X