Savage Oscillator for ThinkorSwim

@JE $$ Define slope in a way that the scanner can find it. There isn't a one-click option to find a "positive slope" or "negative slope" in the TOS scanner.
 
@JE $$As @BenTen suggested, you would need a way to tell the scanner that the values are in a slope and that would be up to your own discretion... It could be something as simple as def upSlope = if close > close[1] and close[1] > close[2] and close[2] > close[3] then 1 else Double.NaN; if that is your interpretation of a "positive slope"... This is your vision so it is up to you to determine "positive slope" and "negative slope"...
 
@JE $$ Yet another method of determining slope would be the use of the ATan() and Tan() functions... I can't help with the use of those, however, as it's been far too many decades since I studied Trigonometry...
 
@JE $$ Yet another method of determining slope would be the use of the ATan() and Tan() functions... I can't help with the use of those, however, as it's been far too many decades since I studied Trigonometry...
thanks for the input, i have to admit that while I understand the concepts, this level of code is too advanced for my skills
but the method that i wrote about above seems to give some OK results (looking for a negative bull becoming less negative)
thanks again!
 
Nice Indicator, Keep it up!

****s to see people already taking your hard work and claiming it as their own though.
 
@JE $$ Yet another method of determining slope would be the use of the ATan() and Tan() functions... I can't help with the use of those, however, as it's been far too many decades since I studied Trigonometry...
Code:
def Indicator = f();

plot f_prime = ATan((f - f[1])/1) * 180 / Double.Pi;

plot zero = 0;

if your indicator is f(x) whatever it is, you can get the slope of the function as f_prime (or Angle) if you want) with this code.

-mashume
 
Just added the savage bands to my scan criteria. I combined it with the IFT stochastic oscillator strategy you shared recently, you're an animal. Thanks!
 
Last edited:
I've been lurking around and picked up two indicators which have been helpful - one FateOwnzYou made and another is onTos already
I will post the code to each lower indicator below. Again, credit to FateOwnzYou for one of the studies - see below
I want to create a strategy in the "strategies' section on ToS but after multiple failures I thought I'd ask for help.

Strategy is this:
Buy signal when:

1) Oscillator with settings of 3 sensitivity has bull line less than negative 3.
2) IFT StochOsc (close, 3,1,80,20) crosses above 80

Sell signal
1) Oscillator bull line crosses above positive 3

Can anyone help with this?

Here are the studies:
I.

IFT_StochOsc (this is already in ToS - just need to alter settings to: close, 3, 1, 80, 20)
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2012-2021
#

declare lower;

input price = close;
input length = 30;
input slowingLength = 5;
input over_bought = 60;
input over_sold = 30;

def rainbow = reference RainbowAverage(price = price, averageType = AverageType.WEIGHTED);
plot Stochastic = sum(rainbow - Lowest(rainbow, length), slowingLength) / (sum(Highest(rainbow, length) - Lowest(rainbow, length), slowingLength) + 0.0001) * 100;

def normStochRainbow = 0.1 * (Stochastic - 50);
plot IFT = 100 / (1 + exp(-2 * normStochRainbow));
plot OverBought = over_bought;
plot OverSold = over_sold;

Stochastic.SetDefaultColor(GetColor(1));
IFT.SetDefaultColor(GetColor(2));
OverBought.setDefaultColor(GetColor(5));
OverSold.setDefaultColor(GetColor(5));


II.

Code:
#Assembled by FateOwnzYou on UseThinkscript.com
 
declare lower;
Input Price_Color = yes;
Input Sensitivity = 1;
Input Reversal_Warning_Candle = yes;
Input Reversal_Warning = 8;
Input AverageLine = yes;
Input HighVolume = yes;
Input VolumeAveragingLength = 20;
Input VolumePercentThreshold = 60;

Plot _High = 9;
Plot CautionHigh = Reversal_Warning;
Plot _Low = -9;
Plot CautionLow = (Reversal_Warning)*-1;
Plot Zero = 0;

##Stochastics
Def S1 = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S2 = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S3 = Max(-100, Min(100, reference RSI(2)) - 50) / 50.01;

