SLIM Ribbon Indicator for ThinkorSwim

20D 30Min Slim Ribbon w Multi Agg TMO & % from ATH

From today's Twitter feed I offered to share this set-up, If you like it, please click like. This is a test.

Please read all of the notes inside the studies as I have turned off the Alerts & Moving Averages...

https://tos.mx/JVdkuFi

3FoBqsG.png
 
Last edited by a moderator:
@markos how to add it as a strategy. I want to backtest as well
This may seem odd to you, but I don't backtest. I wish I could help but I don't do strategy's either. Did you watch slim miller's video as mentioned elsewhere here? Read the study, it comes complete with Arrows and Alerts galore.

Editing this Oct 1, 2020: @korygill @BenTen & @mc01439 I feel the SlimRibbon Study is worthy of a backtest. (Not the TMO) Could one of you run it through it's paces if you have time?
 
Last edited:
@markos Sure. Here's the watchlist column. For the scan I just use the study and direct the scan to the Slim Beta study and then adjust settings to what I'm interested in. But the column script should also work for the scan.

Code:
###############SLIM Column by easycators.com ####################
#Slims Trend and Momo

input price = close;

input superfast_length = 8;

input fast_length = 13;

input slow_length = 21;

input displace = 0;


def mov_avg8 = ExpAverage(price[-displace], superfast_length);

def mov_avg13 = ExpAverage(price[-displace], fast_length);

def mov_avg21 = ExpAverage(price[-displace], slow_length);


#moving averages

def Superfast = mov_avg8;

def Fast = mov_avg13;

def Slow = mov_avg21;


def buy = mov_avg8 > mov_avg13 and mov_avg13 > mov_avg21 and low > mov_avg8;

def stopbuy = mov_avg8 <= mov_avg13;

def buynow = !buy[1] and buy;

def buysignal = CompoundValue(1, if buynow and !stopbuy then 1 else if buysignal[1]==1 and stopbuy then 0 else buysignal[1], 0);


def Buy_Signal = buysignal[1] == 0 and buysignal==1;

def Momentum_Down = buysignal[1] ==1 and buysignal==0;


def sell = mov_avg8 < mov_avg13 and mov_avg13 < mov_avg21 and high < mov_avg8;

def stopsell = mov_avg8 >= mov_avg13;

def sellnow = !sell[1] and sell;

def sellsignal = CompoundValue(1, if sellnow and !stopsell then 1 else if sellsignal[1]==1 and stopsell then 0 else sellsignal[1], 0);


def Sell_Signal = sellsignal[1] ==0 and sellsignal;

def Momentum_Up = sellsignal[1]==1 and sellSignal==0;

# when using this as a custom scan, change the word plot to def
# then remove the '#' from in front of one of the "plot Scan" statements below
def Colorbars = if buysignal ==1 then 1 else if sellsignal ==1 then -1 else if buysignal ==0 or sellsignal==0 then 0 else 0;

# use this first Scan plot for SLM Ribbon Momentum UP
#plot Scan = if Colorbars == 1 then yes else no;

# use this second Scan plot for SLM Ribbon Momentum DOWN
#plot Scan = if Colorbars == -1 then yes else no;

# use this third Scan plot for SLM Ribbon Momentum FLAT
#plot Scan = if Colorbars == 0 then yes else no;

plot signal =
         if buy_signal then 4
    #else if momentum_up then 3
    #else if momentum_down then 2
    else if sell_signal then 1
    else 0;

signal.assignValueColor(
         if buy_signal then color.light_green
    else if sell_signal then color.light_red
    else if momentum_Up then color.dark_green
    else if momentum_Down then color.dark_red
    else color.black
);

assignBackgroundColor(
         if buy_signal then color.light_green
    else if sell_signal then color.light_red
    else if momentum_Up then color.DARK_GREEN
    else if momentum_Down then color.dark_red
    else color.black
);

P.S. Alot of problems now with "loading' that I didn't have before last week. This and other WL of my custom stuff has been effected. They tell me it may be due to some "adjustments" made in preparation for this weekends update.

This is another version of the SLIM watchlist column that indicates the current status of the indicator. Useful in different ways but what I have found is placing 2 or 3 columns together of different time frames its easy to spot what you might be looking for such as stocks in your watchlist that are in a long term uptrend but have paused shorter term.

Code:
#### SLIM Current Status ####
input price = close;

input superfast_length = 8;

input fast_length = 13;

input slow_length = 21;

input displace = 0;


def mov_avg8 = ExpAverage(price[-displace], superfast_length);

def mov_avg13 = ExpAverage(price[-displace], fast_length);

def mov_avg21 = ExpAverage(price[-displace], slow_length);


#moving averages

def Superfast = mov_avg8;

def Fast = mov_avg13;

def Slow = mov_avg21;


def buy = mov_avg8 > mov_avg13 and mov_avg13 > mov_avg21 and low > mov_avg8;

def stopbuy = mov_avg8 <= mov_avg13;

def buynow = !buy[1] and buy;

def buysignal = CompoundValue(1, if buynow and !stopbuy then 1 else if buysignal[1]==1 and stopbuy then 0 else buysignal[1], 0);


def Buy_Signal = buysignal[1] == 0 and buysignal==1;

def Momentum_Down = buysignal[1] ==1 and buysignal==0;


def sell = mov_avg8 < mov_avg13 and mov_avg13 < mov_avg21 and high < mov_avg8;

def stopsell = mov_avg8 >= mov_avg13;

def sellnow = !sell[1] and sell;

def sellsignal = CompoundValue(1, if sellnow and !stopsell then 1 else if sellsignal[1]==1 and stopsell then 0 else sellsignal[1], 0);


def Sell_Signal = sellsignal[1] ==0 and sellsignal;

def Momentum_Up = sellsignal[1]==1 and sellSignal==0;

# when using this as a custom scan, change the word plot to def
# then remove the '#' from in front of one of the "plot Scan" statements below
def Colorbars = if buysignal ==1 then 1 else if sellsignal ==1 then -1 else if buysignal ==0 or sellsignal==0 then 0 else 0;

# use this first Scan plot for SLM Ribbon Momentum UP
#plot Scan = if Colorbars == 1 then yes else no;

# use this second Scan plot for SLM Ribbon Momentum DOWN
#plot Scan = if Colorbars == -1 then yes else no;

# use this third Scan plot for SLM Ribbon Momentum FLAT
plot Scan = if Colorbars == 0 then yes else no;

assignBackgroundColor(if Colorbars == 1 then color.GREEN else if Colorbars == -1 then color.RED else color.YELLOW);
scan.setDefaultColor(color.black);
 
Im not sure if this is the right place to put this but I just recently started using the slim ribbon and I like it. The problem is I like to know if a candle closed red or green, so I modified the ATR trailing stop indicator to be used with this study.

Code:
input trailType = {default modified, unmodified};
input ATRPeriod = 5;
input ATRFactor = 3.5;
input firstTrade = {default long, short};
input averageType = AverageType.WILDERS;

Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);

def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
def HRef = if low <= high[1]
    then high - close[1]
    else (high - close[1]) - 0.5 * (low - high[1]);
def LRef = if high >= low[1]
    then close[1] - low
    else (close[1] - low) - 0.5 * (low[1] - high);

def trueRange;
switch (trailType) {
case modified:
    trueRange = Max(HiLo, Max(HRef, LRef));
case unmodified:
    trueRange = TrueRange(high, close, low);
}
def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod);

def state = {default init, long, short};
def trail;
switch (state[1]) {
case init:
    if (!IsNaN(loss)) {
        switch (firstTrade) {
        case long:
            state = state.long;
            trail =  close - loss;
        case short:
            state = state.short;
            trail = close + loss;
        }
    } else {
        state = state.init;
        trail = Double.NaN;
    }
case long:
    if (close > trail[1]) {
        state = state.long;
        trail = Max(trail[1], close - loss);
    } else {
        state = state.short;
        trail = close + loss;
    }
case short:
    if (close < trail[1]) {
        state = state.short;
        trail = Min(trail[1], close + loss);
    } else {
        state = state.long;
        trail =  close - loss;
    }
}

def BuySignal = Crosses(state == state.long, 0, CrossingDirection.ABOVE);
def SellSignal = Crosses(state == state.short, 0, CrossingDirection.ABOVE);

plot TrailingStop = trail;

TrailingStop.SetPaintingStrategy(PaintingStrategy.POINTS);
TrailingStop.DefineColor("Buy", Color.RED);
TrailingStop.DefineColor("Sell", Color.GREEN);
TrailingStop.AssignValueColor(if close > open and state == state.long
    then TrailingStop.Color("Sell")
    else if close > open and state == state.short
    then TrailingStop.Color("Sell")
    else TrailingStop.Color("Buy"));
 
Last edited:
@markos I was looking at your indicators and have begun to use your slim ribbon which is amazing btw.

However I am a bit confused on how your Dramatic_Line_Snip operates. Can you please help me to understand?
 
@justAnotherTrader I use this with Heiken Ashi candles

Code:
# sdi_closeLevel
plot cl = close;
cl.setpaintingStrategy(PaintingStrategy.HORIZONTAL);
#hint: plot the close level as a horizontal line with the color determined by its relationship to the heiken-ashi body. source: smalldoginvestor.com rev:1.0.0
cl.defineColor("above h-a body", color.GREEN);
cl.defineColor("inside h-a body", color.dark_gray);
# author: allen everhart
# date: 7jun2015
cl.defineColor("below h-a body", color.RED);
# copylefts reserved. This is free software. That means you are free
# to use or modify it for your own usage but not for resale.
# Help me get the word out about my blog by keeping this header
# in place.
cl.assignValueColor(
    if close>ohlc4 && heikinAshiDiff()>0 then cl.color("above h-a body")
    else if close<ohlc4 && heikinAshiDiff()<0 then cl.color("below h-a body")
# copylefts reserved. This is free software. That means you are free
# to use or modify it for your own usage but not for resale.
    else if heikinAshiDiff()<0 and close>ohlc4-heikinAshiDiff() then  cl.color("above h-a body")
    else if heikinAshiDiff()>0 and close<ohlc4-heikinAshiDiff() then cl.color("below h-a body")
    else cl.color("inside h-a body"));
 
Im not sure if this is the right place to put this but I just recently started using the slim ribbon and I like it. The problem is I like to know if a candle closed red or green, so I modified the ATR trailing stop indicator to be used with this study.

Code:
input trailType = {default modified, unmodified};
input ATRPeriod = 5;
input ATRFactor = 3.5;
input firstTrade = {default long, short};
input averageType = AverageType.WILDERS;

Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);

def HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
def HRef = if low <= high[1]
    then high - close[1]
    else (high - close[1]) - 0.5 * (low - high[1]);
def LRef = if high >= low[1]
    then close[1] - low
    else (close[1] - low) - 0.5 * (low[1] - high);

def trueRange;
switch (trailType) {
case modified:
    trueRange = Max(HiLo, Max(HRef, LRef));
case unmodified:
    trueRange = TrueRange(high, close, low);
}
def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod);

def state = {default init, long, short};
def trail;
switch (state[1]) {
case init:
    if (!IsNaN(loss)) {
        switch (firstTrade) {
        case long:
            state = state.long;
            trail =  close - loss;
        case short:
            state = state.short;
            trail = close + loss;
        }
    } else {
        state = state.init;
        trail = Double.NaN;
    }
case long:
    if (close > trail[1]) {
        state = state.long;
        trail = Max(trail[1], close - loss);
    } else {
        state = state.short;
        trail = close + loss;
    }
case short:
    if (close < trail[1]) {
        state = state.short;
        trail = Min(trail[1], close + loss);
    } else {
        state = state.long;
        trail =  close - loss;
    }
}

def BuySignal = Crosses(state == state.long, 0, CrossingDirection.ABOVE);
def SellSignal = Crosses(state == state.short, 0, CrossingDirection.ABOVE);

plot TrailingStop = trail;

TrailingStop.SetPaintingStrategy(PaintingStrategy.POINTS);
TrailingStop.DefineColor("Buy", Color.RED);
TrailingStop.DefineColor("Sell", Color.GREEN);
TrailingStop.AssignValueColor(if close > open and state == state.long
    then TrailingStop.Color("Sell")
    else if close > open and state == state.short
    then TrailingStop.Color("Sell")
    else TrailingStop.Color("Buy"));
@justAnotherTrader The Slim Ribbon is loaded with goodies in the User Interface.
Click around inside the study and you'll see a tab with the 3 colors listed.
Un-check the "plot" box. That will restore your standard candle colors. Then you'll have to rely on watching the 3 moving averages.

Otherwise, you may want to look at the study that @Moose posted just above.
It would need to be modified from HA to Candle. Good Trading!
 
Last edited:
@markos I was looking at your indicators and have begun to use your slim ribbon which is amazing btw.

However I am a bit confused on how your Dramatic_Line_Snip operates. Can you please help me to understand?
@Sneaky_Swings Welcome to useThinkscript! Please open the code and read it over.
You'll find that the Dynamic Line just marks the current price. That is all it does. Good luck.
 
I am currently using the slim ribbons indicator and I love it, however, I feel my style of trading would be better suited if the MA I was using was a bit more reactive like the ALMA or the HMA. I was wondering if someone could help me to add either the ALMA or the HMA (whichever is easiest to add) to the code below?

Code:
#start

#hint: <b>Ask SLM Ribbon</b>\nThe Ask SLM Ribbon is a momentum indicator that uses a combination of three exponential moving averages. When the averages are in alinement, with the "superfast" moving average above the "fast" moving average and the fast moving average above the "slow" moving average, the momentum condition is positive. A "buy signal" is generated, with an up arrow, when above conditions are met and a "clear bar" occurs; with the low of that bar is above all of the moving averages. The positive momentum ends if the superfast moving average touches the fast moving average; then condition is considered neutral and an oppostive arrow will appear. Negative momentum and a "Sell signal" are the opposite of the bullish conditions. \n \n\n--------------------------------------------------------------------------------\nVolume bars can be colored to match the Chart by clicking on Style>Settings>Appearance>Common, and color symbol as ticks  \n



