Hello everyone, it’s been a while since I haven’t written here but today I have to propose something that could be useful for everyone.
I want to make an indicator that says hourly intraday seasonality, throughout the week. Like Larry Williams’, I attach the image.
Do you believe it is possible to create something like this?
This is only really a practical proposition in v11 where we now have arrays. It could be done in v10.3 but would involve an awful lot of repetitive coding and would be quite slow to draw I believe.
At the moment I only have end of day data in v11 so I can’t help with anything on hourly charts on there at the moment and I’m not sure that I want to get involved in a massively repetitive v10.3 code right now!
Here is an example of how it could be done in v10.3. I’ll let you fill in the remaining 1160 odd lines of code and then error check it! It would just be a few lines of code in v11 with arrays.
defparam drawonlastbaronly = true
if openhour = 1 and opendayofweek = 1 then
h1d1 = h1d1 + (close - open)
h1d1count = h1d1count + 1
h1d1avg = h1d1/h1d1count
endif
if openhour = 2 and opendayofweek = 1 then
h2d1 = h2d1 + (close - open)
h2d1count = h2d1count + 1
h2d1avg = h2d1/h2d1count
endif
//...and repeat another 166 times
drawsegment(barindex-169,0,barindex-168,0+h1d1avg)
lastvalue = 0+h1d1avg
drawsegment(barindex-168,lastvalue,barindex-167,lastvalue+h2d1avg)
lastvalue = lastvalue+h2d1avg
drawsegment(barindex-167,lastvalue,barindex-166,lastvalue+h3d1avg)
lastvalue = lastvalue+h3d1avg
//....and repeat another 165 times
return
Just to let you know that I got a bit bored so I have started working on the indicator. I have got it working and debugged on the first two days of the week (image attached) and so now it should be a simple find and replace exercise to complete the code and then add some labelling to the axis. I’ve got to do something else now so I will try to complete it later or tomorrow.
If you really can do it you’re the best 🙂
Thank you very much.
I would find the indicator very helpful. Finally, there are some things I could try out.
I’ll keep looking for it.
I found time to finish it. It works on v10.3 but is slow to calculate so be patient!
Just an ITF file attached as the code is 2405 lines long so I did not want to post the code.
You can set a start date if you want to only analyse more recent data. Set it to zero to analyse all data.
Apply it on the 1 hour chart only.
Feedback welcome before I submit it to the library.
Sorry Vonasi, with what program can I open the itf file?
Save it on your hard drive and then import it into your PRT platform via the indicator window.
Hello again, vonasi.
I am fan of this work here with the seasonal curve of the week. I use it a lot. Some small programs I have written based on this curve.
Further up in the thread you wrote “Here is an example of how it could be done in v10.3. I’ll let you fill in the remaining 1160 odd lines of code and then check for errors! It would be just a few lines of code in v11 with arrays.”
I was going to ask you, ask if you could write the few lines in v11. That way we would have a match to see if the curve from v10.3 matches the curve from v11.
Could you do that for us?
Sorry JohnScher but I’m having some time off from coding and moderating at the moment.
Thank you for the feedback.
Ive written this one and will get back to you when i come back from holidays