Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

Fun with ThinkScript

Posted by robert 
Re: Fun with ThinkScript
September 05, 2016 02:54AM
Ralph53, you can just add that script for checking the condition:

#All except current
def condition1 = if !isnan(close) and !isnan(close[-1]) then 1 else 0;

#Only current candle
def condition2 = if !isnan(close) and isnan(close[-1]) then 1 else 0;

Thinkorswim Coder
Thinkorswim Accounts with onDemand function - PM me
Re: Fun with ThinkScript
September 05, 2016 01:56PM
Thank you very much.
Re: How to get Thinkorswim TOS Realtime Account + onDemand functionthumbs up
September 06, 2016 09:09AM
I wasn't saying anything about viruses or what, but you just did.

Why would I risk click on a questionable link just to see if it's questionable or not? That defeats the purpose of NOT clicking on questionable urls. "oh my what does this red button do, I don't know let me push it and find out."

No one needs to go to some other link besides the actual Think or Swim website. As I mentioned you can get a free account with TOS without going to some questionable link. It's free, and you get all realtime data on the live trading side when you login.



ADMINS:

I'd like to request you guys to check to see if "lawrencevkim", and "locantop" are the same person. Or some elaborate bot that has jacked this thread. Something smells fishy.
Re: Fun with ThinkScript
September 06, 2016 01:42PM
I agree with RichieRick...Admins please verify the authenticity of @lawrencevkim and @locantop...

Last week it was spam, now it's a "invitation" to sign up for a what appears to be a bogus "thinkorswim" account on a questionable domain...

RichieRick thankfully expressed concern here earlier and he was "invited" to click on a bogus link pointing to a Google Drive file of unknown origin and contents...

There is absolutely no need whatsoever to go anywhere but https://mediaserver.thinkorswim.com/installer/install.html, if you haven't already done so...
Deleting study header
September 08, 2016 11:39PM
I use TOS and want to delete the header for studies on my charts. For example, if I have a MACD and RSI study under my chart and I want to save real estate by not showing these headers. Is there anyway to hide them?
Re: Deleting study header
September 09, 2016 07:12AM
Yes, sort of there is.

Go into the settings and turn it off, or have it float and follow your pointer. It should be on the first tab in settings. Can't remember the details and I don't have TOS in front of me. You can also set it to "fixed" and it will open in it's own window which you can resize down and move it around your charts.
Re: Deleting study header
September 09, 2016 07:56PM
RichieRick - Ok, i got it. You're right it was SETTINGS-FIRST TAB-DATA BOX-FIXED

Thank you!!!!!!!!!!!!!!!!!!!!!!!
Re: Mechanical MACD Divergence
September 09, 2016 08:04PM
Quote
robert
According to Alexander, the breaking of the centerline between two indicator bottoms is an absolute must for a true divergence.

really enjoying your macd divergence indicator! in times past there has been times i got frustrated expecting a divergence and it not yet play out (ie march '16). but using yours based off Elder's definition of breaking the zero line really has made a difference for me when trying to base my posture expectations. money well spent for my type of trading! thanks again for your excellent indicators.



[Edited] Note: screenshot also shows roberts automatic trend lines study (gray diagonal dash lines)



Edited 1 time(s). Last edit at 09/11/2016 09:14AM by mntman.
Re: Deleting study header
September 09, 2016 08:07PM
cool... thanks RichieRick... I've wondered about this too and never knew if it was possible.
Re: Deleting study header
September 10, 2016 11:47AM
Quote
mntman
really enjoying your macd divergence indicator! in times past there has been times i got frustrated expecting a divergence and it not yet play out (ie march '16). but using yours based off Elder's definition of breaking the zero line really has made a difference for me when trying to base my posture expectations. money well spent for my type of trading! thanks again for your excellent indicators.

Thank you for the review. I am always excited to hear that users are benefiting from my work.

Note: While not mentioned in the review above, the screenshot provided includes both the Mechanical MACD Divergence (yellow lines) and the Automatic Trend Lines (gray lines).

- robert


Professional ThinkorSwim indicators for the average Joe
JML
Re: Fun with ThinkScript
September 10, 2016 01:10PM
-



Edited 3 time(s). Last edit at 09/11/2016 11:02AM by JML.
Robert's Rising Tide
September 10, 2016 02:28PM
Anyone paying attention to this study?, you should be. it is about to go extreme oversold. (Daily Time frame - 50 Parameter) I expect a bounce first, then things get uglier. I do not expect another v bottom as we had on 6/27. I expect this selloff to continue down into late October to early November. You will have rallies in between for short term trading, as always, but be forewarned they will be met with heavy selling. The pros will be selling into your buying, thus rallies will be short lived. If you must trade short term, day trade / rapid fire, then keep tight stops and watch close. Also on Friday Robert's Overbought/Oversold indicator was reading overbought at the close, and that was with nearly 400 pts down on the dow and 53 pts down on the S&P!. Risk aversion and preservation of capital might be a good idea at this point. smoking smiley



Edited 1 time(s). Last edit at 09/10/2016 02:46PM by Trader.
Re: Robert's Rising Tide
September 11, 2016 09:06AM
Quote
Trader
Robert's Overbought/Oversold indicator was reading overbought at the close

i haven't used this one. i was very curious about it when i first saw it (for my once a week analysis) but i don't really pay much attention to the DOW so i never bought it. i follow more SPX, NDX, RUT and OEX indexes. i thought the math was pretty interesting concept though when i read roberts post on it.

Quote
Trader
Anyone paying attention to this study [Rising Tide]?

i do but only for my weekend "once-a-week" analysis. however i modified mine a little to monitor the 30dma instead of the 50. i know thats not what the horizontal levels are meant for gauging, but i follow some online education classes and an instructor for swing trading monitors the 30dma and tech stocks (NDX). so i jumped on this indicator when i saw it from robert and i modified mine to do this to make it quick and easy without having to physically count the stocks above or below. i also added a 30dma white dash line of the actual cyan line itself out of curiosity just playing around. i've never seen the $OEXA200R plotted before and don't have any experience with it, but so far I'm really liking this riding tide indicator for visually seeing the plotted line and comparing it to the actual price index itself. as you mentioned, this indicator has been showing potential underlying weakness (lower highs, lower lows) while the actual OEX index has been steady range bound in price (until friday). i personally haven't used the horizontal lines for my entries/exits like the article suggests... i still prefer myself to use trend lines, price patterns, and support/resistance on the price chart for swing trading... but for overall index "health-at-a-glance" I'm really enjoying it so far.



Note: my modified copies shown for NDX and OEX monitoring the 30dma, not as initially intended when robert created.
JML
Re: Fun with ThinkScript
September 11, 2016 09:35AM
Can someone modify the squeeze script below to where it takes the squeeze taken from a 15 minute chart and shows it on daily chart?
Basically I would like to look at a daily chart and see the squeeze indicator of a 15 minute chart at the bottom.

thanks

declare lower;
input Length = 20;
input Price = Close;
input minPriceMove = 1;
input priceIncrement = 0.01;
input nK = 1.5;
input nBB = 2;
input AlertLine = 1;
input SqueezeOnColor = 2;
input SqueezeOffColor = 6;
def LHMult = If (priceIncrement <> 0, (minPriceMove / priceIncrement), 0);
def ATR = Average(TrueRange(high, close, low), Length);
def SDev = StDev(Price, Length);
def Denom = (nK * ATR);
def BBS_Ind = If (Denom <> 0, ((nBB * SDev) / Denom), 0);
plot BBS_Index = 0;
BBS_Index.AssignValueColor(if BBS_Ind < AlertLine then Color.RED else Color.GREEN);
BBS_Index.SetStyle(4);
BBS_Index.SetLineWeight(2);



Edited 1 time(s). Last edit at 09/11/2016 11:12AM by JML.
Re: Fun with ThinkScript
September 11, 2016 10:29AM
Really great thread here. Wondering if there is a simple TOS scan I could use for finding stocks where the rsi is crossing the 50.
Re: Mechanical MACD Divergence
September 11, 2016 11:12AM
Hi Mntman,

I am interested in Roberts MACD & RSI divergence studies, do you use both? prefer one to another? How have you've been using it for your style of trading? Do the scans work on lower aggression periods (ex 2 min)? What time frames do you use?... etc. Can you share some trades you have taken with these studies? I appreciate any insight you may have. I basically trade divergences, you have helped with a couple in the past and highly regard your opinions
Re: Fun with ThinkScript
September 11, 2016 11:41AM
Quote
JML
Can someone modify the squeeze script below to where it takes the squeeze taken from a 15 minute chart and shows it on daily chart?

Im sorry i wouldn't have a clue how to do this. i know robert created a couple squeeze indicators on his website, but I'm not certain if these are in the ballpark of what your looking for?

Quote
Dennis W
Wondering if there is a simple TOS scan I could use for finding stocks where the rsi is crossing the 50.

i was playing around with TOS default study scan for RSI and changed "greater than" to "crosses below" and ran against the nasdaq100 stocks. the results seem so-so as it returned some crossing below that day (i.e. CSCO & NVDA), although some results i got were not yet crossed (i.e. SIRI). see what you think and maybe someone more experienced will be able to tweek the scan better for you.

input length = 14;
input value = 50;
input price = close;
input averageType = AverageType.WILDERS;

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;
def RSI = 50 * (ChgRatio + 1);

plot scan = RSI crosses below Value;
Re: Mechanical MACD Divergence
September 11, 2016 12:06PM
Quote
fingerlake
Do the scans work on lower aggression periods (ex 2 min)?

Yes.. like robert mentions on his website they will work on any time frame. i ran a check just now with the scan and found CIEN which shows both RSI and Macd divergences on a 2 min chart. (sorry for the large pic... i was hoping it would be scaled down as a preview).



Note: Example of roberts scan with 2 min
Re: Mechanical MACD Divergence
September 11, 2016 12:54PM
Quote
fingerlake
What time frames do you use?

actually I have a full time job so have been unable to learn day trading. so instead I've been studying swing trading which is usually a few days to a few weeks at max... so my time frames i use for swing trade charts are daily with between 1 month to 6 month time frames. depending on how choppy the trend is sometimes i have to zoom out to 6m to get a better look-n-feel.

Quote
fingerlake
Can you share some trades you have taken with these studies?

Actually what im currently doing is already have my own watchlist set and I'm using divergences as "warning" signals to a possible pull back coming. I'm not actually using the scans to find stocks right now. i use the warning signal to either move up my stops, or watch for the divergence pullback to follow thru and use as a buying opportunity if it bounces back.

Quote
fingerlake
do you use both? prefer one to another? How have you've been using it for your style of trading?

i do own both, but currently only use the macd. I've been seeing some articles recently about market internals on a longer time frame and some of the authors use the rsi indicator. i have no experience with it personally yet, but i bought roberts as I'm beginning to look into using the rsi as maybe a longer time frame "market health" application. i would then look at these longer time charts maybe every few weeks or so... not part of my every day routine.

the classes I've been taking on swing trading the instructor is big on watching price action (trend lines, supt/rest lines, and price patterns). when a stock is baselining in a sideways pattern he teaches to throw on a macd 8,17,9 to look for a divergence and then turn it back off. he leaves the 10,30 dma lines on the chart for students to help recognize trend but he encourages students to eventually be able to grow independent from moving averages in time... rely less on indicators and more on price action. the only other indicator I'm aware of he uses is the market forecast green line to help confirm to students the posture of the market as bullish or bearish. again all of this is on daily charts, but with day trading as i understand indicators are much more important since its a much faster pace of trading. so you might get some much better advice from other members here on the forum that do day trading since i don't have any experience in studying or practicing day trades yet.

so finally to answer your question... what I've been using is roberts market forecast indicator (to help with my posture and divergences) and macd indicator (divergences). my actual entries and exits I'm using roberts trend lines and his support/resistance lines (reversal lines). i also dig his basic market structure helping me recognize pivot points for potential support/resistance and additional manually drawn diagonal trend lines. all of these are excellent for me imo, but I've noticed recently in the choppy market when there are short squeeze reversals after someone mentions potential central bank accommodation that indicators in general can struggle. so again just my opinion... they work great in trending markets but in choppy markets its great to have some experience drawing trendlines and supt/resist manually just in case. together my confidence has really began to build since I've been using roberts upper studies and his 2 lower indicators. as i mentioned before, I'm testing his rising tide study, rsi, and comparison study as a way to step back and look at the markets once a week on a longer time frame to see how heathy things might be or not be. just something I'm currently playing around with for the moment.
Re: Fun with ThinkScript
September 11, 2016 12:57PM
Hi mntman, I Love what you did with the Rising Tide, the dashes and the labels. genius!. As for the horizontal lines, I do not use them for entry or exit points either, but i do want to know where we are in the cycle of the market. that cyan line tells us where we are. If you back test the study you will find that the market stays in extreme conditions for approximately 4 - 5 weeks. not always, but enough times to be notable. so odds are the market might stay at the top or the bottom for that time frame. and indeed this is a game of odds and probability. while at the top Institutions are distributing. while at the bottom they are accumulating. During this time frame one should be looking at what ever markets one trades. looking for stabilization after sell off, and the next wave up or down depending where we are. for the markets do move in waves. I do not really pay to much attention to the DOW either. Its their for one reason, manipulation. Its incredibly easy to manipulate 30 components as opposed to 500 or 2000. holding up stocks in the DOW like MMM, GS, IBM, and UNH while the market gets killed gives the illusion to retail that all is good by keeping the Indices at highs, so retail stays in, when in fact quite the opposite is true. And one must also pay attention to these Generals, for when the market does begin to kill the Generals as it did on Friday the market is turning. If you shoot the Generals the foot soldiers will turn and run. key stocks hold up the markets. take them out and its over. Also one would be foolish to not think the markets are the most rigged game in the world, That's why my discretionary trading always overrides my mechanical system. That's how i make more than i lose. If i always executed trades when my mechanical systems said go i would be a poor man by now. I use a combination of the two, but like i said, discretionary always overrides. Another thing i have learned over the years is that all the major indices move in the same direction 85 to 95 percent of the time. so they all get overbought and all get oversold around the same time. I no longer play the Nasdaq for i no longer am a cowboy. the Nasdaq is the wild west. I trade only 48 stocks. the same stocks day in day out. they are within the dow and s&p. stocks are like children. they each have a different personality. once you get to know them, they become easier to trade. as for the overbought/oversold indicator i have found that changes multiple times in a day, as traders move from risk on to risk off so i only use it in the last closing minutes of the day to see where we are for the next day.

Rick R.
Re: Robert's Rising Tide
September 11, 2016 01:02PM
Richie,

i just saw Roberts email where you realized the OEX had dropped EMC for now HSY. thanks so much... i couldn't figure out why my OEX labels weren't working and the chart not updating. i went to check the cboe website on friday but it was last updated 8/31 and still showing EMC.

just curious... would you happen to know if theres a way to get on an email notification from cboe and nasdaq as a heads up as to when a stock is dropped or added to the OEX and NDX in the future?


thanks again,
Mike



Edited 1 time(s). Last edit at 09/11/2016 01:05PM by mntman.
Re: Fun with ThinkScript
September 11, 2016 01:24PM
No i wouldn't mntman, haven't seen any. but that would be nice to know!. your right at present time no website has updated the symbol change. I just did a google search when Robert found EMC was not updating. then i found KHC replaced EMC but KHC was messing up the Rising Tide, thus i replaced KHC with HSY. lets hope no more changes for awhile!.

Rick R.
Re: Fun with ThinkScript
September 12, 2016 10:27AM
TOS sent me this using ‘mostrecent’. I was wondering if anyone knows how to combine ‘assignPriceColor’ and ‘assignValueColor’ (for everything other than ‘mostrecent’) in the same script?


def X = close > Open;
def Y = close < Open;
def Z = close == Open;

def mostrecent = isnan(close[-1]) ;
 
assignPriceColor(if mostrecent and X
then color.Green
 
else if mostrecent and Z
then color.Orange


  
assignValueColor(if  Y
then color.Dark_Red

else color.Dark_Red);


Thanks, JM.
Re: Fun with ThinkScript
September 13, 2016 07:29AM
Has anyone tried re-engineering John Carter's new "Ready, Aim, Fire" indicator?
Re: Fun with ThinkScript
September 13, 2016 05:33PM
ive seen some charts on zerohedge that shows a lower indicator that measures price differences in form of a histogram. they use it for long term charts to go back and look at historical pricing that matches with the current day.

i was curious so i took the basic macd histogram, substituted in percentage price, and it seems to plot out fine. now Id like to add a horiztonal line that would extend back to the last bar that was >= to the current day %. i'd also like to color that bar yellow for easy viewing. i copied roberts "close extension line" and now I'm stuck on a counter that can count back the needed line length.

question 1... do i really need all the agg definitions listed as shown below? can the script just pic up the appropriate aggregation that the chart is displaying?

question 2... could someone please help me set up the bar counter needed to find the last % bar that is => the current % bar please? any help would be greatly appreciated as always.



# Price Percentage

declare lower;

input Aggregate = { Hourly, default Daily, Weekly, Monthly};
def Agg = if Aggregate == Aggregate.Hourly then AggregationPeriod.HOUR else if Aggregate == Aggregate.Daily then AggregationPeriod.DAY else if Aggregate == Aggregate.Weekly then AggregationPeriod.WEEK else if Aggregate == Aggregate.Monthly then AggregationPeriod.MONTH else AggregationPeriod.MIN;

def Sym = close(GetSymbol(), Agg);
def SymPerChg = 100 * (Sym / Sym[1] - 1);
def posSym = SymPerChg > 0;
AddLabel(SymPerChg, GetSymbol() + ": " + Round(SymPerChg, 2) + "%", if posSym then CreateColor(134,202,93) else CreateColor(232, 148, 157));

plot Diff = SymPerChg;
     Diff.SetDefaultColor(GetColor(5));
     Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
     Diff.SetLineWeight(3);
     Diff.DefineColor("Positive and Up", Color.GREEN);     
     Diff.DefineColor("Positive and Down", Color.DARK_GREEN);     
     Diff.DefineColor("Negative and Down", Color.RED);     
     Diff.DefineColor("Negative and Up", Color.DARK_RED);     
     Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up" ) else Diff.color("Positive and Down" ) else if Diff < Diff[1] then Diff.color("Negative and Down" ) else Diff.color("Negative and Up" ));
plot ZeroLine = 0;
     ZeroLine.SetDefaultColor(GetColor(3));

# Close Line Extension, Robert Payne
def lineLength = 4;
def barNumber = BarNumber();
def barCount = HighestAll(If(IsNaN(close), 0, barNumber));
def closeLine = if barNumber == 1 then Double.NaN else if barNumber == barCount - lineLength then Diff[-lineLength] else if barNumber == barCount then Double.NaN else closeLine[1];

plot data = closeLine[1];
    data.AssignValueColor(CreateColor(232,148,157));
     data.SetLineWeight(1);
Re: Fun with ThinkScript
September 13, 2016 05:48PM
Quote
Ralph53
I was wondering if anyone knows how to combine ‘assignPriceColor’ and ‘assignValueColor’ (for everything other than ‘mostrecent’) in the same script?

im not sure if i understand your question correctly but is it something like this below?



def X = close > Open; 
def Y = close < Open; 
def Z = close == Open; 

def mostrecent = isnan(close[-1]) ; 
  
assignPriceColor(if mostrecent and X then color.Green else if mostrecent and Z then color.Orange else color.dark_red);
Re: Fun with ThinkScript
September 13, 2016 10:38PM
Thanks.
Re: Fun with ThinkScript
September 14, 2016 05:44AM
AbleTrends Charts seem to get a lot of praise. Has anyone ever put together something similar for TOS?
Re: Fun with ThinkScript
September 15, 2016 12:11PM
Hello,

new member here, and this is just what I wanted. Is there a way to have this studies showing only of the last day of trading? Thanks
Re: Fun with ThinkScript
September 19, 2016 07:42AM
Hello everyone!
Please add the
input show Only Today = YES;
in this indicator:

input aggregationPeriod = AggregationPeriod.FOUR_HOURS;
input lo = yes; #hint lo: line every 10$
input l = yes;  #hint l: line every 1$


#by lawrencevkim 20/08/2015
DefineGlobalColor("10", Color.VIOLET);
DefineGlobalColor("1", Color.BLUE);


def lo_price = if lo then Round(close(period = aggregationPeriod)[1], -1) else Double.NaN;

plot lo_price_1 = lo_price;
lo_price_1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_1.SetDefaultColor(GlobalColor("10"winking smiley);
plot lo_price_2 = lo_price + 10;
lo_price_2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_2.SetDefaultColor(GlobalColor("10"winking smiley);
plot lo_price_3 = lo_price + 20;
lo_price_3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_3.SetDefaultColor(GlobalColor("10"winking smiley);
plot lo_price_4 = lo_price + 30;
lo_price_4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_4.SetDefaultColor(GlobalColor("10"winking smiley);
plot lo_price_5 = lo_price - 10;
lo_price_5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_5.SetDefaultColor(GlobalColor("10"winking smiley);
plot lo_price_6 = lo_price - 20;
lo_price_6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_6.SetDefaultColor(GlobalColor("10"winking smiley);
plot lo_price_7 = lo_price - 30;
lo_price_7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_7.SetDefaultColor(GlobalColor("10"winking smiley);

def l_price = if l then Round(close(period = aggregationPeriod)[1], 0) else Double.NaN;

plot l_price_1 = l_price;
l_price_1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_1.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_2 = l_price + 1;
l_price_2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_2.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_3 = l_price + 2;
l_price_3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_3.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_4 = l_price + 3;
l_price_4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_4.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_5 = l_price + 4;
l_price_5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_5.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_6 = l_price + 5;
l_price_6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_6.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_7 = l_price - 1;
l_price_7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_7.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_8 = l_price - 2;
l_price_8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_8.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_9 = l_price - 3;
l_price_9.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_9.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_10 = l_price - 4;
l_price_10.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_10.SetDefaultColor(GlobalColor("1"winking smiley);
plot l_price_11 = l_price - 5;
l_price_11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_11.SetDefaultColor(GlobalColor("1"winking smiley);
I'll be very grateful!



Edited 1 time(s). Last edit at 09/19/2016 09:59AM by NEKSUS.
Sorry, only registered users may post in this forum.

Click here to login