Plot Bull =(expAverage((S1 + S2 + S3)/3,Sensitivity))*10;
Def SpdChng = if Bull < 1.5 then ((movingAverage(averageType.Weighted, Bull, 20))-1.5) else ((movingAverage(averageType.Weighted, Bull, 10))-1.5) ;
plot Bear = (SpdChng - Bull);
plot middle = if AverageLine then((bull - bear)/2)+bear else double.nan;

##Reversals
Plot Top = if Bull > Reversal_Warning then Bull else double.nan;
Plot Bottom = if Bull < (Reversal_Warning)*-1 then Bull else double.nan;

##High Volume
def aVol = Average(volume, volumeAveragingLength);
def pVol = 100 * ((volume - aVol[1]) /aVol[1]);
def pDot = pVol >= volumePercentThreshold;

#Paint
zero.assignValueColor(if pDot and HighVolume then color.CYAN else color.current);
zero.setlineWeight(2);
middle.setdefaultColor(color.white);
Bottom.setdefaultColor(Color.yellow);
Bottom.setPaintingStrategy(paintingStrategy.POINTS);
Bottom.setlineWeight(3);
Top.setdefaultColor(Color.yellow);
Top.setPaintingStrategy(paintingStrategy.POINTS);
Top.setlineWeight(3);
_High.setdefaultColor(color.gray);
_Low.setdefaultColor(color.gray);
Zero.setdefaultColor(color.gray);
Cautionhigh.setdefaultColor(color.gray);
Cautionlow.setdefaultColor(color.gray);
Bear.assignValueColor(color.red);
Bull.assignvalueColor(color.green);
Bear.assignValueColor(color.red);
Bull.assignvalueColor(color.green);
addLabel(yes, if Bull > Bear then "LONG BABY" else "SHORT IT", if Bull > Bear then Color.Green else color.red);
assignpriceColor(if Price_Color AND Bull > Bear then color.green else color.current);
assignpriceColor(if Price_Color AND Bull < Bear then color.red else color.current);
assignpriceColor(if Reversal_Warning_Candle AND Bull > Reversal_Warning then color.blue else color.current);
assignpriceColor(if Reversal_Warning_Candle AND Bull < (Reversal_Warning)*-1 then color.blue else color.current);
addcloud(cautionhigh,_high,color.yellow, color.yellow);
addcloud(cautionlow,_low,color.yellow, color.yellow);
 
@mr.10baggers Oh wow, very similar concept to the DMI. I've never truly looked at that indicator

lL3Zza4.png
Very compelling set. Is there any way to add a P & L report?
 
Savage Oscillator Reversals STRATEGY VERSION
This is a STRATEGY version of the upper indicator as found in post#1. IT MUST BE SAVED UNDER THE STRATEGY TAB.
It has been designed for backtesting purposes.
Caveats:
Backtesting results can be unreliable and do not guarantee similar future live trading performances.
No one indicator should be traded upon in isolation. Read more about creating best strategies --> https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-58708
GRgDcXh.png

Shared Strategy Link: http://tos.mx/nGamU2s
Click here for --> Easiest way to load shared links
Ruby:
#https://usethinkscript.com/threads/savage-oscillator.4214/
#Assembled by FateOwnzYou on UseThinkscript.com
# This is a STRATEGY version CAN ONLY BE USED WHEN LOADED IN THE STRATEGY TAB

Input Sensitivity = 1;
Input Reversal_Warning = 8;
Input AverageLine = yes;

##Stochastics
Def S1 = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S2 = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S3 = Max(-100, Min(100, reference RSI(2)) - 50) / 50.01;

def Bull =(expAverage((S1 + S2 + S3)/3,Sensitivity))*10;
Def SpdChng = if Bull < 1.5 then ((movingAverage(averageType.Weighted, Bull, 20))-1.5) else ((movingAverage(averageType.Weighted, Bull, 10))-1.5) ;
def Bear = (SpdChng - Bull);
def middle = if AverageLine then((bull - bear)/2)+bear else double.nan;

##Reversals
Plot Top = if Bull > Reversal_Warning then high else double.nan;
Plot Bottom = if Bull < (Reversal_Warning)*-1 then low else double.nan;
Bottom.setdefaultColor(Color.blue);
Bottom.setPaintingStrategy(paintingStrategy.ARROW_UP);
Bottom.setlineWeight(1);
Top.setdefaultColor(Color.magenta);
Top.setPaintingStrategy(paintingStrategy.ARROW_DOWN);
Top.setlineWeight(1);

