Example request - Counting Ticks

Back to topics list To post a new topic, please log in or register
avatar
15
lovromirnik 2015.02.09 20:13
 

I am currently working around some really basic stuff and I can't wrap my head around this one.


How would a simple program look that would do nothing else but count the amount of ticks recieved in a 30 second period?
I'm asking for the actual code that can be executed. I will be forever grateful.

avatar
2017
gooly 2015.02.09 20:34 #
 

Every time OnTick() is executed you have received a new tick.

But bear in mind you don't get all the ticks!

You can use Volume[] which is not the trades (money-) volume but the amount of ticks of that bar. Look in the editor's reference for Volume

avatar
12985
WHRoeder 2015.02.09 21:16 #
 
lovromirnik: I'm asking for the actual code that can be executed.
  1. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
  2. int      count = 0;
    datetime countingBegin=0
    int start(){
       datetime now = TimeCurrent()
       if( condition ) countingBegin = now; count = 0; // Begin counting
       if(now - countingBegin < 30) ++count;           // Still counting
       Print(count);                                   // current count.
    
    Was that so hard?
  3. The above does not handle missed-ticks. For that you would have to capture Volume before and after and handle new bar.
avatar
15
lovromirnik 2015.02.09 22:02 #
 
WHRoeder:
  1. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.


I am grateful. Worry not.


I have no plans on using the community as my codebase, I merely suffered from the inability to proceed any coding whatsoever beacuse of this issue and needed it resolved not via suggestions, but cold hard code that I can use. Immediately upon reading your result I've thought up of a workaround which serves me well.
Thanks again.

Back to topics list  

To add comments, please log in or register