• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Logical Comparisons of BarArray and Time values Question

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

    Logical Comparisons of BarArray and Time values Question

    I want to do some logical comparisions:

    one for secondary data and one for time.

    For secondary data I wanted to do the following:

    if BarsArray[2] > upBegin then...
    // perform an action

    Before I manually edited the script I used the wizard to create the upBegin valuable which is int a constant ...i.e.
    privateint upBegin = 1000; // Default setting for UpBegin

    and also has the wizard created properties in the property section of the code.

    The BarsArray[2] data is meant to be market statistically data so seems to be integer values and I believe I have defined that correctly.

    When ever I try to do this I get CS0019 error code - not sure what I need to do to do this type of logical comparison. Is there some sort of typing I need to do?

    For a time comparison I ran into a similar error condition when doing the following:

    if (Time[0].DayOfWeek == dayOfWeek)return;

    where dayofWeek is
    privateint dayOfWeek = 5; // Default setting for DayOfWeek


    Any insight is appreciated....thanks so much

    #2
    Hello Kel108,
    If you evaluate your code as stated below then can you compile your code correctly.

    Code:
    if ((int)Time[0].DayOfWeek == dayOfWeek)return;
    I look forward to assisting you further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks Joydeep - much appreciated - that worked nicely...however when I tried the same thing with

      if (BarsArray[2] > upBegin)
      // perform an action

      I got a message that I could not perform a type conversion for ninja data. So is there a way I can make UpBegin the same datatype for easy comparison?

      Thanks in advance.

      Ed

      Comment


        #4
        Hello Ed,
        Are you trying to compare the data with the close of the 2nd secondary series? If so then please use the below code
        Code:
        if (Closes[2][0] > upBegin)
        {
           //do something
        }
        http://www.ninjatrader.com/support/h...tml?closes.htm
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Yes I was thank you so much - eventually I will get the hang of all this...but sometimes I learn in a painfully slow manor

          Comment


            #6
            Hello Ed,
            Thanks for your note.

            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Oracletrades, Yesterday, 02:56 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Bbrandon5567, Today, 04:56 PM
            1 response
            5 views
            0 likes
            Last Post Bbrandon5567  
            Started by NeverDownMoney, Today, 11:05 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by NeverDownMoney, Today, 12:19 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by pstrusi, Today, 04:30 PM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Working...
            X