tick up or down

Back to topics list To post a new topic, please log in or register
avatar
56
Dannoo007 2015.10.20 15:41
 

I am trying to get a simple string showing in last tick was up or down, somehow it gets stuck in "down" position. Obviously I am missing something.. so any help will be appreciated.

Dan.

//+------------------------------------------------------------------+
//|   TICK UP OR DOWN                                                |
//+------------------------------------------------------------------+    
   
   string tickMove;
   double NewTick = Bid;
   static double OldTick = Bid;
   double Move = (NewTick - OldTick);
   if (Move > 0)  tickMove = "up";
   if (Move < 0)  tickMove = "dn";
   if (Move ==0)  tickMove = "--";
avatar
736
honest_knave 2015.10.20 16:01 #
 

You never update the value of OldTick after doing your comparison.

OldTick=NewTick;

 

avatar
56
Dannoo007 2015.10.20 16:14 #
 
honest_knave:

You never update the value of OldTick after doing your comparison.

 

Correct, thanks! I moved the static at the end and had it declared in global scope.


Back to topics list  

To add comments, please log in or register