problems with >= not working?

 
Is anyone having a problem with the >= not working properly?

Code Example:

   while (stop <= 0 && vi > start)
   {
    if (dir > 0) Print("vi : ", vi, " : ", (get(tradesymbol, tradechart, 6, vi) - get(tradesymbol, tradechart, 6, vi + 1)) / MarketInfo(tradesymbol, MODE_POINT), " >= ", St6);
    if (dir < 0) Print("vi : ", vi, " : ", (get(tradesymbol, tradechart, 6, vi + 1) - get(tradesymbol, tradechart, 6, vi)) / MarketInfo(tradesymbol, MODE_POINT), " >= ", St6);
    
    if (dir > 0 && (get(tradesymbol, tradechart, 6, vi) - get(tradesymbol, tradechart, 6, vi + 1)) / MarketInfo(tradesymbol, MODE_POINT) >= St6) stop = 1;
    if (dir < 0 && (get(tradesymbol, tradechart, 6, vi + 1) - get(tradesymbol, tradechart, 6, vi)) / MarketInfo(tradesymbol, MODE_POINT) >= St6) stop = 1;
     
    if (dir > 0 && (get(tradesymbol, tradechart, 6, vi) - get(tradesymbol, tradechart, 6, vi + 1)) / MarketInfo(tradesymbol, MODE_POINT) < St6) vi = vi - 1;
    if (dir < 0 && (get(tradesymbol, tradechart, 6, vi + 1) - get(tradesymbol, tradechart, 6, vi)) / MarketInfo(tradesymbol, MODE_POINT) < St6) vi = vi - 1;
   } // Check for Valid Hot Spot



Here is an example of a printout from a logfile. The while statement should dump out on the second line - not the 6 line.

17:15:21 xxxxxx USDJPY,H1: vi : 11 : -1 >= 2
17:15:21 xxxxxx USDJPY,H1: vi : 10 : 2 >= 2
17:15:21 xxxxxx USDJPY,H1: vi : 9 : 1 >= 2
17:15:21 xxxxxx USDJPY,H1: vi : 8 : 1 >= 2
17:15:21 xxxxxx USDJPY,H1: vi : 7 : 1 >= 2
17:15:21 xxxxxx USDJPY,H1: vi : 6 : 3 >= 2


I made the slight modification in the following two lines, in order to remove the '=' sign from this equation. ">= St6" was changed to "> St6 -1". Now it works.

    if (dir > 0 && (get(tradesymbol, tradechart, 6, vi) - get(tradesymbol, tradechart, 6, vi + 1)) / MarketInfo(tradesymbol, MODE_POINT) > St6 - 1) stop = 1;
    if (dir < 0 && (get(tradesymbol, tradechart, 6, vi + 1) - get(tradesymbol, tradechart, 6, vi)) / MarketInfo(tradesymbol, MODE_POINT) > St6 - 1) stop = 1;



This is what was printed out afterwards in the log file:

17:51:20 xxxxxx USDJPY,H1: vi : 11 : -1 >= 2
17:51:20 xxxxxx USDJPY,H1: vi : 10 : 2 >= 2

The while statement dumped out where it was intended to, but why would I not be able to use the >= statement in this instance?



 
I found that even the code above wasn't working 100% of the time. The problem was that I needed to normalizedouble the answer before comparing to the whole number. Everythings working fine now. That might have been what was throwing off the >= operator as well.
Reason: