How to calculate the time of the last two TICK (ms) and the price?

To add comments, please log in or register
wxn2014
119
wxn2014  
How to calculate the time of the last two TICK (ms) and the price?
Code2219 or probably 2319
427
Code2219 or probably 2319  
wxn2014:
How to calculate the time of the last two TICK (ms) and the price?

record the microsecond counter content, first line, inside ontick().
and compare it to it's previous value. (a static variable)

Fernando Morales
651
Fernando Morales  
wxn2014:
How to calculate the time of the last two TICK (ms) and the price?

In metatrader, a tick is defined as price change. Therefore, you don't calculate ticks. Ticks are received by the metatrader terminal so you just need to record and compare them.

Backtesting ticks are calculated and I don't know if it is possible to record them.

wxn2014
119
wxn2014  
Code2219 or probably 2319:

record the microsecond counter content, first line, inside ontick().
and compare it to it's previous value. (a static variable)

Sorry, because your English is not good, familiar with English BBS not, just see the reply today, thank you!
I have no idea about programming, ponder programming is as follows:
Void OnTick ()
{

Uint start = GetTickCount ();
OnTick ();
Print (GetTickCount () - start);

}

After printing errors: Stack overflow in. How can I solve this error? Thank you very much!

wxn2014
119
wxn2014  
Fernando Morales:

In metatrader, a tick is defined as price change. Therefore, you don't calculate ticks. Ticks are received by the metatrader terminal so you just need to record and compare them.

Backtesting ticks are calculated and I don't know if it is possible to record them.

Thank you for your reply, I am your English translation software in English translation, some translation is not so smooth. I want to see how to calculate the Posting means what is the difference between the two Tick.

wxn2014
119
wxn2014  
wxn2014:

Sorry, because your English is not good, familiar with English BBS not, just see the reply today, thank you!
I have no idea about programming, ponder programming is as follows:
Void OnTick ()
{

Uint start = GetTickCount ();
OnTick ();
Print (GetTickCount () - start);

}

After printing errors: Stack overflow in. How can I solve this error? Thank you very much!

My English is not good, translation software translation errors, please forgive me!!!!!!! ! ! ! ! ! !

wxn2014
119
wxn2014  
Code2219 or probably 2319:

record the microsecond counter content, first line, inside ontick().
and compare it to it's previous value. (a static variable)

Void OnTick ()
{


Int num = 0, I = 0;
Uint start = GetTickCount ();
For (I = num; I > 0; I --.)
OnTick ();

Print (GetTickCount () - start);

/ / print the result is 0

}

Code2219 or probably 2319
427
Code2219 or probably 2319  
wxn2014:

Sorry, because your English is not good, familiar with English BBS not, just see the reply today, thank you!
I have no idea about programming, ponder programming is as follows:
Void OnTick ()
{

Uint start = GetTickCount ();
OnTick ();
Print (GetTickCount () - start);

}

After printing errors: Stack overflow in. How can I solve this error? Thank you very much!

1. Don't call OnTick() function, from Ontick().   [ actually don't make any function call itself , because you're not so good at programming, as you mentioned.]
do something like this :
OnTick()
{
        static ulong Previous_Tick_Time = 0;
        ulong This_Tick_Time = GetMicrosecondCount();
        Print("MicroSecond deiiference between recent two ticks : ", This_Tick_Time - Previous_Tick_Time);
        Previous_Tick_Time = This_Tick_Time ;
        // rest of your code...
        // remember, 1,000,000 microseconds make one second.
}
why you need time difference between two ticks ? if you want to somehow measure the volatility of the market at the moment, there are better procedures.
wxn2014
119
wxn2014  
Code2219 or probably 2319:
1. Don't call OnTick() function, from Ontick().   [ actually don't make any function call itself , because you're not so good at programming, as you mentioned.]
do something like this :
why you need time difference between two ticks ? if you want to somehow measure the volatility of the market at the moment, there are better procedures.

Thank you, thank you very much!
I think, high-frequency smallest unit should be Tick, Tick if can find the time and space, perhaps can have the harvest!

wxn2014
119
wxn2014  
Code2219 or probably 2319:
1. Don't call OnTick() function, from Ontick().   [ actually don't make any function call itself , because you're not so good at programming, as you mentioned.]
do something like this :
why you need time difference between two ticks ? if you want to somehow measure the volatility of the market at the moment, there are better procedures.

void OnTick()
  {
       static ulong Previous_Tick_Time = 0;
        ulong This_Tick_Time = GetMicrosecondCount();
        //Print("MicroSecond deiiference between recent two ticks : ", This_Tick_Time - Previous_Tick_Time);
        Previous_Tick_Time = This_Tick_Time ;
        // rest of your code...
        // remember, 1,000,000 microseconds make one second.
        Print("MicroSecond deiiference between recent two ticks : ", This_Tick_Time - Previous_Tick_Time);
  
  }

      Code2219 or probably 2319:

                                                 Why do I put the "Print (" MicroSecond deiiference between recent two ticks:", This_Tick_Time - Previous_Tick_Time); "On the printing result is below zero? If I want to call "This_Tick_Time - Previous_Tick_Time" this value to operation, how should do?

Code2219 or probably 2319
427
Code2219 or probably 2319  
you can omit using Print() , it just shows the time difference for you to see it.
you can store the value of that time difference in a variable and use it in rest of your code.
so instead of printing the value, save it :
ulong L2TTD = This_Tick_Time - Previous_Tick_Time; // L2TTD is the variable that stores Last 2 Ticks Time Difference

I don't understand your purpose yet :)

that time difference isn't gonna show you valuable information as it can be affected by disconnections and weekends and other closed-market times.
you can work with more number of these time differences and save them in an array, and check the array average with every tick.
this way you can detect slow increases/decrease in tick retrieval speed, when they happen. ( and somehow gauge activity of the market :s )
if that's what you mean by "if can find the time and space, perhaps can have the harvest" then you better understand volume indicators.
I don't know any other good use for tick time differences.

12
To add comments, please log in or register