# ########################################################
#Order Management
AddOrder(OrderType.BUY_AUTO, Bottom, tickcolor = Color.YELLOW, arrowcolor = Color.BLACK, name = "Buy", tradeSize = 100);
AddOrder(OrderType.SELL_TO_CLOSE, Top, tickcolor = Color.PINK, arrowcolor = Color.RED, name = "sell", tradeSize = 100);
# ########################################################
# ########################################################
# FPL Extended
# Author: Eddielee394
#Globals
DefineGlobalColor("LabelGreen",  CreateColor(0, 190, 0)) ;
DefineGlobalColor("LabelRed",  CreateColor(225, 0, 0)) ;
############################
#Globals
def nan = Double.NaN ;
def bn = if !IsNaN(close) and !IsNaN(close[1]) and !IsNaN(close[-1]) then BarNumber() else bn[1];
#Inputs
input fplBegin = 0000;
#hint fplBegin: start time: the time in which then dailyHighLow profit should consider the day start.  Recommended value is 0000.

input fplTargetWinLoss = .50;
#hint fplTargetWinLoss: sets the target winlossRatio (in percent) which determines display colors of the W/L label.

input fplTargetWinRate = 1;
#hint fplTargetWinRate: sets the target winRate (float) which determines display colors of the WinRate label;

input fplHidePrice = no;
#hint fplHidePrice: hide's the underlying price graph. \nDefault is no.

input fplHideFPL = yes;
#hint fplHideFPL: hide's the underlying P&L graph.\nDefault is yes.

input fplShowEntryBubbles = no;
#hint fplShowEntryBubbles: display bubbles on the FPL showing the entry and exit P&L values

input fplEnableDebugging = no;
#hint fplEnableDebugging: displays various debugging labels and chart bubbles. \nIt's recommended to hide the price chart & set the fpl hide fpl setting to yes, when enabling.

#temp input var references
def begin = fplBegin;
def targetWinLoss = fplTargetWinLoss;
def targetWinRate = fplTargetWinRate;
def hidePrice = fplHidePrice;
def hideFPL = fplHideFPL;
def showEntryBubbles = fplShowEntryBubbles;
def enableDebugging = fplEnableDebugging;

#hide chart candles
HidePricePlot(hidePrice);

#Plot default Floating P&L
plot FPL = FPL();
FPL.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
FPL.DefineColor("Positive and Up", Color.GREEN);
FPL.DefineColor("Positive and Down", Color.DARK_GREEN);
FPL.DefineColor("Negative and Down", Color.PINK);
FPL.DefineColor("Negative and Up", Color.DARK_RED);
FPL.AssignValueColor(if FPL >= 0
                            then if FPL > FPL[1]
                            then FPL.Color("Positive and Up")
                            else FPL.Color("Positive and Down")
                            else if FPL < FPL[1]
                            then FPL.Color("Negative and Down")
                            else FPL.Color("Negative and Up"));
FPL.SetHiding(hideFPL);
 
Last edited:
Savage Oscillator Reversals STRATEGY VERSION
This is a STRATEGY version of the upper indicator as found in post#1. IT MUST BE SAVED UNDER THE STRATEGY TAB.
It has been designed for backtesting purposes.
GRgDcXh.png
Based on this it shows multiple buy indicators and sell indicators but wincount shows 3 and loss shows 1. I've read through post 1 a couple times and as far as I can tell the buy indicator is right after the blue candle, or arrow in your screen shot. What am I missing?
Thanks
 
@Blaez Welcome to the Forum.
Yes, the strategy in post#133 does trigger on the Bull Reversals (blue candle)...

Copy& Paste it into your Strategy tab:
a2.png
or upload the shared link.
Play with it. It won't break. :)
 
Last edited:
Based on this it shows multiple buy indicators and sell indicators but wincount shows 3 and loss shows 1. I've read through post 1 a couple times and as far as I can tell the buy indicator is right after the blue candle, or arrow in your screen shot. What am I missing?
Thanks
@Blaez Yes, the strategy in post#133 does trigger on the Bull Reversals (blue candle)...

