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 ScottWalsh, 04-16-2024, 04:29 PM
          7 responses
          34 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cls71, Today, 04:45 AM
          0 responses
          5 views
          0 likes
          Last Post cls71
          by cls71
           
          Started by mjairg, 07-20-2023, 11:57 PM
          3 responses
          214 views
          1 like
          Last Post PaulMohn  
          Started by TheWhiteDragon, 01-21-2019, 12:44 PM
          4 responses
          547 views
          0 likes
          Last Post PaulMohn  
          Started by GLFX005, Today, 03:23 AM
          0 responses
          3 views
          0 likes
          Last Post GLFX005
          by GLFX005
           
          Working...
          X