Technical Method For Rating Stocks For ThinkOrSwim

mc01439

Well-known member
2019 Donor
VIP
I have been using this rating system as part of a longer term trading strategy on WealthLab.

Would like to use on TOS as well but TDAmeritrade did not summit the code for this Technical Analysis of Stocks & Commodities June 2018 article. Anyone like to take a shot at the code.
 
Last edited by a moderator:

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
Technical Stock Rating Labels

This TOS indicator provides labels that are colored blue and only appear when bullish conditions exist
(the blue labels on chart are the default)

GepxtdL.png


With this modified version of the indicator, the labels always appear: green colored for Bullish and Red for Bear.

Also added an additional label "score" which is defined in the TOS Technical Stock Rating Strategy.

Ruby:
# TOS TechnicalStockRating

input vfiLength = 130;
input averageLength = 100;
input trendQualityLength = 63;
input maxStiffness = 7;
input marketIndex = "SPY";
input weightForMoneyFlow = 1.0;
input weightForTradingAboveAverage = 1.0;
input weightForUptrend = 1.0;
input weightForTrendQuality = 1.0;
input weightForMarketDirection = 2.0;

def vfi = reference VolumeFlowIndicator(length = vfiLength, "max volume cut off" = 2.5);
def sma = Average(close, averageLength);
def ema = ExpAverage(close(marketIndex), averageLength);
def stiffness = Sum(close < sma, trendQualityLength);

def Score;
def MoneyFlow = vfi > 0;
def TradingAboveAverage = close > sma;
def Uptrend = sma > sma[4];
def TrendQuality = stiffness <= maxStiffness;
def MarketDirection = ema >= ema[2];

Score = weightForMoneyFlow * MoneyFlow + weightForTradingAboveAverage * TradingAboveAverage + weightForUptrend * Uptrend + weightForTrendQuality * TrendQuality + weightForMarketDirection * MarketDirection;

DefineGlobalColor("Pre_Cyan", CreateColor(50, 200, 255)) ;
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;
DefineGlobalColor("LabelRed",  CreateColor(225, 0, 0)) ;
AddLabel(yes, "Score=" +score,
         if Score> 5 then GlobalColor("Pre_Cyan") else
         if Score==5 then GlobalColor("LabelGreen") else GlobalColor("LabelRed"));
AddLabel(yes, "Money flow",
         if MoneyFlow then GlobalColor("LabelGreen") else GlobalColor("LabelRed"));
AddLabel(yes, "Trading above average",
         if TradingAboveAverage then GlobalColor("LabelGreen") else GlobalColor("LabelRed") );
AddLabel(yes, "Uptrend",
         if Uptrend then GlobalColor("LabelGreen") else GlobalColor("LabelRed"));
AddLabel(yes, "Trend quality",
         if TrendQuality then GlobalColor("LabelGreen") else GlobalColor("LabelRed"));
AddLabel(yes, "Market direction",
         if MarketDirection then GlobalColor("LabelGreen") else GlobalColor("LabelRed"));
 
Last edited:
@MerryDay You're awesome... works like a charm... now if I can only get the daily trend range problem fixed, I'll be golden. THANKS !! Wow... all my stocks are 5's and 6's... ugh... That's strong sell, right?
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
@Ronathan Edwards

As per the TOS Technical Stock Rating Strategy:
"The stock symbol receives one point for meeting each of the above criteria if all the weights are set to 1.0. By default, only the "overall market direction" weight is equal to 2.0; however, you are free to assign the weights according to your preferences.
By default, the strategy adds a simulated buy to open order if the currently selected stock receives a rating score of 5.0 or higher"


A 6 is a perfect rating. A 5 is a strong indicator
 
  • Like
Reactions: xad

kls06541

Member
VIP
Technical Stock Rating Labels

This TOS indicator provides labels that are colored blue and only appear when bullish conditions exist
(the blue labels on chart are the default)

GepxtdL.png


With this modified version of the indicator, the labels always appear: green colored for Bullish and Red for Bear.

Also added an additional label "score" which is defined in the TOS Technical Stock Rating Strategy.

Here is the study link: http://tos.mx/N2Wufe3
Can the Score be scanned, please?

How about searching for all items with Score greater than 3?
 

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
Can the Score be scanned, please?

How about searching for all items with Score greater than 3?
Add this to the bottom of the script:
Ruby:
plot scan = score > 3 ;
In the scan hacker:
Ruby:
scan is true
 
Top