Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 11-19-2008, 01:22 AM   #17

Join Date: Feb 2008
Location: San Francisco
Posts: 5
Ignore this user

Thanks: 1
Thanked 1 Time in 1 Post

Re: Think or Swim Code/indicators

There were a couple of extra spaces, and the bollingerbands reference was broken. This should work:

declare lower;
input Length = 20;
input price = close;
######################
def e1 = (Highest(High, length) + Lowest(low, length)) / 2 + Average(close, length);
def osc = Inertia(price - e1 / 2, length);
plot oscp = osc;

def diff = reference BollingerBandsSMA(length = 20)."upperband" - reference KeltnerChannels."Upper_Ba nd";
plot mid = 0;
mid.assignValueColor(if diff >= 0 then Color.UPTICK else Color.DOWNTICK);

#oscp.assignValueColor(if osc[1] < osc[0] then Color.CYAN else Color.magenta);
oscp.assignValueColor(if osc[1] < osc[0] then
if osc[0] >= 0 then
#UpPos
createColor(0, 255, 255) else
#UpNeg
createColor(204, 0, 204)
else if osc[0] >= 0 then
#DnPos
createColor(0, 155, 155) else
#DnNeg
createColor(255, 155, 255));

oscp.setPaintingStrategy( PaintingStrategy.HISTOGRA M);
mid.setPaintingStrategy(P aintingStrategy.POINTS);
trader_john is offline  
Reply With Quote
Old 11-20-2008, 10:02 AM   #18

Join Date: Feb 2008
Location: San Francisco
Posts: 5
Ignore this user

Thanks: 1
Thanked 1 Time in 1 Post

Re: Think or Swim Code/indicators

Hmmm. The extra spaces seem to be a problem with cutting/pasting into TL. The problem areas in my previous post are:

def diff = reference BollingerBandsSMA(length = 20)."upperband" - reference KeltnerChannels."Upper_Ba nd";
oscp.setPaintingStrategy( PaintingStrategy.HISTOGRA M);
mid.setPaintingStrategy(P aintingStrategy.POINTS);

If you strip out these spaces, the indicator should verify...
trader_john is offline  
Reply With Quote
Old 11-30-2008, 10:22 PM   #19

Join Date: Nov 2008
Posts: 2
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Think or Swim Code/indicators

thanks to everybody here!!
suggestion--- the thinkscript manual is really scarce on examples-- it kind of assumes someone is familiar with coding generally. it would really be helpful if someone could explain SIMPLE functions in a concrete way, like building blocks to create a desired result. EXAMPLE: i'm struggling to write this simple code (and i'd appreciate any help- i keep getting errors)---
========================
1. to display two stocks upper (any format, candles or whatever, avg price or whatever)
2. single plot in lower study that shows the difference between the two stocks, but using the avg of daily hi+lo+close.
========================= ======
see what i mean? if someone had a building block that showed them how to plot multiple stocks (upper), and another building block that showed them how to plot interactions (+,-, /,sqrt etc) of those stock values (lower), they could build many indicators.
anyway, just a suggestion and request from a frustrated newbie coder--
Dennis
orangequant is offline  
Reply With Quote
Old 11-30-2008, 10:58 PM   #20

Join Date: Feb 2008
Location: San Francisco
Posts: 5
Ignore this user

Thanks: 1
Thanked 1 Time in 1 Post

Re: Think or Swim Code/indicators

Hi Dennis,

First, I'm not a TOS coding expert, but I have played around a little. A good way to learn the language seems to be by looking at the predefined indicators that have source code. These are the ones with the little scroll or paper icon next to them (double click on it).

To your specific items, I played around a little and came up with these simple examples that you can expanded on (please share!):

1) display two stocks in upper:

# Simple example of plotting two stock in upper
# Data1 will be the primary stock you are viewing
plot Data1 = close;
# Data2 will be the comparison stock
plot Data2 = close("c");

2) display the difference between two stocks in lower:
declare lower;
def Data1 = close;
def Data2 = close("c");
plot Diff = Data1 - Data2;

There is also several "comparison" studies that compare your current stock to various others. It looks like you can change the line style and stock to compare to as well.

