Download MetaTrader 5
To add comments, please log in or register
MQL5 language supports OpenCL. Try it!
Dannoo007
195
Dannoo007 2015.10.20 13: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 = "--";
honest_knave
969
honest_knave 2015.10.20 14:01  

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

OldTick=NewTick;
Dannoo007
195
Dannoo007 2015.10.20 14: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.

/
To add comments, please log in or register