Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 11/19/2015 Posts: 459
|
Hello:
How do I draw a dot on a plot every 5 bars back for the last 100 bars, counting the current bar?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I really can't think of any automated way of doing this. About the best thing I can think if is to find the 100th bar ago and use its date (so you would need a different formula every single day).
IIF(SinceTrue(C = C'03/15/17' AND V = V'03/15/17', 100) MOD 5 = 0, 0, 1 / 0)
But you would need to have a new formula each day and even then you would get dots in the wrong places if that exact same price and volume happened on another bar. You could mitigate this to some extent by checking more things than just the close and volume, but I doubt it could be completely eliminated.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2017 Posts: 1,227
|
This isn't my wheelhouse but I noticed PCF systax includes MOD.
Maybe some kind of CountTrue formula that counts the number of bars, and plots a dot when the number of bars is evenly divisible by 5?
You can tell it's Friday afternoon. LOL.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
That is exactly what the given formula does (it even uses MOD).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2017 Posts: 1,227
|
Hah!
The good news is that I actually thought of that idea on my own, so maybe there's hope for me yet.
The bad news is that once I read you say "I really can't think of any automated way of doing this" I blew past the rest of your response and started thinking of solutions.
My bad for not reading the whole thing.
LOL.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It is really good that you thought of it on your own actually.
The reason I can't figure out a way to fully automate it is that it has to count from some arbitrary point. I can't think of a way to set the arbitrary point without using a date. And even then, there is a way to just count the number of bars since that date. So we have to check for some feature about that date to use as a reference.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2017 Posts: 1,227
|
Thanks, Bruce. I really did think of it on my own. At least the count-true-mod-5 piece.
Didn't think of using hardcoded dates ... thought you could count backwards from the current bar but apparently that's not the case.
|
|
Registered User Joined: 6/30/2017 Posts: 1,227
|
I hate when I get a thought stuck in my head ... need to learn how to meditate.
If 002 doesn't mind going back more than 100 bars, what happens if you use an old enough date to insure (ensure? LOL) that all 500 bars are covered by the formula?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You can really only cover about half the number of bars available using this method because you both have to have enough bars to calculate the formula while still having the date at the beginning of the lookback.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/30/2017 Posts: 1,227
|
I guess half of 500 bars is still more than 100. :)
Haven't heard from 002, so I'm not going to kill any more brain cells over this (not many left, LOL) ... 002 didn't mention what timeframe he uses, but if this is important and the timeframe isn't too small I guess I'd program reminders or alerts to myself to edit the date in the PCF.
Even with 2-minute bars you'd be good for a 6 1/2 hour trading day. Most traders have a daily rountine anyway - editing the PCF every morning or evening wouldn't be that big a thing.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I don't think dates are going to work all that well in intraday time frames (I certainly haven't found a way to use a time of day), but I really haven't tried this exact technique in anything besides daily.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/19/2015 Posts: 459
|
Sorry for the delay in my reply. Thank you for the help. Much appreciated.
|
|
Registered User Joined: 11/19/2015 Posts: 459
|
Sorry, just working through all the comments here. Thanks, UPB, for jumping in with ideas.
"002 didn't mention what timeframe he uses"
--Correct. What I typically do in the forums is try to ask for the most fundamental component of what I'm trying to do, then try to work with it. I have many uses for the day-back plot, but for example, I might try to use day-of-week or time-of-day sequences.
Thank you to you both for looking at the question and offering up some ideas. Much appreciated.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |