Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Operator '>=' cannot be applied to operand?

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

    Operator '>=' cannot be applied to operand?

    Hello NT Support
    Can't figure out how to fix this error. Screen shot enclosed.
    Thanks
    Attached Files

    #2
    Hello thinkster,

    To better assist you could you send a me a copy of your strategy so that I can take a quick look at it.

    Send to Support[AT]NinjaTrader[DOT]Com, please attach the strategy by going to (My) Documents -> NinjaTrader 7 -> bin -> Custom -> Strategy, there you will find the name of your strategy with a '.cs' at the end.

    In the body please put: "ATTN: JC" with a link to this thread.

    Happy to be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Originally posted by thinkster View Post
      Hello NT Support
      Can't figure out how to fix this error. Screen shot enclosed.
      Thanks
      ToTime() requires a DateTime argument. Your argument is just a set of integers.

      Comment


        #4
        Thanks Kogonam
        Not sure what a 'datetime argument' is. This condition is unlocked script from the Strat. Wizard. It worked okay until code was unlocked. Sorry, new at this. Can you give an example: Just want to set when trading starts and stops.

        Comment


          #5
          Originally posted by thinkster View Post
          Thanks Kogonam
          Not sure what a 'datetime argument' is. This condition is unlocked script from the Strat. Wizard. It worked okay until code was unlocked. Sorry, new at this. Can you give an example: Just want to set when trading starts and stops.
          That depends on what you want to do. ToTime() takes a DateTime variable for argument and returns an integer. So if you wanted to use 7:00 AM as a gating time, you would write it as an integer too.

          e.g, if (ToTime(Time[0]) >= 70000) ...

          Comment


            #6
            Hello thinkster,

            Syntactically, it does not look like there is anything wrong with the statement:
            Code:
            if ( ToTime(Time[0]) >= ToTime(7,0,0)
            	&& ToTime(Time[0]) <= ToTime(16, 0 ,0)
            	&& CrossBelow(Close, Bollinger(Standev, BbPeriod).Lower, 1))
            Unless one of the variables: “Standev” or “BbPeriod” has a problem. If this code was generated from the Strategy Wizard there should be no problem with this but any custom code that was added may have an error. Sometimes compiling errors show different lines if there is an error.

            You can follow the steps in the following forum post to go through and debug your code to find the error that is causing this issue.


            I can still take a quick look at your code to see if I can point you in the right direction if you want to send in your code to me by following the steps in post 2.

            Please let me know if I can be of further assistance.
            JCNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_JC View Post
              Hello thinkster,

              Syntactically, it does not look like there is anything wrong with the statement:
              Code:
              if ( ToTime(Time[0]) >= ToTime(7,0,0)
                  && ToTime(Time[0]) <= ToTime(16, 0 ,0)
                  && CrossBelow(Close, Bollinger(Standev, BbPeriod).Lower, 1))
              Unless one of the variables: “Standev” or “BbPeriod” has a problem. If this code was generated from the Strategy Wizard there should be no problem with this but any custom code that was added may have an error. Sometimes compiling errors show different lines if there is an error.

              You can follow the steps in the following forum post to go through and debug your code to find the error that is causing this issue.


              I can still take a quick look at your code to see if I can point you in the right direction if you want to send in your code to me by following the steps in post 2.

              Please let me know if I can be of further assistance.
              Mea Culpa. I did not see the otherwise undocumented override in Intellisense. That will teach me to keep my big mouth shut!

              Comment


                #8
                We thank you for all of your help koganam. I submitted the overload to be added to our Help Guide as well for ToTime().
                JCNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                579 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
                554 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