Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Comparing strings

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

    Comparing strings

    Hi all

    I have a case so strange. In the image below you can see the output of strategy and the problem is that I get a date in string format from an array called fecha and get the date of a bar, hten print both and they are equals but when I try to compare by if statement no work (No print "BBBBB").

    Somebody could help to me with this?

    Even 4 or 5 hours ago I got that worked but now I do not know what change I did that no work....bad day !!


    Click image for larger version

Name:	image.png
Views:	98
Size:	13.1 KB
ID:	1237499



    Regards.

    #2
    Hi again

    update the image because in the previous one string format has been changed from print to compring into if . Now both have dd/MM/yyyy format.


    Click image for larger version

Name:	image.png
Views:	91
Size:	12.8 KB
ID:	1237502

    ​Regards.

    Comment


      #3
      Hi All

      finally I have solved this. Problem was that in some moment I changed the type of file from csv to UTF-8 CSV and the string is showed equal but internally no is the same.

      I hope this help somebody in the future.

      Regards.

      Comment


        #4
        Hi J2512, you can also use the DateTime.Compare method to check equality:

        DateTime Compare() Method in C - The DateTime.Compare() method in C# is used for comparison of two DateTime instances. It returns an integer value,0 − If date1 is later than date2SyntaxFollowing is the syntax −public static int Compare (DateTime d1, DateTi
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Pabulon, Yesterday, 03:42 PM
        3 responses
        28 views
        0 likes
        Last Post Pabulon
        by Pabulon
         
        Started by giogio1, Yesterday, 03:18 AM
        2 responses
        14 views
        0 likes
        Last Post giogio1
        by giogio1
         
        Started by MikM45, Today, 03:13 AM
        0 responses
        3 views
        0 likes
        Last Post MikM45
        by MikM45
         
        Started by MikM45, Today, 03:10 AM
        0 responses
        4 views
        0 likes
        Last Post MikM45
        by MikM45
         
        Started by cls71, Today, 12:29 AM
        0 responses
        5 views
        0 likes
        Last Post cls71
        by cls71
         
        Working...
        X