Copy& Paste it into your Strategy tab or upload the shared link.
Play with it. It won't break. :)
Spot On! Thank You
 
Last edited by a moderator:
I have made a Momentum Oscillator that I have tried to make it to where it gets you in an out as quickly as possible. It is basically a Bearish Line and Bullish line that will cross depending on price action.

Sensitivity: You can change Sensitivity to whatever suits your trading method. At default I have it set to 1, but ive come to realize that some prefer 3 or 4 to get a smoother line and less consolidation signals. The Higher the number, the smoother it will get, but also the more delayed it will be

Price Color: Yes or No, this will change the color of the price action to show trends. Green up, Red down

Reversal Warning Candle: This will change the color of price action of JUST the candles that are overbought or oversold on the oscillator. These indicate potential reversals. Once the blue goes away is about the time to enter

Reversal Warning: This is the setting that will change the sensitivity of the reversal signals. You will set this setting from 1 to 10. 1 being the weakest and most signals, 10 being the strongest and minimal signals. I have defaulted this to 8. I would recommend 7 to 9 depending on what you want.

Below The pictures I have the Main Script that will give you the lower oscillator, along with option of changing candle color for trends and reversals.
Then a standalone Arrow indicator that will show just the arrows for the reversals
Then I will also have a Script JUST for Candle color change.

EDIT: I have also just added a full upper version for the reversals on price action. When approaching the outer walls could be nearing a reversal.
It has the option for the high volume (as requested) and will be displayed by changing the color of the midline.
Also has multi-Timeframe capabilities with option to turn off or on if desired
(This script will be posted in the end of this Post)

V1ibpv8.png


7ndqAUr.png


OXOxTPt.png


ZjpV08q.png

XcXOtFj.png


SIPL6jk.png

Savage_Oscillator
Code:
#https://usethinkscript.com/threads/savage-oscillator.4214/
#Assembled by FateOwnzYou on UseThinkscript.com


declare lower;
Input Price_Color = yes;
Input Sensitivity = 1;
Input Reversal_Warning_Candle = yes;
Input Reversal_Warning = 8;
Input AverageLine = yes;
Input HighVolume = yes;
Input VolumeAveragingLength = 20;
Input VolumePercentThreshold = 60;

Plot _High = 9;
Plot CautionHigh = Reversal_Warning;
Plot _Low = -9;
Plot CautionLow = (Reversal_Warning)*-1;
Plot Zero = 0;

##Stochastics
Def S1 = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S2 = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S3 = Max(-100, Min(100, reference RSI(2)) - 50) / 50.01;

Plot Bull =(expAverage((S1 + S2 + S3)/3,Sensitivity))*10;
Def SpdChng = if Bull < 1.5 then ((movingAverage(averageType.Weighted, Bull, 20))-1.5) else ((movingAverage(averageType.Weighted, Bull, 10))-1.5) ;
plot Bear = (SpdChng - Bull);
plot middle = if AverageLine then((bull - bear)/2)+bear else double.nan;

##Reversals
Plot Top = if Bull > Reversal_Warning then Bull else double.nan;
Plot Bottom = if Bull < (Reversal_Warning)*-1 then Bull else double.nan;

##High Volume
def aVol = Average(volume, volumeAveragingLength);
def pVol = 100 * ((volume - aVol[1]) /aVol[1]);
def pDot = pVol >= volumePercentThreshold;

#Paint
zero.assignValueColor(if pDot and HighVolume then color.CYAN else color.current);
zero.setlineWeight(2);
middle.setdefaultColor(color.white);
Bottom.setdefaultColor(Color.yellow);
Bottom.setPaintingStrategy(paintingStrategy.POINTS);
Bottom.setlineWeight(3);
Top.setdefaultColor(Color.yellow);
Top.setPaintingStrategy(paintingStrategy.POINTS);
Top.setlineWeight(3);
_High.setdefaultColor(color.gray);
_Low.setdefaultColor(color.gray);
Zero.setdefaultColor(color.gray);
Cautionhigh.setdefaultColor(color.gray);
Cautionlow.setdefaultColor(color.gray);
Bear.assignValueColor(color.red);
Bull.assignvalueColor(color.green);
Bear.assignValueColor(color.red);
Bull.assignvalueColor(color.green);
addLabel(yes, if Bull > Bear then "Bullish" else "Bearish", if Bull > Bear then Color.Green else color.red);
assignpriceColor(if Price_Color AND Bull > Bear then color.green else color.current);
assignpriceColor(if Price_Color AND Bull < Bear then color.red else color.current);
assignpriceColor(if Reversal_Warning_Candle AND Bull > Reversal_Warning then color.blue else color.current);
assignpriceColor(if Reversal_Warning_Candle AND Bull < (Reversal_Warning)*-1 then color.blue else color.current);
addcloud(cautionhigh,_high,color.yellow, color.yellow);
addcloud(cautionlow,_low,color.yellow, color.yellow);

Savage_Oscillator_Arrows (Stand Alone Arrows)
Code:
#https://usethinkscript.com/threads/savage-oscillator.4214/
#Assembled by FateOwnzYou on UseThinkscript.com

Input Sensitivity = 1;
Input Reversal_Warning = 8;
Input Label = yes;

#Stochastics
Def S1 = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S2 = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S3 = Max(-100, Min(100, reference RSI(2)) - 50) / 50.01;

def Bull =(expAverage((S1 + S2 + S3)/3,Sensitivity))*10;
Def SpdChng = if Bull < 1.5 then ((movingAverage(averageType.Weighted, Bull, 20))-1.5) else ((movingAverage(averageType.Weighted, Bull, 10))-1.5) ;
def Bear = (SpdChng - Bull);

Plot Top = Bull > Reversal_Warning;
Plot Bottom = if Bull < (Reversal_Warning)*-1 then Bull else double.nan;

#Paint
Bottom.setdefaultColor(Color.Blue);
Bottom.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Bottom.setlineWeight(3);
Top.setdefaultColor(Color.Blue);
Top.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
Top.setlineWeight(3);
addLabel(Label, if Bull > Bear then "Bullish" else "Bearish", if Bull > Bear then Color.Green else color.red);

Savage_Oscillator_Upper (Stand Alone Candle Color Change)
Code:
#https://usethinkscript.com/threads/savage-oscillator.4214/
#Assembled by FateOwnzYou on UseThinkscript.com

input Sensitivity = 1;
Input Reversal_Warning = 8;
input Label = yes;
Input HighVolume = yes;
input volumeAveragingLength = 20;
input volumePercentThreshold = 50;

def s1 = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
def s2 = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
def s3 = Max(-100, Min(100, reference RSI(2)) - 50) / 50.01;

def Bull =expAverage((s1 + s2 + s3)/3,sensitivity)*10;
def avg = if bull < 1.5 then ((movingAverage(averageType.Weighted, bull, 20))-1.5) else ((movingAverage(averageType.Weighted, bull, 10)))-1.5 ;
def Bear = (avg - bull);

def aVol = Average(volume, volumeAveragingLength);
def pVol = 100 * ((volume - aVol[1]) /aVol[1]);
def pDot = pVol >= volumePercentThreshold;
plot volumeStrength = if pDot and (Bull or Bear) and HighVolume then hl2 else Double.NaN;

addLabel(Label, if Bull > Bear then "Bullish" else "Bearish", if Bull > Bear then Color.Green else color.red);
volumeStrength.SetPaintingStrategy(PaintingStrategy.POINTS);
volumeStrength.SetLineWeight(3);
volumeStrength.SetDefaultColor(color.cyan);
volumeStrength.hideBubble();
assignpriceColor(if Bull > Bear then color.GREEN else color.current);
assignpriceColor(if Bull < Bear then color.RED else color.current);
assignpricecolor(if Bull > Reversal_Warning then color.BLUE else color.current);
assignpricecolor(if Bull < (Reversal_Warning *-1) then color.BLUE else color.current);

Savage_Watchlist

Code:
Input Sensitivity = 1;
Input Reversal_Warning = 8;


##Stochastics
Def S1 = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S2 = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S3 = Max(-100, Min(100, reference RSI(2)) - 50) / 50.01;

def Bull =(expAverage((S1 + S2 + S3)/3,Sensitivity))*10;
Def SpdChng = if Bull < 1.5 then ((movingAverage(averageType.Weighted, Bull, 20))-1.5) else ((movingAverage(averageType.Weighted, Bull, 10))-1.5) ;
def Bear = (SpdChng - Bull);
def middle = ((bull - bear)/2)+bear;

def condition1 = Bull > Reversal_Warning;
def condition2 = Bull < (Reversal_Warning * -1);
def crossing = middle + 1;
def crossing2 = middle - 1;
def between1 = middle > crossing2 and middle < crossing;

addLabel(yes, if condition1 or condition2 then "Reversal" else concat("",Bull), if condition1 or condition2 then color.black else if bull > 1.5 then color.Light_Green else if bull < -1.5 then color.Light_Red else if between1 then color.orange else color.current);

assignbackgroundcolor(if condition1 then color.light_red else if condition2 then color.light_green else color.current);


EDIT: I have also added this MultiTimeframe Price action Savage Bands
Picture and script below
hzEEXht.png


Code:
#The Official Savage Bands
#https://usethinkscript.com/threads/savage-oscillator.4214/
#Assembled by FateOwnzYou on UseThinkscript.com

###MTF###
input Sensitivity = 1;
input Distance = 5;
input Smoothness = 7;
input MTF = yes;
input currentTF = no;
input TimeFrame = aggregationPeriod.DAY;
input HighVolume = no;
input volumeAveragingLength = 20;
input volumePercentThreshold = 50;

def S1_MTF = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL, priceh = high(period=TimeFrame), pricel = low(period=TimeFrame), pricec = close(period=TimeFrame)))) - 50) / 50.01;
def S2_MTF = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL, priceh = high(period=TimeFrame), pricel = low(period=TimeFrame), pricec = close(period=TimeFrame)))) - 50) / 50.01;
def S3_MTF = Max(-100, Min(100, reference RSI(2, price = close(period=timeframe)))- 50) / 50.01;

def savage_MTF = (ExpAverage((S1_MTF + S2_MTF + S3_MTF) / 3, Sensitivity)) * 10;

def bottom_MTF = Min(close(period=TimeFrame)[1], low(period=TimeFrame));
def tr_MTF = TrueRange(high(period=TimeFrame), close(period=TimeFrame), low(period=TimeFrame));
def ptr_MTF = tr_MTF / (bottom_MTF + tr_MTF / 2) * 100;
def APTR_MTF = (MovingAverage(AverageType.WILDERS, ptr_MTF, 14))*Distance;

def LowLine_MTF = ((0.0625*(((APTR_MTF*close(period=TimeFrame))/100)*-1))*(savage_MTF+7.75))+close(period=TimeFrame);
def HighLine_MTF = ((0.01*((APTR_MTF*close(period=TimeFrame))/100))*((-6.25*savage_MTF)+51.5625))+close(period=TimeFrame);

plot SmoothedLow_MTF = if MTF then (movingaverage(data = LowLine_MTF, averageType = AverageType.WEIGHTED, length = Smoothness)) else double.nan;
smoothedlow_MTF.setdefaultColor(color.red);
plot SmoothedHigh_MTF = if MTF then (movingaverage(data = HighLine_MTF, averageType = AverageType.WEIGHTED, length = Smoothness)) else double.nan;
smoothedhigh_MTF.setdefaultColor(color.red);

def aVol_MTF = Average(volume(period = TimeFrame), volumeAveragingLength);
def pVol_MTF = 100 * ((volume(period = TimeFrame) - aVol_MTF[1]) /aVol_MTF[1]);
def pDot_MTF = pVol_MTF >= volumePercentThreshold;
#plot volumeStrength = if pDot and HighVolume then hl2 else Double.NaN;

plot MidLine_MTF = ((SmoothedHigh_MTF - SmoothedLow_MTF)/2)+SmoothedLow_MTF;
MidLine_MTF.assignvalueColor(if pdot_MTF and HighVolume and MTF then color.yellow else color.red);

### End MTF

#Stochastics
def S1 = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL, priceh = high, pricel = low, pricec = close))) - 50) / 50.01;
def S2 = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL, priceh = high, pricel = low, pricec = close))) - 50) / 50.01;
def S3 = Max(-100, Min(100, reference RSI(2, price = close))- 50) / 50.01;

def savage = (ExpAverage((S1 + S2 + S3) / 3, Sensitivity)) * 10;

def bottom = Min(close[1], low);
def tr = TrueRange(high, close, low);
def ptr = tr / (bottom + tr / 2) * 100;
def APTR = (MovingAverage(AverageType.WILDERS, ptr, 14))*Distance;

def LowLine = ((0.0625*(((APTR*close)/100)*-1))*(savage+7.75))+close;
def HighLine = ((0.01*((APTR*close)/100))*((-6.25*savage)+51.5625))+close;

plot SmoothedLow = if CurrentTF then (movingaverage(data = LowLine, averageType = AverageType.WEIGHTED, length = Smoothness)) else double.nan;
smoothedlow.setdefaultColor(color.cyan);
plot SmoothedHigh = if CurrentTF then (movingaverage(data = HighLine, averageType = AverageType.WEIGHTED, length = Smoothness)) else double.nan;
smoothedhigh.setdefaultColor(color.cyan);

def aVol = Average(volume, volumeAveragingLength);
def pVol = 100 * ((volume - aVol[1]) /aVol[1]);
def pDot = pVol >= volumePercentThreshold;

plot MidLine = ((SmoothedHigh - SmoothedLow)/2)+SmoothedLow;
MidLine.assignvaluecolor(if pdot and HighVolume then color.yellow else color.cyan);
I'm loving the indicator, but the light green price color in the sample photos looks really helpful for a panicky trader like myself. What can I edit into the scanner in order to get that price color set up? I take it that green stands for price increase, light green stands for a pullback in price, and red stands for a more serious price decrease.
 
Hello All,
I am trying to script a Custom Column study that will flag a savage Oscillator crossover and count the number of bars since a cross over. I am also trying to color the background to be more noticeable. I have used a simular script for Moving averages crossovers and they work. I have been going round, and round with this, with no success, any suggestions.


Here is the code;


Input Price_Color = yes;
Input Sensitivity = 1;
Input Reversal_Warning_Candle = yes;
Input Reversal_Warning = 8;
Input AverageLine = yes;
Input HighVolume = yes;
Input VolumeAveragingLength = 20;
Input VolumePercentThreshold = 60;



##Stochastics
Def S1 = Max(-100, Min(100, (StochasticFull(KPeriod = 8, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S2 = Max(-100, Min(100, (StochasticFull(KPeriod = 17, slowing_period = 5, averageType = AverageType.EXPONENTIAL))) - 50) / 50.01;
Def S3 = Max(-100, Min(100, reference RSI(2)) - 50) / 50.01;

def Bull =(expAverage((S1 + S2 + S3)/3,Sensitivity))*10;
Def SpdChng = if Bull < 1.5 then ((movingAverage(averageType.Weighted, Bull, 20))-1.5) else ((movingAverage(averageType.Weighted, Bull, 10))-1.5) ;
def Bear = (SpdChng - Bull);


def BullCrossOver = Bull[1]< Bear[1] and Bull > Bear ;
def BearCrossOver = Bull[1]> Bear[1] and Bull < Bear ;

rec countAbove = if BullCrossOver then 1 else if Bull > Bear then countAbove[1] + 1 else 0;
rec countBelow = if BearCrossOver then -1 else if Bear < Bull then countBelow[1] -1 else 0;


plot data = if countAbove > AbsValue(countBelow) then countAbove else countBelow;


data.assignValueColor ( if BullCrossOver or BearCrossOver then color.BLACK else color.White );


AssignBackgroundColor(if data == 1 then Color.GREEN else if data > 1 then Color.Lime else if data == -1 then color.Red else if data < -1 then Color.Pink else Color.CURRENT);

I wanted to post a screen shot of the resulting custom column, but I guess I don't know how to do it, searched for info, but did not find any, I know it's on here some where, but I can't find it today, sorry and thanks for any insights!
 
Very interesting indicator. I like it.

If someone wanted clouds in the lower indicator you can add the following to the bottom of the script from the opening post:

Code:
# clouds
input enable_cloud = yes;
AddCloud(if enable_cloud then bull else double.nan, if enable_cloud then bear else double.nan, Color.GREEN, Color.RED);
 
Last edited by a moderator:

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
234 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