Retrieve the number of remaining ticks ?
Forums › ProRealTime English forum › ProBuilder support › Retrieve the number of remaining ticks ?
- This topic has 4 replies, 3 voices, and was last updated 10 months ago by ground77600.
-
-
02/07/2024 at 9:27 AM #227514
Hello,
Just a quick question : is there a way to retrieve the number of remaining ticks in the current tick candle ? There is the counter indicated with the white arrow on the attached image but I don’t find a way to use it in a custom indicator ?
Do you have any suggestion on what i can do to achieve this goal ?
Sincerely.
02/07/2024 at 11:22 AM #227524By using the code from this post: https://www.prorealcode.com/topic/tick-indicator/#post-209765
I think that you will see the total amount of ticks by changing the last line to return the $ticks count:
1234567891011121314151617181920once $lastclose[0]=closeif not isset($ticks[barindex]) then$ticks[barindex] = 0$positivetick[barindex]=0$negativetick[barindex]=0endifif islastbarupdate thenif close>$lastclose[0] then$ticks[barindex]=$ticks[barindex]+1$positivetick[barindex]=$positivetick[barindex]+1else$ticks[barindex]=$ticks[barindex]-1$negativetick[barindex]=$negativetick[barindex]+1endif$lastclose[0]=closeendifreturn 0,$ticks[barindex]02/07/2024 at 12:50 PM #227544Hello Nicolas,
Thank you for your answer.
I tried to modify the code you suggested in this way :
123456789if not isset($ticks[barindex]) then$ticks[barindex]=0endifif islastbarupdate then$ticks[barindex]=$ticks[barindex]+1endifreturn $ticks[barindex]Indeed, it creates a Tick counter but I made a test on several 2000 ticks candles but it doesn’t return 2000 on each candle but 1583, 1700, 1800… Do you have any idea to have a correct result ? It seems some ticks don’t trigger the islastbarupdate function. Am I wrong ?
Sincerely.
02/07/2024 at 4:06 PM #227586Assuming it hasn’t changed too much since last time I looked into it, the ticks received and counted in any method similar to the one proposed above are not a strict match to tick by tick, therefore when in (x)ticks charts the array in a personal code won’t receive x of them per candle, because it wraps up ticks being in same timestamp as being “one” instead of multiple, whereas the platform built-in ticks counter is able to differenciate them and count all of them (that means not just 2 separate transactions that could theoretically be so close from each other they are in same timestamp, but also more frequently the case of a market order meeting more than one limit order the opposite way: probuilder code with arrays would count these as one, built-in tick-by-tick would be able to count these as being as many as amount of filled limit orders by the solo market order). So you’ll always have some “missing”, and can’t assess how many remain in your [x] ticks candles.
As far as I can assess, next batch of new coding instructions might help to get a closer count with some extra maths, but it would still be inaccurate anyway.
As per forum use guidance in yellow box at bottom of this page just before the “submit” message button, please don’t double-post, I have to delete your same request in the other 2 posts yesterday and today to keep only current topic as active. Thanks.
02/07/2024 at 6:50 PM #227607Hello,
Thank you for your detailed answer.
I fully understand. Sorry for double post.
Sincerely.
-
AuthorPosts
Find exclusive trading pro-tools on