Hope that helps,
John
trader_john is offline  
Reply With Quote
The Following User Says Thank You to trader_john For This Useful Post:
orangequant (11-30-2008)
Old 11-30-2008, 11:19 PM   #21

Join Date: Nov 2008
Posts: 2
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Think or Swim Code/indicators

Quote:
Originally Posted by trader_john »
Hi Dennis,

First, I'm not a TOS coding expert, but I have played around a little. A good way to learn the language seems to be by looking at the predefined indicators that have source code. These are the ones with the little scroll or paper icon next to them (double click on it).

To your specific items, I played around a little and came up with these simple examples that you can expanded on (please share!):

1) display two stocks in upper:

# Simple example of plotting two stock in upper
# Data1 will be the primary stock you are viewing
plot Data1 = close;
# Data2 will be the comparison stock
plot Data2 = close("c");

2) display the difference between two stocks in lower:
declare lower;
def Data1 = close;
def Data2 = close("c");
plot Diff = Data1 - Data2;

There is also several "comparison" studies that compare your current stock to various others. It looks like you can change the line style and stock to compare to as well.

Hope that helps,
John
wow!! thanks, John--- that was fast! okay, i'm going to play with this a bit and come back here to share--- thank YOU -- this is one of my simplest but most critical indicators

EDIT~~~ that was exactly what i meant by "building blocks" to help a newbie understand-- from your example i can see how to build some other stuff too

Bump: im still working on code you provided, John, which has much more potential than this from their manual--- somehow between the two i should be able to finally get exactly what i want---
+++++++++++++++++++++++++ +
declare lower;
plot data = close-close("enter symbol");
+++++++++++++++++++++++++ +

Bump: im still working on code you provided, John, which has much more potential than this from their manual--- somehow between the two i should be able to finally get exactly what i want---
+++++++++++++++++++++++++ +
declare lower;
plot data = close-close("enter symbol");
+++++++++++++++++++++++++ +

Bump: im still working on code you provided, John, which has much more potential than this from their manual--- somehow between the two i should be able to finally get exactly what i want---
+++++++++++++++++++++++++ +
declare lower;
plot data = close-close("enter symbol");
+++++++++++++++++++++++++ +
orangequant is offline  
Reply With Quote
Old 12-06-2008, 03:23 AM   #22

Join Date: Jan 2008
Location: africa
Posts: 1,107
Ignore this user

Thanks: 46
Thanked 75 Times in 58 Posts
Blog Entries: 6

Re: Think or Swim Code/indicators

...has anyone coded TRO for thinkorswim ?

...or this indicator ?

SHME PushHiLo AutoX

...thanks

Last edited by elovemer; 12-06-2008 at 03:35 AM.
elovemer is offline  
Reply With Quote
Old 12-12-2008, 09:02 PM   #23

Join Date: Oct 2008
Location: new orleans
Posts: 5
Ignore this user

Thanks: 2
Thanked 1 Time in 1 Post

Re: Think or Swim Code/indicators

Does anyone have the TTM Value Chart indicator for TOS?
semperfiguy223 is offline  
Reply With Quote
Old 12-14-2008, 12:01 AM   #24

Join Date: Jan 2008
Location: africa
Posts: 1,107
Ignore this user

Thanks: 46
Thanked 75 Times in 58 Posts
Blog Entries: 6

Re: Think or Swim Code/indicators

....got a TTM squeeze indicator.....
....works very well..... as does TSI
....is that what you want ? ttm squeeze ?

..... anybody have a ERGODIC indicator for tos ?

.....anybody have any idea what settings to use with SMI indicator ?
Quote:
Originally Posted by semperfiguy223 »
Does anyone have the TTM Value Chart indicator for TOS?
elovemer is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
TTM Indicators for CQG? bathrobe Coding Forum 3 01-03-2011 06:01 AM
TradeStation Strategy Code Help jjthetrader Coding Forum 2 10-26-2010 08:06 AM
TTM trend esignal code philloo Trading Indicators 9 04-16-2009 09:51 AM
Does Anyone have the TTM Scalper Code for Esignal??? jphillips9 Beginners Forum 5 01-14-2008 07:26 PM
Floor Trader Pivot Code Help.... jmi88 Coding Forum 1 05-22-2007 10:13 PM

All times are GMT -4. The time now is 06:12 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.