lrc11239
Member
@Bobbydigital83 Is it possible to add a time to stop giving signals lets say an hour before market close(RTH)? Many thanks very nice work, I use it on /NQ - 5min.
has it been working for you? can you share your insights/success please. I'm also looking to use it on /NQ@Bobbydigital83 Is it possible to add a time to stop giving signals lets say an hour before market close(RTH)? Many thanks very nice work, I use it on /NQ - 5min.
has it been working for you? can you share your insights/success please. I'm also looking to use it on /NQ
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.@markos how to add it as a strategy. I want to backtest as well
###############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
);
#### 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);
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"));
# 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"));
@justAnotherTrader The Slim Ribbon is loaded with goodies in the User Interface.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"));
@Sneaky_Swings Welcome to useThinkscript! Please open the code and read it over.@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?
#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
She works like an absolute gem. That was so easy thank you so much@Sneaky_Swings Replace the three ExpAverage(...) line portions with HullMovingAvg(price, X_length, displace) where X is superfast, fast, and slow...
@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.She works like an absolute gem. That was so easy thank you so much
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@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.
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
Slim Miller's Long-Term Trend Trading Chart | Indicators | 9 | ||
Donchian Trend Ribbon For ThinkOrSwim | Indicators | 18 | ||
Slimmer Ribbon Indicator for ThinkorSwim | Indicators | 20 | ||
Repaints Cup and Handle Indicator for ThinkorSwim | Indicators | 23 | ||
The Ultimate Buy and Sell Indicator for ThinkOrSwim | Indicators | 5 |
Start a new thread and receive assistance from our community.
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.
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.