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.

        https://ninjatrader.com/support/help..._rectangle.htm
        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 stafe, Today, 12:34 PM
          2 responses
          10 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by asmmbillah, Today, 11:18 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by nickse2003, Today, 09:56 AM
          1 response
          24 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Started by ATMtrader0001, Today, 10:08 AM
          5 responses
          33 views
          0 likes
          Last Post ATMtrader0001  
          Started by WHICKED, Today, 09:47 AM
          1 response
          21 views
          0 likes
          Last Post NinjaTrader_Spencer  
          Working...
          X