SymbolInfoTick() doubt - page 4

 
israelhernando: with CopyTicks  how can I set a begin and end date, with the last 30 days, for example. I don't know how convert date to milliseconds.

milliseconds = 1000 * seconds!

 
I understand the function. The question is, how get the ulong milliseconds from a date. 
Convert 2021/06/03 22:30 to milliseconds

Thank you
 
israelhernando: I understand the function. The question is, how get the ulong milliseconds from a date. Convert 2021/06/03 22:30 to milliseconds
datetime dt  = D'2021.06.03 22:30:00';
ulong    msc = (ulong) dt * 1000;

 
Fernando Carreiro:

great ! Thank you
 

Hi @Fernando Carreiro


It's worked !! I've used CopyTicksRange with a little range of time and the result has been exactly what I was expecting.


Thank you very much !!

 
israelhernando: Hi @Fernando Carreiro It's worked !! I've used CopyTicksRange with a little range of time and the result has been exactly what I was expecting. Thank you very much !!

You are welcome!

 
Fernando Carreiro:

Then do as you have described:

  1. Either collect the tick data (SymbolTickInfo) in real time over a candle into an array, or copy all the tick data (CopyTicksRange) for a candle once it closes.
  2. Sort the tick data in the array by price.
  3. Group by each price and sum the volume by price grouping.
You can reverse the order of steps 2 and 3 or combine them, depending on how you go about processing the tick data volume.

    Hi @Fernando Carreiro

    I've been looking for how to group the info and sort them. The arrays let save info like this (arr[0] = 23, arr[1] = 344, arr[2] = 45 ....). 


    But I need save something like this:

    arr["1.2345"] = 34,  arr["1.2346"] = 255,  arr["1.2347"] = 469, where the indexes of every element are the prices of the candle for every tick and the value is the volume of that price.

    I don't know how use indexes in arrays, and then sort them.


    Any idea or sample code I can use?


    Thank you very much

     
    israelhernando: I've been looking for how to group the info and sort them. The arrays let save info like this (arr[0] = 23, arr[1] = 344, arr[2] = 45 ....). But I need save something like this:

    arr["1.2345"] = 34,  arr["1.2346"] = 255,  arr["1.2347"] = 469, where the indexes of every element are the prices of the candle for every tick and the value is the volume of that price. I don't know how use indexes in arrays, and then sort them. Any idea or sample code I can use?

    Ideally you would use Collection class with a Key and Value pair, but since that will probably still be too complicated for you, maybe it would be best for you to use two-dimensional arrays.

    I am not at my own computer now so I can't compile and test the code, but here is a basic outline, straight out of my head and untested, so you will have to do some research and fill in the rest:

    double TickStats[][2], GroupStats[][2];
    
    ...
    
    // Resize arrays as required.
    
    ...
    
    // Loop and assign values
    {
       TickStats[index][0] = price;
       TickStats[index][1] = volume;
    }
    
    ...
    
    ArraySort(TickStats); // Sort Array
    
    ...
    
    // Loop through the TickStats array and group values and summing the volume
    // and storing into the second array GroupStats in a similar format
     

    On second thought, ArraySort is probably not going to work in that scenario and you may need to create your own function for sorting.

    Sorry I am not able to offer more concrete solution but I am not able to do it at the moment as I have other obligations to take care of.

     

    Your idea was perfect for me. The Arraysort works fine because is sorting by the first dimension of array.


    Thank you