Registered User Joined: 3/29/2007 Posts: 19
|
I would like to scan for stocks that are moving "smoothly" i.e. you could draw a straight line and touch each candle rather than wild undulating price swings. Is there an indicator than can help my identify these stocks? How do you suggest I find them?
Thank you.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
This is an interesting definition of "smooth" to me. It is easy to visualize and I like it more than just a little bit (although I might think of it more as being a definition of "relatively straight" than of "smooth"). I do not know of a current Indicator in either TeleChart or Blocks designed to find this directly.
A symbol would need to have all of its Highs for the Period being tested above a Line connecting the Lows of the Bars starting and ending that Period. It would also need to have all of its Lows for the Period being tested below a Line connecting the Highs of the Bars starting and ending that Period. While this would eliminate many symbols, not all symbols meeting these two Conditions would be able to have a Line drawn that would touch each Bar. I'll have to think about this for a bit (I've been toying with different ideas for about an hour so far) to see if I can think of a simple way to definitively determine if this is the case.
Do you want this for TeleChart or Blocks? I'm suspecting it will be easier in Blocks, but that might depend on the simplicity of any algorithm that might eventually be used.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/29/2007 Posts: 19
|
I don't mind. I use both.
I am developing a momentum trading strategy around sector rotation. I can easily scan for popular or unpopular sectors it's just that I want to exclude sectors/stocks that have made their moves in quick or irratic steps. I'm looking for stocks that move alongside their moveing average. Does that make sense?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (BerkoBob) ...you could draw a straight line and touch each candle...
QUOTE (BerkoBob) ...stocks that move alongside their moveing average.
These are different definitions. The first definition is both definitive and objective, the second definition is neither. I can only help you create Personal Criteria Formulas, EasyScans, Indicators or Conditions if they are definitively and objectively defined. I cannot help you if the definitions are vague or subjective in nature ("I'll know it when I see it.").
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/29/2007 Posts: 19
|
OK then, how about, I don't want any gaps so the open should always be less than yesterday's high and I also don't want a day's change to ever be more than twice the average day's change. Is that possible?
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
QUOTE (BerkoBob) I'm looking for stocks that move alongside their moveing average. Does that make sense?
BerkoBob (and Bruce),
If you change your statement to:
"I'm looking for stocks that have moved alongside their linear regression line when on Logarithmic Scale."
it makes sense.
Then, the rms error for the fit of the linear regression line would likely be a suitable indicator for your purpose.
Thanks,
Jim Murphy
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
QUOTE (BerkoBob) OK then, how about, I don't want any gaps so the open should always be less than yesterday's high and I also don't want a day's change to ever be more than twice the average day's change. Is that possible?
BerkoBob,
Please look at the Symbol FX100 on Logarithmic Scale. Would you want to exclude a Stock that looked similar?
That is something like asking if you can tell which stocks you want by looking at a line chart instead of a bar chart. Can you?
Thanks.
Jim Murphy
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
BerkoBob,
QUOTE (BerkoBob) OK then, how about, I don't want any gaps so the open should always be less than yesterday's high and I also don't want a day's change to ever be more than twice the average day's change. Is that possible?
I believe the following RealCode Condition should test for this (although it also tests for Gaps Down as well as Gaps Up):
'# Period = UserInput.Integer = 10
Static Gaps As Integer
Static Avg As Single
If isFirstBar Then
Gaps = 0
Avg = 0
Else If CurrentIndex <= Period Then
Gaps -= (Price.Open > Price.High(1) _
Or Price.Open < Price.Low(1))
Avg += System.Math.Abs(Price.Close - Price.Close(1))/Period
Else
Gaps -= (Price.Open > Price.High(1) _
Or Price.Open < Price.Low(1)) - _
(Price.Open(Period) > Price.High(Period+1) _
Or Price.Open(Period) < Price.Low(Period+1))
Avg += (System.Math.Abs(Price.Close - Price.Close(1)) - _
System.Math.Abs(Price.Close(Period) - Price.Close(Period+1)))/Period
End If
If CurrentIndex >= Period Then
Dim Test As Boolean = False
For Bar As Integer = 0 To Period-1
If Price.Close - Price.Close(1) > 2 * Avg Then Test = True
Next
If Test = False And Gaps = 0 Then Pass
End If
The Period over which this must be True is adjustable via QuickEdit.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/29/2007 Posts: 19
|
QUOTE (bustermu)
the rms error for the fit of the linear regression line would likely be a suitable indicator for your purpose.
What's rms error?
|
|
Registered User Joined: 3/29/2007 Posts: 19
|
That's amazing Bruce - thank you very much.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
BerkoBob,
You're welcome. Our pleasure.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
QUOTE (BerkoBob) QUOTE (bustermu) the rms error for the fit of the linear regression line would likely be a suitable indicator for your purpose.
What's rms error?
BerkoBob,
The rms error is root-mean-square error. It is a measure of how close the closing prices are to the liner regression line. If the closes are all on a straight line, the rms error is zero. As the closes scatter farther and farther away from the straight linear regression line, the rms error gets larger and larger.
Thanks.
Jim Murphy
|
|
Registered User Joined: 4/5/2008 Posts: 173
|
Interesting idea. I solved it the "old" way. By looking at all 7000+ charts and deciding what was "smooth" - ended up with a really nice group of stocks to work from. In the past I would run my scan then get rid of the "unsmooth" results.
Ash
Now - when can I get blocks so I can try Bruce's code?
QUOTE (BerkoBob) I would like to scan for stocks that are moving "smoothly" i.e. you could draw a straight line and touch each candle rather than wild undulating price swings. Is there an indicator than can help my identify these stocks? How do you suggest I find them?
Thank you.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
OzAsh,
You should be able to get Blocks 3 now. You can order from the Pricing page. You could also contact our customer service department by telephone if you wish to discuss your options.
Our toll free sales line at (800) 776-4940 is available during business hours (Monday through Friday 9AM-9PM and Saturday and Sunday 9AM-3PM ET) The number outside of the United States is not toll free: (919) 294-1111.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 4/25/2007 Posts: 91
|
Bruce,
When I cut&paste this code in Real Code editor, I get Error: Name 'Pass' is not declared.' line:24.
Can you think of any reason for this compiler error? Please help.-- Jay
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
jayrama,
I can't say for sure what is happening, but I've only ever received that error when attempting to use RealCode for a Condition as either a RealCode Paint Brush or Real Code Indicator.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
I cut and pasted into the editor and it compiled successfully. Check the code in the editor against the code above. Something might have gotten dropped or moved around in the cut and paste process.
|
|
Registered User Joined: 4/25/2007 Posts: 91
|
Bruce and Stockguy, Yep, it was my problem, I was trying to create it as an indicator than condition. Thanks for your help...
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
jayrama,
You're welcome. Our pleasure.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
QUOTE (Bruce_L) This is an interesting definition of "smooth" to me. It is easy to visualize and I like it more than just a little bit
I'm suspecting it will be easier in Blocks, but that might depend on the simplicity of any algorithm that might eventually be used.
Bruce,
I too find this an interesting problem, but I doubt we will ever see it solved in Blocks. I say this because we will show (?) that the problem is equivalent to a Linear Program (LP) and I doubt such an algorithm is going to be put in Blocks.
We ask if there exists a straight line intersecting the most recent P price bars. This is equivalent to asking if the set of 2*P linear inequalities in the slope intercept variables a and b:
Lk <= k*a + b <= Hk, k = 0,1,...,P-1,
is consistant, i.e., has a solution. If we move all of the Highs up by a distance c where:
c >= MAXLP - MINHP
the horizontal line through MAXLP, (a, b) = (0, MAXLP), will satisfy the requirement with the new highs Hk + c, k = 0,1,...,P-1, in place.
Consider the LP in the variables (a, b, c):
Minimize:
c
Subject to:
Lk <= k*a + b <= Hk + c, k = 0,1,...,P-1
As described above, the inequalities have the solution:
(a, b, c) = (0, MAXLP, MAXLP-MINHP)
Thus, we can show that the LP has a solution. If, for the solution, min( c ) <= 0, the original set of 2*P inequalities is consistant and a required straight line exists.
Note: My recollection of LP is more than a bit rusty, so don't put too much faith in the above.
Any comments will be appreciated.
Thanks,
Jim Murphy
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
Is it possible, In TCgold, to do a scan for stocks that follow the FX100? Looking for stocks that would remain, say, within 10% (or less) hi or low of the line? It seems that the Relative Linearity Efficiency Ratio would be quite high on those stocks???
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
May I awaken an old topic of Relative Linearity? One of Stockbee's partial tutorial suggests:
Stocks do not have a perfect efficiency reading of 1. Even a small anti trend move lowers the efficiency reading. The above formula scan will give you values between 1 to -1. If you sort by this scan, the higher ratio stocks will have smoother trends, while reading between .30 to 0 will show very volatile stocks. Generally Efficiency Ratio readings above +.30 are very favorable to define persistent uptrends while readings under -.30 often denote steady downtrend.
20 Day Efficiency ratio
(C - C20) / (ABS(C - C1) + ABS(C1 - C2) + ABS(C2 - C3) + ABS(C3 - C4) + ABS(C4 - C5) + ABS(C5 - C6) + ABS(C6 - C7) + ABS(C7 - C8) + ABS(C8 - C9) + ABS(C9 - C10) + ABS(C10 - C11) + ABS(C11 - C12) + ABS(C12 - C13) + ABS(C13 - C14) + ABS(C14 - C15) + ABS(C15 - C16) + ABS(C16 - C17) + ABS(C17 - C18) + ABS(C18 - C19) + ABS(C19 - C20))
Could you create an indicator that would Show values between 1 to -1 , having lines at +.30 and -.30 as defined above?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
alindsley,
I cannot think of a practical automated method of forcing the visible range to 1 to -1 or to Plot lines an +.3 and -.3 in TeleChart (it is possible in StockFinder). The Indicator will be autoscaled or center autoscaled in TeleChart with lines at 25%, 50% and 75% of the total range.
Plotting Custom Indicators with Examples
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
I apologize Bruce. I neglected to mention I am now using SF5 more and more and would like the Indicator built for StockFinder 5. Is it possible to convert and build a 20day Efficiency Ratiio Indicator as descirbed above for SF5. If so would you provide the necessary conversion and instruction please?
Thank you
art
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
alindsley,
Except for being displayed as a percent instead of as a ratio and being autoscaled, the Efficiency Ratio in the Web Library seems to pretty much be what you want already (it already has lines at -30 and 30). You can force it to run from -100 to 100 by right-clicking ot the Value Scale, selecting Edit and adjusting the Height to Manual, 200.
You could edit the Block Diagram as well to change the Multiply by Value from 100 to 1, but if you do so, you will also need to Edit the Value Pointers that are currently at -30 and 30 to Values of -.3 and .3 instead.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
Not sure how I missed that when I was searching the library.
I believe I can make that work Bruce.
Thank you
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
alindsley,
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |