Problem solved.
but I am not sure if i wrote it good or not .
//+------------------------------------------------------------------+
//| Seyed Speed Of Volume.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
input int Speed_For_Signal=1000;
datetime LastTickTime=TimeCurrent()-1;
long LastVol=-1;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
//if (Speed()==(int)Speed()){Alert("OK");}
Comment(" C 14 :"," ",Volume[14],
" C 13 :"," ",Volume[13],
" C 12 :"," ",Volume[12],
" C 11 :"," ",Volume[11],
" C 10 :"," ",Volume[10],
" C 9 :"," ",Volume[9],
" C 8 :"," ",Volume[8],
" C 7 :"," ",Volume[7],
" C 6 :"," ",Volume[6],
" C 5 :"," ",Volume[5],
" C 4 :"," ",Volume[4],
" C 3 :"," ",Volume[3],
" C 2 :"," ",Volume[2],
" C 1 :"," ",Volume[1],
"\nSpeed : ",Speed()," TPM");
if(Speed() >=Speed_For_Signal)
{
Alert("Good Speed");
}
}
//+------------------------------------------------------------------+
long Speed()
{
long Spe=0;
if(LastTickTime!=TimeCurrent())
{
long diff=(TimeCurrent()-LastTickTime);
if(diff>=1)
{
Spe=(Volume[0]-LastVol)/diff;
}
else
{
Spe = 0;
}
//--
LastTickTime=TimeCurrent();
LastVol=Volume[0];
}
return(Spe);
}
```