input price = close;

input superfast_length = 8;

input fast_length = 13;

input slow_length = 21;

input displace = 0;



def mov_avg8 = ExpAverage(price[-displace], superfast_length);

def mov_avg13 = ExpAverage(price[-displace], fast_length);

def mov_avg21 = ExpAverage(price[-displace], slow_length);



#moving averages

Plot Superfast = mov_avg8;

plot Fast = mov_avg13;

plot Slow = mov_avg21;



def buy = mov_avg8 > mov_avg13 and mov_avg13 > mov_avg21 and low > mov_avg8;

def stopbuy = mov_avg8 <= mov_avg13;

def buynow = !buy[1] and buy;

def buysignal = CompoundValue(1, if buynow and !stopbuy then 1 else if buysignal[1]==1 and stopbuy then 0 else buysignal[1], 0);



plot Buy_Signal = buysignal[1] == 0 and buysignal==1;

Buy_signal.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

Buy_signal.setdefaultColor(color.dark_GREEN);

Buy_signal.hidetitle();

#Alert(condition = buysignal[1] == 0 and buysignal == 1, text = "Buy Signal", sound = Sound.Bell, "alert type" = Alert.BAR);



plot Momentum_Down = buysignal[1] ==1 and buysignal==0;

Momentum_down.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

Momentum_Down.setdefaultColor(color.plum);

Momentum_down.hidetitle();

#Alert(condition = buysignal[1] == 1 and buysignal == 0, text = "Momentum_Down", sound = Sound.Bell, "alert type" = Alert.BAR);



def sell = mov_avg8 < mov_avg13 and mov_avg13 < mov_avg21 and high < mov_avg8;

def stopsell = mov_avg8 >= mov_avg13;

def sellnow = !sell[1] and sell;

def sellsignal = CompoundValue(1, if sellnow and !stopsell then 1 else if sellsignal[1]==1 and stopsell then 0 else sellsignal[1], 0);



Plot Sell_Signal = sellsignal[1] ==0 and sellsignal;

Sell_signal.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);

sell_signal.setDefaultColor(color.red);

Sell_signal.hidetitle();

#Alert(condition = sellsignal[1] == 0 and sellsignal == 1, text = "Sell Signal", sound = Sound.Bell, "alert type" = Alert.BAR);



Plot Momentum_Up = sellsignal[1]==1 and sellSignal==0;

Momentum_up.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_up);

Momentum_up.setDefaultColor(color.plum);

Momentum_up.hidetitle();

#Alert(condition = sellsignal[1] == 1 and sellSignal == 0, text = "Momentum_Up", sound = Sound.Bell, "alert type" = Alert.BAR);



plot Colorbars = if buysignal ==1 then 1 else if sellsignal ==1 then 2 else if buysignal ==0 or sellsignal==0 then 3 else 0;

colorbars.hide();

Colorbars.definecolor("Buy_Signal_Bars", color.dark_green);

Colorbars.definecolor("Sell_Signal_Bars", color.red);

Colorbars.definecolor("Neutral", color.plum);



AssignPriceColor(if Colorbars ==1 then colorbars.color("buy_signal_bars") else if colorbars ==2 then colorbars.color("Sell_Signal_bars") else  colorbars.color("neutral"));

#end
 
@Sneaky_Swings do yourself a big favor and visit Alan Hull's website. You may find that HMA is not the best use here. Let us what he thinks of crossing HMA's.
I visited the website thank you for the advice! I am sticking to the classic slim ribbons you shared except I am using 5/8/13 for mine

Something I'm wondering if it could be possible is to color the bars so they change color if the momentum is up but the price goes down. A variation of this can be found in GrAB candles and I am working on integrating a similar color scheme to the slim ribbon to decipher more clearly exit points based on momentum rather than just price. Please let me know if you have any ideas for what I can do to get the candles to color like this or if you already have something that can do this.

Another idea I had was to add in another MA and have that be kind of like the final color change so basically in this form of the idea I am thinking have the candles be a different color for each MA crossover that occurs. (ex: orange 5 over 8 / red 8/13 dark red 13/21.

Let me know of any input or what you think would be best!
 
I'm looking to make a candle stick pattern that goes green when the price is above the EMA 8, 21, and 34 are stacked on top of each other and red when they are reversed stacked and price is below but I also wanted the candles to go yellow if prices is below the EMAs but they are stacked 8,21,34 or above and reversed stacked 34,21,8. Sort of mimicking this:

u3ipcK9.png
 
@ace_wheelie This really isn't the right topic for your request... Have you searched for multi-MA studies here in the forums...??? There are several topics which have been active in recent days...
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
308 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top