Keltner on lower study???I've created one for the upper chart but I've not figured out how to use Keltner in a lower study as its calculations are price based.
Put squeeze into searchIm sure it already exists, Im having a hard time finding an indicator that uses the Bollinger and Keltner channels and Momentum indicator? Suggestions?
ttm squeezeIm sure it already exists, Im having a hard time finding an indicator that uses the Bollinger and Keltner channels and Momentum indicator? Suggestions?
I don't believe I've posted any of my Bollinger/Keltner/squeeze scripts here.Keltner on lower study???
Have you posted the one you created here?
(Off topic were you on/in Boiler Room youtibe chat cpl days ago?)
EXACTLY!! It kinda matters to see that and whether its over the zero line or not!! The oscillator is quite misleading!In the past I've super imposed a simple momentum indicator over ttm squeeze.
BTW, what's your handle on BRT?
How's the oscillator misleading? I've been using the ttm squeeze quite successfully so I don't see what the issue is.EXACTLY!! It kinda matters to see that and whether its over the zero line or not!! The oscillator is quite misleading!
My screen is a mess as I put together this strategy Im working on... Yes guys, I know price action and volume but sometimes that fakes you out thus why Im doing what Im doing and why others use indicators! That said lets jump ahead, is there a way to have an indicator only paint when certain conditions occur?
(My handle is same as here! I dont comment too much bc Im busy working up charts. I watch him for tips on possible runners that dont come up on my scanner and as verification of what I have)
Would you mind sharing which momentum indicator you added to it?Bc you dont know if momentum is over or below zero line.. Ive been using it but have been sitting on my hands many times waiting for it to fire in bc you dont know which way its going to go sometimes (after long consolidation) until after it fires, which also means Ive missed out on some great runs! Throw the momentum line on there, super impose it (you can drag it into same Lower box TTM is in) and make the zeroline visible.
WHLM is my reminder (up until 48/hrs ago after watching one of Carters vids) to wait for it to fire, bc see that black line($8.45) most ppl would put their entry right over that, where some more than likely got filled when price peek-a-booed over. Ive seen some ppl posting vids on YT saying they actually buy when TMM bars are light blue in the squeeze too! Yes, some might wait and put their orders in at 8.51 too, but we're all looking for that bottom of a move. Well in this example those ppl who had entries at 8.46 or lower all got burned at 12:26pm!
Now I went back added the momentum to it and duh its def going down. But you don't know that, living in the moment.
I think the entire TTM oscillator should move up and down over that zeroline, or you do what I and Tidan have done and add the momentum indicator over the TTM.
So original end goal of this thread I started was to create an alert or indicator... to complement the TTM but I guess Ill just work with what I got
This is a script I wrote based on RSI- its the best momentum indicator Ive found that shines in short term (day) trading futures, but also useful with day charts. Hint: watch the rsi crossover of the center line and exits of the colored regions. You might try using the ATR TrailStop (10, 1.75) instead of keltner/BB.Im sure it already exists, Im having a hard time finding an indicator that uses the Bollinger and Keltner channels and Momentum indicator? Suggestions?
declare lower;
input audioalert = yes;
input length = 3;
input over_Bought = 75;
input over_Sold = 25;
input price = hlc3;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;
#Calculate 3-bar RSI
def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot mid = 50;
mid.SetLineWeight(1);
mid.setDefaultColor(createcolor(150,50,0));
plot RSI = 50 * (ChgRatio + 1);
def OverSold = over_Sold;
def OverBought = over_Bought;
#plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
#plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;
plot UpSignal = if RSI crosses above mid then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below mid then OverBought else Double.NaN;
RSI.SetDefaultColor(Color.GRAY);
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
UpSignal.SetDefaultColor(Color.blue);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upSignal.setLineWeight(3);
DownSignal.SetDefaultColor(Color.dark_red);
downSignal.setLineWeight(3);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
AddCloud(RSI, OverBought, Color.BLUE, Color.LIGHT_GRAY);
AddCloud(OverSold, RSI, Color.DARK_RED, Color.LIGHT_GRAY);
AddCloud(RSI, OverBought, Color.BLUE, Color.LIGHT_GRAY);
AddCloud(OverSold, RSI, Color.dark_RED, Color.LIGHT_GRAY);
#ALERTS
alert(audioalert and rsi crosses overbought, "",alert.bar, sound.ding);
alert(audioalert and rsi crosses oversold, "",alert.bar, sound.ding);
alert(audioalert and rsi crosses mid, "",alert.BAR, sound.chimes);
TOS factory one, just says "Momentum" and nothing else, and thats per John Carter who came up with the TTMWould you mind sharing which momentum indicator you added to it?
# Ultimate ATR Combo
# Investing to Give
declare upper;
input averageType = AverageType.EXPONENTIAL;
# Fast ATR TS
input trailType = {default modified, unmodified};
input ATRPeriod = 10;
input ATRFactor = 3.0;
input firstTrade = {default long, short};
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);
def Buy_Zone = state == state.long;
def Sell_Zone = state == state.short;
# plot Buy = Buy_Zone[1] == 0 and Buy_Zone;
# plot Sell = Sell_Zone[1] == 0 and Sell_Zone;
plot TrailingStop = trail;
TrailingStop.SetPaintingStrategy(PaintingStrategy.Line);
TrailingStop.DefineColor("Buy", GetColor(5));
TrailingStop.DefineColor("Sell", GetColor(6));
TrailingStop.SetLineWeight(3);
TrailingStop.AssignValueColor(if state == state.long
then TrailingStop.Color("Sell")
else TrailingStop.Color("Buy"));
# Slow ATR TS
input trailType_Slow = {default modified_Slow, unmodified_Slow};
input ATRPeriod_Slow = 30;
input ATRFactor_Slow = 10.0;
input firstTrade_Slow = {default long_Slow, short_Slow};
Assert(ATRFactor_Slow > 0, "'atr factor' must be positive: " + ATRFactor_Slow);
def HiLo_Slow = Min(high - low, 1.5 * Average(high - low, ATRPeriod_Slow));
def HRef_Slow = if low <= high[1]
then high - close[1]
else (high - close[1]) - 0.5 * (low - high[1]);
def LRef_Slow = if high >= low[1]
then close[1] - low
else (close[1] - low) - 0.5 * (low[1] - high);
def trueRange_Slow;
switch (trailType_Slow) {
case modified_Slow:
trueRange_Slow = Max(HiLo_Slow, Max(HRef_Slow, LRef_Slow));
case unmodified_Slow:
trueRange_Slow = TrueRange(high, close, low);
}
def loss_Slow = ATRFactor_Slow * MovingAverage(averageType, trueRange_Slow, ATRPeriod_Slow);
def state_Slow = {default init_Slow, long_Slow, short_Slow};
def trail_Slow;
switch (state_Slow[1]) {
case init_Slow:
if (!IsNaN(loss_Slow)) {
switch (firstTrade_Slow) {
case long_Slow:
state_Slow = state_Slow.long_Slow;
trail_Slow = close - loss_Slow;
case short_Slow:
state_Slow = state_Slow.short_Slow;
trail_Slow = close + loss_Slow;
}
} else {
state_Slow = state_Slow.init_Slow;
trail_Slow = Double.NaN;
}
case long_Slow:
if (close > trail_Slow[1]) {
state_Slow = state_Slow.long_Slow;
trail_Slow = Max(trail_Slow[1], close - loss_Slow);
} else {
state_Slow = state_Slow.short_Slow;
trail_Slow = close + loss_Slow;
}
case short_Slow:
if (close < trail_Slow[1]) {
state_Slow = state_Slow.short_Slow;
trail_Slow = Min(trail_Slow[1], close + loss_Slow);
} else {
state_Slow = state_Slow.long_Slow;
trail_Slow = close - loss_Slow;
}
}
def BuySignal_Slow = Crosses(state_Slow == state_Slow.long_Slow, 0, CrossingDirection.ABOVE);
def SellSignal_Slow = Crosses(state_Slow == state_Slow.short_Slow, 0, CrossingDirection.ABOVE);
def Buy_Zone_Slow = state_Slow == state_Slow.long_Slow;
def Sell_Zone_Slow = state_Slow == state_Slow.short_Slow;
plot TrailingStop_Slow = trail_Slow;
TrailingStop_Slow.SetPaintingStrategy(PaintingStrategy.Line);
TrailingStop_Slow.DefineColor("Buy", GetColor(5));
TrailingStop_Slow.DefineColor("Sell", GetColor(6));
TrailingStop_Slow.SetLineWeight(3);
TrailingStop_Slow.AssignValueColor(if state_Slow == state_Slow.long_Slow
then TrailingStop_Slow.Color("Sell")
else TrailingStop_Slow.Color("Buy"));
def Buy = Buy_Zone and Buy_Zone_Slow;
def Sell = Sell_Zone and Sell_Zone_Slow;
AssignPriceColor (if Buy then Color.GREEN else if Sell then Color.RED else Color.YELLOW);
# End
I like it. I use the atrts a little differently in this study. It colors an extended price line that I use to moderate my faster indicators. I did keep a setting option to show the atrts line when desired, but normally keep it hidden. See what you think...@ rtry9a Thanks for your code. I use something very similar with 2 ATR's with values 10,3 & 30,9. I find the 10,3 vs 10, 1.75 holds me in trades a little longer, but I do like the 1.75 for shorter trades.
Here is my code that colors the bars.
Ruby:# Ultimate ATR Combo # Investing to Give declare upper; input averageType = AverageType.EXPONENTIAL; # Fast ATR TS input trailType = {default modified, unmodified}; input ATRPeriod = 10; input ATRFactor = 3.0; input firstTrade = {default long, short}; 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); def Buy_Zone = state == state.long; def Sell_Zone = state == state.short; # plot Buy = Buy_Zone[1] == 0 and Buy_Zone; # plot Sell = Sell_Zone[1] == 0 and Sell_Zone; plot TrailingStop = trail; TrailingStop.SetPaintingStrategy(PaintingStrategy.Line); TrailingStop.DefineColor("Buy", GetColor(5)); TrailingStop.DefineColor("Sell", GetColor(6)); TrailingStop.SetLineWeight(3); TrailingStop.AssignValueColor(if state == state.long then TrailingStop.Color("Sell") else TrailingStop.Color("Buy")); # Slow ATR TS input trailType_Slow = {default modified_Slow, unmodified_Slow}; input ATRPeriod_Slow = 30; input ATRFactor_Slow = 10.0; input firstTrade_Slow = {default long_Slow, short_Slow}; Assert(ATRFactor_Slow > 0, "'atr factor' must be positive: " + ATRFactor_Slow); def HiLo_Slow = Min(high - low, 1.5 * Average(high - low, ATRPeriod_Slow)); def HRef_Slow = if low <= high[1] then high - close[1] else (high - close[1]) - 0.5 * (low - high[1]); def LRef_Slow = if high >= low[1] then close[1] - low else (close[1] - low) - 0.5 * (low[1] - high); def trueRange_Slow; switch (trailType_Slow) { case modified_Slow: trueRange_Slow = Max(HiLo_Slow, Max(HRef_Slow, LRef_Slow)); case unmodified_Slow: trueRange_Slow = TrueRange(high, close, low); } def loss_Slow = ATRFactor_Slow * MovingAverage(averageType, trueRange_Slow, ATRPeriod_Slow); def state_Slow = {default init_Slow, long_Slow, short_Slow}; def trail_Slow; switch (state_Slow[1]) { case init_Slow: if (!IsNaN(loss_Slow)) { switch (firstTrade_Slow) { case long_Slow: state_Slow = state_Slow.long_Slow; trail_Slow = close - loss_Slow; case short_Slow: state_Slow = state_Slow.short_Slow; trail_Slow = close + loss_Slow; } } else { state_Slow = state_Slow.init_Slow; trail_Slow = Double.NaN; } case long_Slow: if (close > trail_Slow[1]) { state_Slow = state_Slow.long_Slow; trail_Slow = Max(trail_Slow[1], close - loss_Slow); } else { state_Slow = state_Slow.short_Slow; trail_Slow = close + loss_Slow; } case short_Slow: if (close < trail_Slow[1]) { state_Slow = state_Slow.short_Slow; trail_Slow = Min(trail_Slow[1], close + loss_Slow); } else { state_Slow = state_Slow.long_Slow; trail_Slow = close - loss_Slow; } } def BuySignal_Slow = Crosses(state_Slow == state_Slow.long_Slow, 0, CrossingDirection.ABOVE); def SellSignal_Slow = Crosses(state_Slow == state_Slow.short_Slow, 0, CrossingDirection.ABOVE); def Buy_Zone_Slow = state_Slow == state_Slow.long_Slow; def Sell_Zone_Slow = state_Slow == state_Slow.short_Slow; plot TrailingStop_Slow = trail_Slow; TrailingStop_Slow.SetPaintingStrategy(PaintingStrategy.Line); TrailingStop_Slow.DefineColor("Buy", GetColor(5)); TrailingStop_Slow.DefineColor("Sell", GetColor(6)); TrailingStop_Slow.SetLineWeight(3); TrailingStop_Slow.AssignValueColor(if state_Slow == state_Slow.long_Slow then TrailingStop_Slow.Color("Sell") else TrailingStop_Slow.Color("Buy")); def Buy = Buy_Zone and Buy_Zone_Slow; def Sell = Sell_Zone and Sell_Zone_Slow; AssignPriceColor (if Buy then Color.GREEN else if Sell then Color.RED else Color.YELLOW); # End
#Plots a Horizontal Line that follows the price value selected
input price = close;
input length = 90;
input ATRPeriod = 10;
input ATRFactor = 1.75;
input showAtrTSLine = no;
def sma = SimpleMovingAvg(price, 1, length);
def averageType = AverageType.WILDERS;
#ATR TrailingStop Stop
input trailType = {default modified, unmodified};
input firstTrade = {default long, short};
#addLabel(yes,"AtrTS="+atrperiod+", "+atrfactor,createcolor(150,100,0));
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 ts = trail;
plot tsl = if showAtrTSLine then ts else Double.NaN;
tsl.DefineColor("down", CreateColor(200, 0, 0));
tsl.DefineColor("up", CreateColor(0, 00, 100));
tsl.AssignValueColor(if hl2 >= ts then tsl.Color("up") else tsl.Color("down"));#tsl.SetDefaultColor(Color.BLACK);
tsl.SetLineWeight(3);
tsl.setStyle(curve.short_DASH);
#Priceline
rec line = if IsNaN(sma) then line[1] else sma;
plot priceline = if IsNaN(sma) then line else Double.NaN;
priceline.DefineColor("down", CreateColor(200, 0, 0));
priceline.DefineColor("up", CreateColor(0, 00, 75));
priceline.AssignValueColor(if hl2 >= ts then priceline.Color("up") else priceline.Color("down"));
priceline.SetLineWeight(2);
priceline.SetPaintingStrategy(PaintingStrategy.LINE_VS_squares);
http://tos.mx/cNO3irL my tos trading chart share linkThat horizontal line is pretty cool. Thanks for sharing that. What other indicators do you combine with that ?
# Percentage Price Oscillator
declare lower;
input EMAShortLength = 8;
input EMALongLength = 21;
input PPOMALength = 13;
input BBDevs = 2.0;
input BBLength = 20.0;
input KCFactor = 1.5;
input KCLength = 20;
def UBBLine = reference BollingerBands(close, 0, BBLength, BBDevs).upper_band;
def UKLine = KeltnerChannels(0, KCFactor, KCLength, close).Upper_Band;
def InSqueeze = UBBLine <= UKLine;
def OutSqueeze = UBBLine > UKLine;
def PPOSigLine = (ExpAverage(close, EMAShortLength) - ExpAverage(close, EMALongLength)) / ExpAverage(close, EMALongLength);
def PPOSigLineMA = ExpAverage(PPOSigLine, PPOMALength);
def PPOMAHist = PPOSigLine - PPOSigLineMA;
def PPOMAHist1 = (PPOMAHist > 0 and PPOMAHist[0] > PPOMAHist[1]);
def PPOMAHist2 = (PPOMAHist > 0 and PPOMAHist[0] <= PPOMAHist[1]);
def PPOMAHist3 = (PPOMAHist <= 0 and PPOMAHist[0] < PPOMAHist[1]);
def PPOMAHist4 = (PPOMAHist <= 0 and PPOMAHist[0] >= PPOMAHist[1]);
plot ShortPPOSigLine = PPOSigLine;
ShortPPOSigLine.SetDefaultColor(GetColor(0));
plot LongPPOSigLine = PPOSigLineMA;
LongPPOSigLine.SetDefaultColor(GetColor(1));
plot PPOHist1 = if PPOMAHist1 then PPOMAHist else Double.NaN;
plot PPOHist2 = if PPOMAHist2 then PPOMAHist else Double.NaN;
plot PPOHist3 = if PPOMAHist3 then PPOMAHist else Double.NaN;
plot PPOHist4 = if PPOMAHist4 then PPOMAHist else Double.NaN;
PPOHist1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
PPOHist1.SetDefaultColor(Color.CYAN);
PPOHist1.SetLineWeight(2);
PPOHist2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
PPOHist2.SetDefaultColor(Color.BLUE);
PPOHist2.SetLineWeight(2);
PPOHist3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
PPOHist3.SetDefaultColor(Color.RED);
PPOHist3.SetLineWeight(2);
PPOHist4.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
PPOHist4.SetDefaultColor(Color.YELLOW);
PPOHist4.SetLineWeight(2);
plot GrnDot = if OutSqueeze then 0 else Double.NaN;
plot RedDot = if InSqueeze then 0 else Double.NaN;
GrnDot.SetPaintingStrategy(PaintingStrategy.POINTS);
GrnDot.SetStyle(Curve.POINTS);
GrnDot.SetDefaultColor(Color.GREEN);
GrnDot.SetLineWeight(3);
RedDot.SetPaintingStrategy(PaintingStrategy.POINTS);
RedDot.SetStyle(Curve.POINTS);
RedDot.SetDefaultColor(Color.RED);
RedDot.SetLineWeight(3);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
J | Gap between Keltner Channels/Bollinger Bands in scanner | Questions | 8 | |
A | Bollinger bands inside keltner channels candles | Questions | 7 | |
A | Keltner channel/ Bollinger Band Cloud | Questions | 19 | |
M | Bollinger Band Watchlist | Questions | 4 | |
J | Independently plot Bollinger Bands and Moving Averages in the same code | Questions | 1 |