TrickyBear - Range Failure signal #STRAT Inspired For ThinkOrSwim

grapetux

Member
I've charged full steam ahead at incorporating The Strat into my trading. There's zero drawback in being aware of the power of trading with full time frame continuity . Throw in some volume and market internals and I've got what I need to find the setups.

Ive written some basic code to identify the things that help me find reversals , which are all listed below.
The trickybull/bear code. Its super simple - If a high gets taken out but the candle closes bearish, thats a trap high or 'trickybear '. Conversely if a low gets taken but the candle closes green, this is a trap low or 'trickybull ' Works great on all time frames

The reason this is STRAT inspired is that the signals produced but the tricky code are the makings of the 22 reversal pattern , showing where one side of a range failed.. and that candle can now possibly become an outsidebar.

*search interwebs for Rob Smith #TheStrat for more intel

#def#
def bull = high>high[1] ;
def bear= low<low[1] ;
def insidebar = high<high[1] and low>low[1];
def equal= high<high[1] and low==low[1] or low>low[1] and high==high[1];
def outsidebar = high>high[1] and low<low[1];
def trickybear = high>high[1] and low>low[1] and close<open;
def trickybull = low<low[1] and high<high[1] and close>open;
def doubleinside = high<high[1] and low>low[1] and high[1]<high[2] and low[1]>low[2];

#REPAINT the candles to show the above definitions if you so choose, or can turn them into signals like below...##
assignpricecolor( if
doubleinside then color.plum else if
insidebar or equal then createcolor(45,75,155) else
color.current); ##

#signal for traps
input trapbull= close;
input trapbear= close;
plot trickbull= if trickybull then trapbull else double.NaN;
plot trickbear= if trickybear then trapbear else double.NaN;



GUt1hwK.png



Note - the blue line on the chart is the RTH midline, the black lines represent 1/4 of the range and the red line is the previous day POC.
Those levels are calculated using the profile high and low on TOS volume profile indy
Ive observed these all to be extremely useful levels intraday. Watch on a 15min chart , it's gorgeous .


Add the below to the TOS Volumeprofile indicator ~
#Prior Day POC Calculated
def POC1 = if IsNaN(vol.GetPointOfControl()) and cond then POC[1] else vol.GetPointOfControl();
def pPOC = CompoundValue (1, if cond then POC[1] else pPOC[1], Double.NaN);
#
plot PrevPOC = pPOC;
PrevPOC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#PrevPoc.assignValueColor(if close>PrevPOC then color.green else color.red);

##Range Midline##
def PR=profilehigh-profilelow;
#
plot middy = profilelow+(PR/2);
middy.SetDefaultColor(Color.gray);
#middy.assignValueColor(if close>middy then color.green else color.red);

##Range Quarters##
plot q1= profilehigh-(PR/4);
plot q2= profilelow+(PR/4);
q1.setDefaultColor(color.gray);
q2.setDefaultColor(color.gray);
plot e1 = q1 -(pr/8);
plot e2 = q2 +(pr/8);
e1.setDefaultColor(color.gray);
e2.setDefaultColor(color.gray);


What I've provided is not a formal strategy , just tools I use to see points of interest on the chart.
Please let me know if you've found this helpful or care to disucss
Cheers
 
Last edited:
look at a rane 12 range chart with trickys and rvol
here is rvol candle paint code
Code:
def na = Double.NaN;
def h = high ;
def l = low;
def c = close ;
def o = open ;
def v = volume;
input rvol_Type = AverageType.SIMPLE;
input RVol_length = 10 ;
input rv_min = 2.0;
def rvolpaint = yes;
def rvol_color_id = yes;
def rvpoint = no;
def AvgVol = MovingAverage(rvol_Type, v, RVol_length);
def CurrentToAvg = Round(v / AvgVol);

def rv1 = 1.6;
def rv2 = 2.0;
def rv3 = 2.6;
def rv4 = 3.0;

def rv1x = CurrentToAvg > rv1 ;
def rv2x = CurrentToAvg > rv2 ;
def rv3x = CurrentToAvg > rv3;
def rv4x = CurrentToAvg > rv4;
AssignPriceColor( if
  rvolpaint and  rv4x then Color.cyan else if
  rvolpaint and  rv3x then Color.YELLOW else if
  rvolpaint and  rv2x then Color.GREEN else if
  rvolpaint and  rv1x then Color.DARK_ORANGE  else if
   rvolpaint and c > o then color.WHITE
  else COLOR.black);
defineGlobalColor("BackGround" , (CreateColor(51,51,51)));
assignBackgroundColor( if c > o then GlobalColor("BackGround")
  else GlobalColor("BackGround"));
 
look at a rane 12 range chart with trickys and rvol
here is rvol candle paint code
Code:
def na = Double.NaN;
def h = high ;
def l = low;
def c = close ;
def o = open ;
def v = volume;
input rvol_Type = AverageType.SIMPLE;
input RVol_length = 10 ;
input rv_min = 2.0;
def rvolpaint = yes;
def rvol_color_id = yes;
def rvpoint = no;
def AvgVol = MovingAverage(rvol_Type, v, RVol_length);
def CurrentToAvg = Round(v / AvgVol);

def rv1 = 1.6;
def rv2 = 2.0;
def rv3 = 2.6;
def rv4 = 3.0;

def rv1x = CurrentToAvg > rv1 ;
def rv2x = CurrentToAvg > rv2 ;
def rv3x = CurrentToAvg > rv3;
def rv4x = CurrentToAvg > rv4;
AssignPriceColor( if
  rvolpaint and  rv4x then Color.cyan else if
  rvolpaint and  rv3x then Color.YELLOW else if
  rvolpaint and  rv2x then Color.GREEN else if
  rvolpaint and  rv1x then Color.DARK_ORANGE  else if
   rvolpaint and c > o then color.WHITE
  else COLOR.black);
defineGlobalColor("BackGround" , (CreateColor(51,51,51)));
assignBackgroundColor( if c > o then GlobalColor("BackGround")
  else GlobalColor("BackGround"));
Yo! that looks clean.
RVOL is a go to of mine as well. ill run that tmrw
Heres a nice little 5day rvol watchlist column with colors. 10/20 on there too

DSylHLt.png


def price = volume;


#5day
def volavg = (volume[1] + volume[2]+ volume[3] +volume[4] +volume[5] )/5;

#10day
def volavg1 = (volume[1] + volume[2]+ volume[3] +volume[4] +volume[5] +volume[6] +volume[7] +volume[8] +volume[9] +volume[10] )/10;

#20day
def volavg2 = (volume[1] + volume[2]+ volume[3] +volume[4] +volume[5] +volume[6] +volume[7] +volume[8] +volume[9] +volume[10] +volume[11] +volume[12] +volume[13] +volume[14] +volume[15] +volume[16] +volume[17] +volume[18] +volume[19] +volume[20] )/20;

plot rvol = price/volavg;

AssignBackgroundCOlor(if rvol>2 then color.magenta else if rvol>1 then color.gray else if rvol<1 and rvol>.5 then color.dark_gray else if rvol<=.5 then color.black else color.black);
 
Yo! that looks clean.
RVOL is a go to of mine as well. ill run that tmrw
Heres a nice little 5day rvol watchlist column with colors. 10/20 on there too

DSylHLt.png


def price = volume;


#5day
def volavg = (volume[1] + volume[2]+ volume[3] +volume[4] +volume[5] )/5;

#10day
def volavg1 = (volume[1] + volume[2]+ volume[3] +volume[4] +volume[5] +volume[6] +volume[7] +volume[8] +volume[9] +volume[10] )/10;

#20day
def volavg2 = (volume[1] + volume[2]+ volume[3] +volume[4] +volume[5] +volume[6] +volume[7] +volume[8] +volume[9] +volume[10] +volume[11] +volume[12] +volume[13] +volume[14] +volume[15] +volume[16] +volume[17] +volume[18] +volume[19] +volume[20] )/20;

plot rvol = price/volavg;

AssignBackgroundCOlor(if rvol>2 then color.magenta else if rvol>1 then color.gray else if rvol<1 and rvol>.5 then color.dark_gray else if rvol<=.5 then color.black else color.black);
turned it into a lower as well

declare lower;
def na = Double.NaN;
def h = high ;
def l = low;
def c = close ;
def o = open ;
def v = volume;
input rvol_Type = AverageType.SIMPLE;
input RVol_length = 10 ;
input rv_min = 2.0;
def rvolpaint = yes;
def rvol_color_id = yes;
def rvpoint = no;
def AvgVol = MovingAverage(rvol_Type, v, RVol_length);
def CurrentToAvg = Round(v / AvgVol);

def rv1 = 1.6;
def rv2 = 2.0;
def rv3 = 2.6;
def rv4 = 3.0;

def rv1x = CurrentToAvg > rv1 ;
def rv2x = CurrentToAvg > rv2 ;
def rv3x = CurrentToAvg > rv3;
def rv4x = CurrentToAvg > rv4;

price1.AssignvalueColor( if
rvolpaint and rv4x then Color.CYAN else if
rvolpaint and rv3x then Color.YELLOW else if
rvolpaint and rv2x then Color.GREEN else if
rvolpaint and rv1x then Color.DARK_ORANGE else if
rvolpaint and c > o then Color.WHITE
else Color.BLACK);
 
that has an error in it here is what i use


Itl0JB8.png



Code:
declare lower;
#declare zerobase;
input rvol_Type = AverageType.Simple;
INPUT RVOL_TYPE2 = AVerageType.WILDERS;
input RVol_length = 10 ;
INPUT  RVol_length2 = 50 ;

def AvgVol = MovingAverage(rvol_Type,volume, RVol_length);
def CurrentToAvg = ROUND(volume / AvgVol);
def AvgVol2 = MovingAverage(rvol_Type2,volume, RVol_length2);
def CurrentToAvg2 = ROUND(volume / AvgVol2);

DEF show_fld_arrows = yes;
def rv0 = 1.0;
DEF rv1 = 1.6;
DEF rv2 = 2.0;
DEF rv3 = 2.6;
def rv4 = 3.0;
DefineGlobalColor("rv00", (color.Dark_Gray));
DefineGlobalColor("rv0", (color.white));
DefineGlobalColor("rv1", (color.dark_orange));
DefineGlobalColor("rv2", (color.green));
DefineGlobalColor("rv3", (color.yellow));
DefineGlobalColor("rv4", (color.cyan));

plot v = volume;
v.SetPaintingStrategy(PaintingStrategy.Histogram);

v.AssignValueColor(if
    CurrentToAvg >= rv4 then (GlobalColor("rv4")) else if
    CurrentToAvg >= rv3 then (GlobalColor("rv3")) else if
    CurrentToAvg >= rv2 then (GlobalColor("rv2")) else if
    CurrentToAvg >= rv1 then (GlobalColor("rv1")) else if
    CurrentToAvg >= rv0 then (GlobalColor("rv0")) else (GlobalColor("rv00")));
V.SetLineWeight(5);

plot VolAvg0 = AvgVol;
     VolAvg0.SetDefaultColor(GlobalColor("rv0"));
     VolAvg0.SetStyle(Curve.SHORT_DASH);
#plot VolAvg2 = AvgVol*rv2;
#     VolAvg2.SetDefaultColor(GlobalColor("rv2"));
#     volAvg2.SetStyle(Curve.SHORT_DASH);
#plot VolAvg4 = AvgVol*rv4;
#     VolAvg4.SetDefaultColor(GlobalColor("rv4"));
#     volAvg4.SetStyle(Curve.SHORT_DASH);

plot VolAvg22 = AvgVol2*rv2;
     VolAvg22.AssignValueColor ( if
        CurrentToAvg2 >= rv4 then color.cyan else if
        CurrentToAvg2 >= rv3 then Color.YELLOW else if
        CurrentToAvg2 >= rv2 then Color.LIGHT_GREEN else if
        CurrentToAvg2 >= rv1 then Color.DARK_ORANGE else if
        CurrentToAvg2 >= rv0 then color.white else
        color.gray) ;

        volAvg22.SetStyle(Curve.short_DASH);
        VolAvg22.SetLineWeight(2);

ADDLabel(YES, RVol_length + "rV " +  CurrentToAvg,  if
        CurrentToAvg >= rv4 then (GlobalColor("rv4")) else if
        CurrentToAvg >= rv3 then (GlobalColor("rv3")) else if
        CurrentToAvg >= rv2 then (GlobalColor("rv2")) else if
        CurrentToAvg >= rv1 then (GlobalColor("rv1"))
        else color.light_gray) ;

ADDLabel(YES, RVol_length2 + "rV2 " +  CurrentToAvg2,if
        CurrentToAvg2 >= rv4 then (GlobalColor("rv4")) else if
        CurrentToAvg2 >= rv3 then (GlobalColor("rv3")) else if
        CurrentToAvg2 >= rv2 then (GlobalColor("rv2")) else if
        CurrentToAvg2 >= rv1 then (GlobalColor("rv1"))
        else color.light_gray) ;
 
Last edited:
that has an error in it here is what i use


Itl0JB8.png



Code:
declare lower;
#declare zerobase;
input rvol_Type = AverageType.Simple;
INPUT RVOL_TYPE2 = AVerageType.WILDERS;
input RVol_length = 10 ;
INPUT  RVol_length2 = 50 ;

def AvgVol = MovingAverage(rvol_Type,volume, RVol_length);
def CurrentToAvg = ROUND(volume / AvgVol);
def AvgVol2 = MovingAverage(rvol_Type2,volume, RVol_length2);
def CurrentToAvg2 = ROUND(volume / AvgVol2);

DEF show_fld_arrows = yes;
def rv0 = 1.0;
DEF rv1 = 1.6;
DEF rv2 = 2.0;
DEF rv3 = 2.6;
def rv4 = 3.0;
DefineGlobalColor("rv00", (color.Dark_Gray));
DefineGlobalColor("rv0", (color.white));
DefineGlobalColor("rv1", (color.dark_orange));
DefineGlobalColor("rv2", (color.green));
DefineGlobalColor("rv3", (color.yellow));
DefineGlobalColor("rv4", (color.cyan));

plot v = volume;
v.SetPaintingStrategy(PaintingStrategy.Histogram);

v.AssignValueColor(if
    CurrentToAvg >= rv4 then (GlobalColor("rv4")) else if
    CurrentToAvg >= rv3 then (GlobalColor("rv3")) else if
    CurrentToAvg >= rv2 then (GlobalColor("rv2")) else if
    CurrentToAvg >= rv1 then (GlobalColor("rv1")) else if
    CurrentToAvg >= rv0 then (GlobalColor("rv0")) else (GlobalColor("rv00")));
V.SetLineWeight(5);

plot VolAvg0 = AvgVol;
     VolAvg0.SetDefaultColor(GlobalColor("rv0"));
     VolAvg0.SetStyle(Curve.SHORT_DASH);
#plot VolAvg2 = AvgVol*rv2;
#     VolAvg2.SetDefaultColor(GlobalColor("rv2"));
#     volAvg2.SetStyle(Curve.SHORT_DASH);
#plot VolAvg4 = AvgVol*rv4;
#     VolAvg4.SetDefaultColor(GlobalColor("rv4"));
#     volAvg4.SetStyle(Curve.SHORT_DASH);

plot VolAvg22 = AvgVol2*rv2;
     VolAvg22.AssignValueColor ( if
        CurrentToAvg2 >= rv4 then color.cyan else if
        CurrentToAvg2 >= rv3 then Color.YELLOW else if
        CurrentToAvg2 >= rv2 then Color.LIGHT_GREEN else if
        CurrentToAvg2 >= rv1 then Color.DARK_ORANGE else if
        CurrentToAvg2 >= rv0 then color.white else
        color.gray) ;

        volAvg22.SetStyle(Curve.short_DASH);
        VolAvg22.SetLineWeight(2);

ADDLabel(YES, RVol_length + "rV " +  CurrentToAvg,  if
        CurrentToAvg >= rv4 then (GlobalColor("rv4")) else if
        CurrentToAvg >= rv3 then (GlobalColor("rv3")) else if
        CurrentToAvg >= rv2 then (GlobalColor("rv2")) else if
        CurrentToAvg >= rv1 then (GlobalColor("rv1"))
        else color.light_gray) ;

ADDLabel(YES, RVol_length2 + "rV2 " +  CurrentToAvg2,if
        CurrentToAvg2 >= rv4 then (GlobalColor("rv4")) else if
        CurrentToAvg2 >= rv3 then (GlobalColor("rv3")) else if
        CurrentToAvg2 >= rv2 then (GlobalColor("rv2")) else if
        CurrentToAvg2 >= rv1 then (GlobalColor("rv1"))
        else color.light_gray) ;
thanks for catching. Ill take a look. looks clean
 

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