why this code doesn't work

 

The variable "speed" should display the value of variable "ti" which is 0.00156. But it just displays some random number. Why this isn't working? any format conversion mismatch? double and inters etc? 


//+------------------------------------------------------------------+
//|                                                     trend101.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+

double speed = 0;
double ti = 0.00156;

void OnTick()
{

speed = ti;
Comment(StringFormat("Show prices\nSpeed = %d",speed));

 
}
Automated Trading and Strategy Testing
Automated Trading and Strategy Testing
  • www.mql5.com
Choose a suitable trading strategy and subscribe to it with a few clicks. All Signals are provided with detailed statistics and informative charts. Become a trading signal provider and sell subscriptions to thousands of traders around the world. With the Signals service, your successful strategy can generate income with a small start-up budget...
 
As %d is for int a double value isn't displayed - just use %f, like: %.5f
 
Or instead of hard coding precision (%0.5f) just use %s with
           question about decima of marketinfo() - MQL4 and MetaTrader 4 - MQL4 programming forum
Reason: