I seem to recall that the comparative relative strength was a very simple calculationI looked back through the prior posts in this thread as we now need to add a proper algorithm for sorting weak/strong stocks.
First suggestion was comparative strength. I put the code from the recommended Tradestation link (https://www.tradestation.com/Discussions/Topic_Archive.aspx?Topic_ID=22476) into our #TT_RATE_WEAKSTRONG
Code:// This indicator calls a function which gives a strength rating // it then calls TT_SET_ARRAY to store this strength rating in an 'array' of // global variables inputs: avglen(30); Vars : ReturnCode(0),RelativeStrength(0), relstrengthcomp(0),avgrelstrcomp(0), INDUClose(0),normalizevalue(0); // Call a function to analyze the strength/weakness of a stock and produce a value // As $INDU is our baseline, we should store info on that in GVs // Store Close of Indu or get it if GetSymbolName = "$INDU" then begin ReturnCode = GVSetNamedFloat("TTInduClose",Close); INDUClose = Close; end else INDUClose = GVGetNamedFloat("TTInduClose",1); // if INDUClose isn't set yet - skip this. There's no guarantee $INDU will be processed first // ... or is there ??? if INDUClose <> 1 then begin if date <> date [1] or barnumber=1 or INDUClose[1] = 1 then normalizevalue = 1/(close/INDUClose); relstrengthcomp = (close/INDUClose)*normalizevalue; RelativeStrength = average(relstrengthcomp,avglen); // Now call a function to put this data away for use at trade time ReturnCode = TT_SET_ARRAY(RelativeStrength); //Plot the relative strength Plot1(RelativeStrength,"Strength"); end;
I'm not publishing the ESL for this as it didn't quite work out the way I thought it would...
Is this a case of me having the incorrect algorithm for comparative strength or is comparative strength just not a great indicator ? Should I have not included the normalised code in there ?
Also - it was mentioned that we'd only check the last 30 minutes but the N Minute change checks the whole day. Any thoughts on that ?
Should we return to some ATR type of calculation or have I done somehting dumb with comparative strength ? Just the ranges of values it returns make it hard to pick the top 4 or 5 from 50 or so stocks....
Pete
PS - I was off line when I ran this so that may be the issue here. I'll run it again when I'm on-line back at the hotel. The company firewall here blocks access to the ports that TS uses.
price of stock divided by price of $INDU - could be expressed as a percentage. Thus $INDU will always be 1 or 100%. However to make it equivalent to what we do in N min change we might also be interest in a movement over a period. So we would look at whether the stocks price had moved more or less than $INDU within a period.
To make a comparison to N min change we would have to look at the change in the comparative relative strength over over a 14 bar period for the same data compression as N min change I believe.
On the subject of the total period over which the N min change covers, the changing data compression we apply each 14 mins is designed to make the sorting of the Radar screen look back to market open, because of the constantly changing bar length.
Personally I am not entirely convinced about going back to market open, because if the volatility has altered significantly during the day, then I would have thought that it is better to limit the calculation to a more recent time period.
Charlton