Investors Hangout Stock Message Boards Logo
  • Mailbox
  • Favorites
  • Boards
    • The Hangout
    • NASDAQ
    • NYSE
    • OTC Markets
    • All Boards
  • Whats Hot!
    • Recent Activity
    • Most Viewed Boards
    • Most Viewed Posts
    • Most Posted
    • Most Followed
    • Top Boards
    • Newest Boards
    • Newest Members
  • Blog
    • Recent Blog Posts
    • Recently Updated
    • News
    • Stocks
    • Crypto
    • Investing
    • Business
    • Markets
    • Economy
    • Real Estate
    • Personal Finance
  • Market Movers
  • Interactive Charts
  • Login - Join Now FREE!
  1. Home ›
  2. Stock Message Boards ›
  3. User Boards ›
  4. ThinkorSwim TA and More (TDA) Message Board

AH Warriors -------------------------------------

Message Board Public Reply | Private Reply | Keep | Replies (2)                   Post New Msg
Edit Msg () | Previous | Next


Post# of 18
Posted On: 10/11/2013 11:35:23 PM
Avatar
Posted By: spdpro
Re: spdpro #5

AH Warriors
-------------------------------------------------------------------------------

/ES /TF or 3x's

[IMG]http://i80.photobucket.com/albums/j197/spdpro/2013-10-11-TOS_CHARTSa_zpsb6e7ee26.png[/IMG]


TOS Thinkscript Lower Study
>> special Thanks to the TOS Thinkscript Lounge 

=======================================================
## 2013 Jan 30


#hint: Signals are subject to being redrawn. \n Vertical lines show how far forward the lookahead is for each oscillator. \n  Adjust nHo1 and nHo2 to change the lookahead.


declare lower;


input paintBars = {default Off, Fast, Slow};
input showLines = Yes;
input price = close;


## HOHO INPUTS
# hint nHoMA: nHoMA is mov. avg length. \n nHo1 is 1st osc. period. \n nHo2 is 2nd osc. period. \n nHoSm is smoothing length. \n Change mov. avg  types (hoType..) to speed up/ slow down oscillators.
input nHoMA = 10;
input nHo1 = 20;
input nHo2 = 50;
input nHoSm = 5;
input hoTypeMA = AverageType.EXPONENTIAL;
input hoType1 = AverageType.EXPONENTIAL;
input hoType2 = AverageType.EXPONENTIAL;
input hoTypeSM = AverageType.EXPONENTIAL;




## SQUEEZE INPUTS
# hint bbKcLength: bbKcLength is mov. avg length for \n bollinger band (BB) and keltner channel (KC). \n bbDevUp is the number of deviations for BB. \n kcFactor is the coef. for KC ATR. \n bbKcAvgType is the mov. avg type for BB and KC mid.
input bbKcLength = 20;
input bbDevUp = 2.0;
input kcFactor = 1.5;
input bbKcAvgType = AverageType.SIMPLE;


DefineGlobalColor("U0", Color.LIGHT_GRAY);
DefineGlobalColor("D0", Color.DARK_GRAY);
DefineGlobalColor("U1", Color.CYAN);
DefineGlobalColor("D1", Color.MAGENTA);
DefineGlobalColor("U2", Color.GREEN);
DefineGlobalColor("D2", Color.RED);


def sDev = StDev(price, bbKcLength);
def MA = MovingAverage(bbKcAvgType, price, bbKcLength);
def bbUB = MA + bbDevUp * sDev;
def kcUB = MA + (kcFactor * AvgTrueRange(high, close, low, bbKcLength));


def squeezed = bbUB < kcUB;


plot U1;
plot D1;


plot U2;
plot D2;


def P = ((nHoMA - 1)
* MovingAverage(hoTypeMA, price, nHoMA)[1]
+ price) / nHoMA;


def pr1 = price[(-nHo1 / 2) + 1];
def pr2 = price[(-nHo2 / 2) + 1];


def rHo1 = CompoundValue(3, if !IsNaN(pr1) then
MovingAverage(hoType1, pr1, AbsValue(nHo1))
else rHo1[1] + (rHo1[1] - rHo1[2]), price);


def rHo2 = CompoundValue(3, if !IsNaN(pr2) then
MovingAverage(hoType2, pr2, AbsValue(nHo2))
else rHo2[1] + (rHo2[1] - rHo2[2]), price);


plot Osc1 = MovingAverage(hoTypeSM, rHo1 - P, nHoSm);
Osc1.SetLineWeight(3);
Osc1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Osc1.SetDefaultColor(Color.GREEN);
Osc1.DefineColor("U2", Color.GREEN);
Osc1.DefineColor("D2", Color.RED);
Osc1.DefineColor("U4", Color.DARK_GREEN);
Osc1.DefineColor("D4", Color.DARK_RED);
Osc1.AssignValueColor(
if Osc1 > 0 then
if Osc1 > Osc1[1] then Osc1.Color("U2")
else Osc1.Color("U4")
else if Osc1 < Osc1[1] then Osc1.Color("D2") 
else Osc1.Color("D4")
);


plot Osc2 = MovingAverage(hoTypeSM, rHo2 - P, nHoSm);
Osc2.SetLineWeight(5);
Osc2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Osc2.SetDefaultColor(Color.MAGENTA);
Osc2.DefineColor("U1", Color.CYAN);
Osc2.DefineColor("D1", Color.MAGENTA);
Osc2.DefineColor("U3", Color.BLUE);
Osc2.DefineColor("D3", Color.PINK);
Osc2.AssignValueColor(
if Osc2 > 0 then
if Osc2 > Osc2[1] then Osc2.Color("U3")
else Osc2.Color("U1")
else if Osc2 < Osc2[1] then Osc2.Color("D3")
else Osc2.Color("D1")
);


plot Zero = if !IsNaN(price) then 0 else Double.NaN;
Zero.DefineColor("NotSqueezed", Color.DARK_GREEN);
Zero.DefineColor("Squeezed", Color.DARK_RED);
Zero.AssignValueColor(if squeezed then Zero.Color("Squeezed") else Zero.Color("NotSqueezed"));
Zero.SetPaintingStrategy(PaintingStrategy.POINTS);
Zero.SetLineWeight(2);


## Check if Osc1 is crossing zero.
def cr1 = if Osc1 crosses above 0 then 1
else if Osc1 crosses below 0 then -1
else 0;


## Signal up outside squeeze.
U1 = if Osc2 > 0 and cr1 > 0 and !squeezed then 0 else Double.NaN;
U1.SetDefaultColor(Color.CYAN);
U1.SetLineWeight(1);
U1.SetPaintingStrategy(PaintingStrategy.ARROW_UP);


## Signal down outside squeeze.
D1 = if Osc2 < 0 and cr1 < 0 and !squeezed then 0 else Double.NaN;
D1.SetDefaultColor(Color.MAGENTA);
D1.SetLineWeight(1);
D1.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);


## Signal up in squeeze.
U2 = if Osc2 > 0 and cr1 > 0 and squeezed then 0 else Double.NaN;
U2.SetDefaultColor(Color.UPTICK);
U2.SetLineWeight(3);
U2.SetPaintingStrategy(PaintingStrategy.ARROW_UP);


## Signal down in squeeze.
D2 = if Osc2 < 0 and cr1 < 0 and squeezed then 0 else Double.NaN;
D2.SetDefaultColor(Color.DOWNTICK);
D2.SetLineWeight(3);
D2.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);


AssignPriceColor(if paintBars == paintBars.Off then Color.CURRENT
else if paintBars == paintBars.Fast then
if Osc1 > 0 then
if Osc2 > 0 then GlobalColor("U2")
else GlobalColor("U1")
else if Osc1 < 0 then
if Osc2 < 0 then GlobalColor("D2")
else GlobalColor("D1")
else GlobalColor("U0")
else if Osc1 > 0 then GlobalColor("U2")
else if Osc1 < 0 then GlobalColor("D2")
else GlobalColor("U0") );


AddVerticalLine(showLines and IsNaN(pr1[-1]) and !IsNaN(pr1), "1", Color.PLUM, 1);


AddVerticalLine(showLines and IsNaN(pr2[-1]) and !IsNaN(pr2), "2", Color.LIME, 2);


## END STUDY







(0)
(0)








Investors Hangout

Home

Mailbox

Message Boards

Favorites

Whats Hot

Blog

Settings

Privacy Policy

Terms and Conditions

Disclaimer

Contact Us

Whats Hot

Recent Activity

Most Viewed Boards

Most Viewed Posts

Most Posted Boards

Most Followed

Top Boards

Newest Boards

Newest Members

Investors Hangout Message Boards

Welcome To Investors Hangout

Stock Message Boards

American Stock Exchange (AMEX)

NASDAQ Stock Exchange (NASDAQ)

New York Stock Exchange (NYSE)

Penny Stocks - (OTC)

User Boards

The Hangout

Private

Global Markets

Australian Securities Exchange (ASX)

Euronext Amsterdam (AMS)

Euronext Brussels (BRU)

Euronext Lisbon (LIS)

Euronext Paris (PAR)

Foreign Exchange (FOREX)

Hong Kong Stock Exchange (HKEX)

London Stock Exchange (LSE)

Milan Stock Exchange (MLSE)

New Zealand Exchange (NZX)

Singapore Stock Exchange (SGX)

Toronto Stock Exchange (TSX)

Contact Investors Hangout

Email Us

Follow Investors Hangout

Twitter

YouTube

Facebook

Market Data powered by QuoteMedia. Copyright © 2025. Data delayed 15 minutes unless otherwise indicated (view delay times for all exchanges).
Analyst Ratings & Earnings by Zacks. RT=Real-Time, EOD=End of Day, PD=Previous Day. Terms of Use.

© 2025 Copyright Investors Hangout, LLC All Rights Reserved.

Privacy Policy |Do Not Sell My Information | Terms & Conditions | Disclaimer | Help | Contact Us