Count of intraday ticks
Forums › ProRealTime English forum › ProBuilder support › Count of intraday ticks
- This topic has 9 replies, 3 voices, and was last updated 3 years ago by Paul.
-
-
11/10/2016 at 5:02 PM #16330
Hi all, I am fairly new to the forum. I posted this request as reply to another post but probably the wrong place.
Do you know if there is a way in PRC of reading/counting intraday ticks? The best I could do is to build the below indicator to be applied to an (x)ticks chart. This way I can see when the number of ticks in a certain amount of time have exceeded a defined threshold (say 15 mins as in the code below). However this indicator lacks a fundamental information: direction. Any way that I can read Up and DOWN ticks from the “tick by tick” list?
Ezio
12345tick = 0if (time - time[1]) <= 1500 thenTICK = 1endifreturn TICK11/10/2016 at 6:17 PM #1633911/10/2016 at 6:37 PM #1634111/11/2016 at 2:50 PM #1638111/11/2016 at 8:18 PM #16397Hi Nicolas,
Thanks for the advice. I have now incorporated that close[0] value in the code.
The problem I am facing is that I do not know how to store the close[0] value to be able to compare it with the the previous one. In the code below DELTA is measured between latest tick and previous bar close which is not what I am shooting for.
My final objective is to create an indicator that counts UP and DOWN ticks in a given amount of time (i.e. 5, 10, 15 minutes). Any other suggestions?
1234567891011121314tickUP = 0tickDOWN = 0MyTick = Close[0]Delta = close[0] - close[1]if Delta > 0 thentickUP = tickUP + 1elsif Delta < 0 thentickDOWN = tickDOWN - 1endifreturn Delta as "Delta", close[0] as "close[0]", close as "close", tickUP as "UP", tickDOWN as "DOWN", MyTick as "MyTick"11/12/2016 at 11:49 AM #16412You can try it like this instead:
123456789101112131415once tickUP = 0once tickDOWN = 0once lastsaved = closeDelta = close - lastsavedif Delta > 0 and close<>lastsaved thentickUP = tickUP + 1lastsaved = closeelsif Delta < 0 and close<>lastsaved thentickDOWN = tickDOWN - 1lastsaved = closeendifreturn tickUP as "UP", tickDOWN as "DOWN"Market is close so I can’t test it. Next is to find a way to reset tickUP and tickDOWN on a time basis you have to define yourself .
02/27/2021 at 3:01 PM #16271403/01/2021 at 3:50 PM #16287403/01/2021 at 4:12 PM #162879array variables don’t reset, there are examples: array variables availability in ProRealTime: examples and discussions
03/01/2021 at 4:53 PM #162884I have no experience in array’s, but the code doesn’t use array’s.
It’s based on your code from 2016, just added a reset to 0 when certain priceaction appears.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364//Heikin Ashi candlestick definition according Investopedia, tested with the default values of Heiki Ashi bar values within PRTonce a1=2 //method //1-2once a2=14 //period //2-5once a3=2 //AVGtickif barindex < 1 thenHOpen = openHClose = closeHHigh = highHLow = lowelseHOpen = 0.50 * (hOpen[1]+hClose[1])HHigh = max(HOpen,max(high,Close))HLow = min(HOpen,min(low,Close))HClose = 0.25 * (Open+Close+Low+High)endifAvHA = average[a2]((HOpen+HHigh+HLow+Hclose)/4)// conditionsonce tickUP = 0once tickDOWN = 0once lastsaved = closeDelta = close - lastsavedif method=1 thenif close>highest[a2](high)[1] thentickdown=0elsif close<lowest[a2](low)[1] thentickup=0endifelsif method=2 thenif AvHA > AvHA[1] thentickdown=0elsif AvHA < AvHA[1] thentickup=0endifendifif Delta > 0 and close<>lastsaved thentickUP = tickUP + 1lastsaved = closeelsif Delta < 0 and close<>lastsaved thentickDOWN = tickDOWN - 1lastsaved = closeendiftickavg=(tickup+tickdown)/2tick2avg=average[a3](tickavg)if tick2avg > tick2avg[1] thenr = 51 //51 128g = 125 //125 128b = 79 //79 128elser = 192 //192 48g = 0 //0 84b = 0 //0 150endifRETURN tick2avg coloured(r,g,b) style(line,1) as "tick2avg" -
AuthorPosts
Find exclusive trading pro-tools on