Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

Fun with ThinkScript

Posted by robert 
Mel
Re: Fun with ThinkScript
September 19, 2014 09:47PM
Hi All,

I'm trying to write a script that draws a vertical line showing a daily moving average cross on an intraday chart. It seems to work except it shows multiple lines depending on the intraday time frame. For example, on a 1 hour chart it will show 10 lines. Is there any way to show just one line at either the EOD or BOD. This code was taken from one of Robert's scripts and modified.

Thx
Mel


declare upper;
input short_average = 5;
input medium_average = 55;

input average_type = {default "EMA", "SMA"};
input show_vertical_line = yes;
input show_bubble_labels = no;

def MA1;
def MA2;

switch (average_type) {
case "SMA":
MA1 = Average(close(period = "day" ), short_average);
MA2 = Average(close(period = "day" ), medium_average);

case "EMA":
MA1 = ExpAverage(close(period = "day" ), short_average);
MA2 = ExpAverage(close(period = "day" ), medium_average);
}


def Uptrend3 = if MA1 > MA2 then 1 else Double.NaN;
def Downtrend3 = if MA1 < MA2 then 1 else Double.NaN;


def condition3 = Crosses(MA1, MA2, CrossingDirection.BELOW);
def condition4 = Crosses(MA1, MA2, CrossingDirection.ABOVE);


# Draw vertical line to indicate call and put signals
AddVerticalLine(Condition4 && show_vertical_line, "UP", Color.UPTICK);
AddVerticalLine(Condition3 && show_vertical_line, "DOWN", Color.LIGHT_RED);



Edited 2 time(s). Last edit at 09/20/2014 08:58PM by Mel.
Re: Fun with ThinkScript
September 19, 2014 09:51PM
Hey Robert,
I have a indicator that I am interested in having reworked.
The code is the LBR PaintBars.
I like the indicator but don't want the bars to be painted as performed by the indicator.
I would rather have a red or green dot under and over the candles.
Your help is always appreciated, thanks.

##########################

input HLLength = 16;
input ATRLength = 9;
input factor = 2.5;
input paintBars = yes;

assert(factor > 0, "'factor' must be positive: " + factor);

def AATR = factor * Average(AvgTrueRange(high, close, low, ATRLength), ATRLength);
def band1 = Lowest(low, HLLength) + AATR;
def band2 = Highest(high, HLLength) - AATR;

plot UpperVolatility = close > band1 and close > band2;
plot LowerVolatility = close < band1 and close < band2;

UpperVolatility.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
UpperVolatility.SetLineWeight(3);
UpperVolatility.SetDefaultColor(Color.GREEN);
UpperVolatility.hide();
LowerVolatility.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
LowerVolatility.SetLineWeight(3);
LowerVolatility.SetDefaultColor(Color.RED);
LowerVolatility.hide();

DefineGlobalColor("Bullish", Color.GREEN);
DefineGlobalColor("Bearish", Color.RED);
AssignPriceColor(if !paintBars
then Color.CURRENT
else if UpperVolatility
then globalColor("Bullish"winking smiley
else if LowerVolatility
then globalColor("Bearish"winking smiley
else Color.CURRENT);
Re: Fun with ThinkScript
September 20, 2014 10:58AM
Got it !!! Now works with directional arrows rather than altering the bar color.
(I don't know why I'm getting smilie faces in the code pasted here)


input HLLength = 16;
input ATRLength = 9;
input factor = 2.5;
input paintBars = no;

Assert(factor > 0, "'factor' must be positive: " + factor);

def AATR = factor * Average(AvgTrueRange(high, close, low, ATRLength), ATRLength);
def band1 = Lowest(low, HLLength) + AATR;
def band2 = Highest(high, HLLength) - AATR;

plot UpperVolatility = close > band1 and close > band2;
plot LowerVolatility = close < band1 and close < band2;

UpperVolatility.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
UpperVolatility.SetLineWeight(3);
UpperVolatility.SetDefaultColor(Color.GREEN);
UpperVolatility.Hide();
LowerVolatility.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
LowerVolatility.SetLineWeight(3);
LowerVolatility.SetDefaultColor(Color.RED);
LowerVolatility.Hide();

DefineGlobalColor("Bullish", Color.GREEN);
DefineGlobalColor("Bearish", Color.RED);
AssignPriceColor(if !paintBars
then Color.CURRENT
else if UpperVolatility
then GlobalColor("Bullish"winking smiley
else if LowerVolatility
then GlobalColor("Bearish"winking smiley
else Color.CURRENT);

plot ArrowUp;
plot ArrowDn;



ArrowUp = if close > band1 and close > band2 then band2 else Double.NaN; ;
ArrowUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
ArrowUp.SetLineWeight(1);
ArrowUp.SetDefaultColor(Color.GREEN);
ArrowDn = if close < band1 and close < band2 then band2 else Double.NaN; ;
ArrowDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
ArrowDn.SetLineWeight(1);
ArrowDn.SetDefaultColor(Color.RED);
Re: Fun with ThinkScript
September 20, 2014 05:56PM
mark1234 Wrote:
-------------------------------------------------------
> (I don't know why I'm getting smilie faces in the
> code pasted here)




Welcome to the forums.... :-) Hehehe....
Re: Fun with ThinkScript
September 28, 2014 07:03PM
sad smiley



Edited 1 time(s). Last edit at 10/15/2014 04:41PM by Candle Newb.
Re: Fun with ThinkScript
October 02, 2014 03:26PM
Hi All - I have had a lot of success with the study below on the ES using a 5min chart with a 10 period and 7.5 and -7.5 as well as using the system noted below (crossing green on the way up is opening a position, crossing red on the way down is closing). FYI I also use a 3/10 Osc to keep me out of any major false signals (as well as support/resistance levels).



I was hoping someone would know how to whip up a strategy to test other variations of the studies variables. I am still working out my thinkscript strategy programming kinks...

Thanks!

# Custom_TrendHunter by ncastrinos
# Verison 1.0 11/10/2011 @ 0800 HRS

# Place study in lower pane
declare lower;

#User inputs:
input length = 20;
input trendabove = 7.5;
input trendbelow = -7.5;

#Aggregate data for a linear regression over the length above
rec Regression = Inertia(close,length);

#Determine the angle of the lower end of the line and plot it in an oscillator
plot Data = Atan((Regression-Regression[(length-1)])/(length-1))* 180 / Double.Pi;

#Plot your indicator lines
plot above = trendabove;
plot below = trendbelow;
Re: Fun with ThinkScript
October 06, 2014 07:22PM
Quote
Mel
Hi All,

I'm trying to write a script that draws a vertical line showing a daily moving average cross on an intraday chart. It seems to work except it shows multiple lines depending on the intraday time frame. For example, on a 1 hour chart it will show 10 lines. Is there any way to show just one line at either the EOD or BOD. This code was taken from one of Robert's scripts and modified.

Thx
Mel

Mel,

The reason you are getting so many vertical lines is because each intraday bar is looking at the same daily bar data. That is, if the daily moving averages have crossed, then each intraday bar will see the same daily cross and give you a vertical line. So, for your intraday bars you want to use logic similar to: if the daily moving average has crossed on this bar and not on the previous bar, then draw a vertical line. What that will accomplish is to draw a vertical line only the first time an intraday bar shows a daily cross.

Try using this for your vertical lines instead:

# Draw vertical line to indicate call and put signals 
AddVerticalLine(Condition4 && !Condition4[1] && show_vertical_line, "UP", Color.UPTICK); 
AddVerticalLine(Condition3 && !Condition3[1] && show_vertical_line, "DOWN", Color.LIGHT_RED);
Re: Fun with ThinkScript
October 07, 2014 09:49PM
Anyone know how one can have lines pertaining to a gap of varying size or percent keep extending out on the chart indefinitely until they are crossed? ive got a couple different gap scripts but none are percent, either they extend even when crossed or they don't extend past the day. thx.
Re: Fun with ThinkScript
October 07, 2014 11:21PM
Quote
mklatx
Anyone know how one can have lines pertaining to a gap of varying size or percent keep extending out on the chart indefinitely until they are crossed? ive got a couple different gap scripts but none are percent, either they extend even when crossed or they don't extend past the day. thx.

mklatx,

Take a look at this post to see if it'll do what you want. It has several extra gap lines, but they can be disabled individually from within the script settings panel.
Re: Fun with ThinkScript
October 08, 2014 01:20AM
I am using multiple diffrent signals on a 5 min chart. They all have up or down signal (Arrow) is there a way to stack the arrows one below the other if there are multiple signals on one bar?

Or is there a solution which you guys use to see all the signals? may be dots? if so can you let me know how ?

Thanks,
StrategyNode
Re: Fun with ThinkScript
October 08, 2014 01:00PM
Quote
strategynode
I am using multiple diffrent signals on a 5 min chart. They all have up or down signal (Arrow) is there a way to stack the arrows one below the other if there are multiple signals on one bar?

Or is there a solution which you guys use to see all the signals? may be dots? if so can you let me know how ?

Thanks,
StrategyNode

You could change the arrow sizes from the script settings popup. Perhaps make one arrow size 1, another size 3, and one size 5. Then when they all hit at the same time, you will see the different sizes stacked on top of each other.

Alternatively, you could change the script so that one arrow draws 0.05 above the high, another at maybe, 0.15 above the high, etc.

edit: added examples below.

The code is just to demonstrate a couple of possible ways of accomplishing your goal.

1) Differently sized arrows overlaying each other.



def ma1 = Average(close, 5);
def ma2 = Average(close, 10);
def ma3 = Average(close, 20);

def cross1 = ma1 crosses above ma2;
def cross2 = ma1 crosses above ma3;

plot x1 = cross1;
     x1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
     x1.SetLineWeight(1);
     x1.SetDefaultColor(color.blue);
plot x2 = cross2;
     x2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
     x2.SetLineWeight(5);
     x2.SetDefaultColor(Color.GREEN);

2) Signal dots stacked and spaced out.



def ma1 = Average(close, 5);
def ma2 = Average(close, 10);
def ma3 = Average(close, 20);

def DotOffset = AvgTrueRange(high(period = "day" ), low(period = "day" ), close(period = "day" ), 14) * 0.03;

def cross1 = ma1 crosses above ma2;
def cross2 = ma1 crosses above ma3;
def cross3 = cross1 and cross2;

plot x1 = if cross1 then low - DotOffset else Double.NaN;
     x1.SetPaintingStrategy(PaintingStrategy.POINTS);
     x1.SetLineWeight(3);
     x1.SetDefaultColor(Color.BLUE);
plot x2 = if cross2 then low - 2 * DotOffset else Double.NaN;
     x2.SetPaintingStrategy(PaintingStrategy.POINTS);
     x2.SetLineWeight(3);
     x2.SetDefaultColor(Color.GREEN);
plot x3 = if cross3 then low - 3 * DotOffset else Double.NaN;
     x3.SetPaintingStrategy(PaintingStrategy.POINTS);
     x3.SetLineWeight(3);
     x3.SetDefaultColor(Color.PLUM);

- robert


Professional ThinkorSwim indicators for the average Joe



Edited 1 time(s). Last edit at 10/08/2014 01:47PM by robert.
Re: Fun with ThinkScript
October 08, 2014 01:45PM
How would I do the second solution? do you have any sample code or a place i could see an example?


robert Wrote:
-------------------------------------------------------
> > I am using multiple diffrent signals on a 5 min
> chart. They all have up or down signal (Arrow) is
> there a way to stack the arrows one below the
> other if there are multiple signals on one bar?
>
> Or is there a solution which you guys use to see
> all the signals? may be dots? if so can you let me
> know how ?
>
> Thanks,
> StrategyNode
>
>
> You could change the arrow sizes from the script
> settings popup. Perhaps make one arrow size 1,
> another size 3, and one size 5. Then when they
> all hit at the same time, you will see the
> different sizes stacked on tope of each other.
>
> Alternatively, you could change the script so that
> one arrow draws 0.05 above the high, another at
> maybe, 0.15 above the high, etc.
Re: Fun with ThinkScript
October 08, 2014 01:50PM
Quote
strategynode
How would I do the second solution? do you have any sample code or a place i could see an example?

LOL. You were posting the same time I was updating my post to include examples. See above.
Re: Fun with ThinkScript
October 08, 2014 11:49PM
Thanks Robert That worked!
The only thing with the dots are that as I resize my window somtimes they overlap or sometimes they overlap partialy no matter what. I am using them on a 5min chart.

StrategyNode
Re: Fun with ThinkScript
October 09, 2014 12:22AM
I have a new question. I have couple of studies I use, there anyway to create a ONE alert when diffrent studies are meeting the criteria at the same time.

I know I can combine studies in one signal but that becomes to selective so say if i am using the MACD Histogram and a buy signal, I want the alert to fire when the MACD bar < one bar ago but also if there is a buy signal exists during that time.

I am not sure if I am making my self clear enough.

StrategyNode
Re: Fun with ThinkScript
October 09, 2014 06:49AM
Quote
strategynode
I have a new question. I have couple of studies I use, there anyway to create a ONE alert when diffrent studies are meeting the criteria at the same time.

I know I can combine studies in one signal but that becomes to selective so say if i am using the MACD Histogram and a buy signal, I want the alert to fire when the MACD bar < one bar ago but also if there is a buy signal exists during that time.

I am not sure if I am making my self clear enough.

StrategyNode

def MACDsignal = blah blah blah;
def BUYsignal = blah blah blah;

plot ALERTsignal = (MACDsignal or MACDsignal[1]) and BUYsignal;

That says you currently have a BUYsignal and the MACD signaled on either this bar or the previous one.
Re: Fun with ThinkScript
October 09, 2014 08:35AM
Thanks So much Robert I am going to try this right now.

I had a weird problem this morning with the points the earlier signals were are all arrows up or down and they worked in pre market can anybody think of any reason why the POINTS didn't work in premarket?
Re: Fun with ThinkScript
October 09, 2014 09:52AM
strategynode Wrote:
-------------------------------------------------------
> Thanks So much Robert I am going to try this right
> now.
>
> I had a weird problem this morning with the points
> the earlier signals were are all arrows up or down
> and they worked in pre market can anybody think of
> any reason why the POINTS didn't work in
> premarket?


Robert,
I was wondering if the problem above has anything to do with the following code

def DotOffset = AvgTrueRange(high(period = "day" ), low(period = "day" ), close(period = "day" ), 14) * 0.03;

I am using this in a 5 min chart so should I change "day" to 5 min ?

StrategyNode
Re: Fun with ThinkScript
October 09, 2014 10:35AM
Quote
strategynode
I had a weird problem this morning with the points the earlier signals were are all arrows up or down and they worked in pre market can anybody think of any reason why the POINTS didn't work in premarket?

Nothing springs immediately to mind. I'd have to review the entire script to see if anything kinky were happening. For example, maybe the script has a time requirement built in so that it's only active during normal market hours.

Quote

I was wondering if the problem above has anything to do with the following code

def DotOffset = AvgTrueRange(high(period = "day" ), low(period = "day" ), close(period = "day" ), 14) * 0.03;

I am using this in a 5 min chart so should I change "day" to 5 min ?

As you change the size of your chart by zooming in or out to show fewer or more bars, the price scale will change to cover a greater or lesser range. Thus the number of pixels between price values changes. For example, if the chart is zoomed in so that it's only showing a total range of $20 there might be 10 screen pixels between each nickel price tick. So, signal dots spaced a nickel apart would have 10 pixels of distance between them. If you switch to a different stock, or zoom the chart so that it is now showing a $40 price range, then there would only be 5 screen pixels between each nickel price tick. So now the same signal dots which are spaced a nickel apart would only have 5 pixels between them so they my now overlap.

That's why I was trying to dynamically change the offset size. Stocks that move more in a given day and would, therefore, necessitate the chart squeezing a larger price range into the same screen space will have fewer pixels between each price point, so I want those stocks to have a larger DotOffset.

You can hard code the DotOffset to always be a set value; perhaps 0.15. However, on a stock that moves a lot, such as Netflix, 0.15 will hardly be noticeable on a chart that covers a $40 range. My thought was to use each stock's average range to dynamically change the DotOffset value. In the example above, a stock that moves only $2.00 in a day, would have an offset of 0.06 whereas a stock like NFLX which is currently averaging around $10 a day would have an offset of 0.30.

Clear as mud now?
Re: Fun with ThinkScript
October 10, 2014 08:51AM
I like to have simple labels sometimes to give me big picture and was hoping this one would be possible.

A label that simply says "X Up / X Down" with X being the number of days in the past however many days where it was up or down. So the number of days to look at would be an input and it would tell me how many of those were up or down.

I guess the coloring would be if a certain number were up vs down. Is that possible? I find that helps me weigh the big picture vs smaller trend. Thx!
Re: Fun with ThinkScript
October 15, 2014 06:20AM
robert Wrote:
-------------------------------------------------------
> > I've been looking everywhere for an indicator
> that alerts me with a sound and message (within
> tos) as soon as price crosses the upper or lower
> bullinger band, it would also be great if the
> background color could change to grey, so i
> immediately know which chart I'm looking at.
>
>
> Welcome, smccooey. I threw this together quickly
> and believe it'll work for you.
>
>
> input length = 21;
> input deviation = 2;
>
> def sDev = StDev(data = close, length);
> def MA21 = Average(close, length);
>
> def UpperBand = MA21 + deviation * sDev;
> def LowerBand = MA21 - deviation * sDev;
>
> def oobUp = if close > UpperBand and close[1] <=
> UpperBand[1] then 1 else Double.NaN;
> def oobDn = if close < LowerBand and close[1] >=
> LowerBand[1] then 1 else Double.NaN;
>
> Alert(oobUp, Concat(GetSymbolPart(), " above upper
> band." ), Alert.BAR, Sound.Chimes);
> Alert(oobDn, Concat(GetSymbolPart(), " below lower
> band." ), Alert.BAR, Sound.Chimes);
>
> assignbackgroundColor(if close > upperband then
> color.gray else if close < lowerband then
> color.gray else color.current);
>


I get the assignbackground code in red and it does not work. Did I do something wrong, Has it been updated?

Thanks am new to thinkscript and this board
Re: Fun with ThinkScript
October 15, 2014 10:37AM
I wanted to share a MACD divergence code which seems to work really well but i am having problems scanning for it and wanted see if anybody could help me decipher it.

How I use it?
I use this in an intraday 5 min chart and a 3 month day chart.

below I am attaching the study and the scan I created (from [www.thinkscripter.com]) . The problem with the scan is that it shows me the divergence for yesterday today, what i want it to do is at the end of the day I want to run the code and see which stocks had the divergence today so that I can create my watchlist.

I am not sure, since I am not that well versed with thinkscript that if the signal will only show up after the next bar is created.


input vsl = 12;
input vfl = 26;
input vlb = 21;
input vma = 9;



def vmacBI = ((((mACDHistogram(vsl,vfl,vma)[1] < maCDHistogram(vsl,vfl,vma)[2]) * (macdhistogram(vsl,vfl,vma)[1] < macdhistogram(vsl,vfl,vma))) * (MACDHistogram(vsl,vfl,vma)[1] > LOWESt(MACDHistogram(vsl,vfl,vma),vlb)))  * (LOW[1] < LOWESt(LOW,vlb)[2]));

def vmacSS = ((((mACDHistogram(vsl,vfl,vma)[1] > maCDHistogram(vsl,vfl,vma)[2]) * (macdhistogram(vsl,vfl,vma)[1] > macdhistogram(vsl,vfl,vma))) * (MACDHistogram(vsl,vfl,vma)[1] < HIGHESt(MACDHistogram(vsl,vfl,vma),vlb)))  * (HIGH[1] > HIGHEst(HIGH,vlb)[2]));

def vmachBI = ((((mACDHistogram(vsl,vfl,vma)[1] < maCDHistogram(vsl,vfl,vma)[2]) * (macdhistogram(vsl,vfl,vma)[1] < macdhistogram(vsl,vfl,vma))) * (MACDHistogram(vsl,vfl,vma)[1] < LOWESt(MACDHistogram(vsl,vfl,vma),vlb)[2]))  * (LOW[1] > LOWESt(LOW,vlb)[2]));

def vmachSS = ((((mACDHistogram(vsl,vfl,vma)[1] > maCDHistogram(vsl,vfl,vma)[2]) * (macdhistogram(vsl,vfl,vma)[1] > macdhistogram(vsl,vfl,vma))) * (MACDHistogram(vsl,vfl,vma)[1] > HIGHESt(MACDHistogram(vsl,vfl,vma),vlb)[2]))  * (HIGH[1] < HIGHEst(HIGH,vlb)[2]));

def DotOffset = AvgTrueRange(high(period = "day" ), low(period = "day" ), close(period = "day" ), 14) * 0.03;
plot DiBI = if vmacBI[-1] then low - 4*DotOffset else Double.NaN;
plot DiSS = if vmacSS[-1] then high - -7*DotOffset else Double.NaN;

plot DihiBI = if vmachBI[-1]then low - 5*DotOffset else Double.NaN;
plot DihiSS = if vmachSS[-1] then high - -8*DotOffset else Double.NaN;

DiBI.setPaintingStrategy(paintingStrategy.POINTS);
DiBI.SetDefaultColor(Color.bLUE);
Diss.setPaintingStrategy(paintingStrategy.POINTS);
Diss.SetDefaultColor(Color.bLUE);
DihiBI.setPaintingStrategy(paintingStrategy.POINTS);
DihiBI.SetDefaultColor(Color.cyan);
Dihiss.setPaintingStrategy(paintingStrategy.POINTS);
Dihiss.SetDefaultColor(Color.cyan);



Alert(DIbi, "Divergence" + getsymbol(), Alert.bar, Sound.ring);
Alert(DIss, "Divergence" + getsymbol(), Alert.bar, Sound.bell);
Alert(DIhiBI, "Divergence" + getsymbol(), Alert.bar, Sound.ring);

The Scan I came up with (this is only for one signal (postive) out of the four signals this code generates)

def a = mACDHistogram(12,26,9)[1];
def b = maCDHistogram(12,26,9)[2];
def c = LOWESt(MACDHistogram(12,26,9),21);
def d = MACDHistogram();
def VMACBI = (((a < b) * (a < d))* (a > c))* (LOW[1] < LOWESt(LOW,21)[2]);

Plot buy = VmacBI from 0 bar ago;


Any help will be much appreciated.
Mel
Re: Fun with ThinkScript
November 01, 2014 01:51PM
Thank you Robert, that works perfectly.
Re: Fun with ThinkScript
November 14, 2014 08:43PM
Robert,

I am looking for a TOS script for the Joe Dinapoli Indicators, I can get the IDS version of the code from E-Signal..if you have any time to try it...

Dinapoli Detrended Osc
Dinapoli Preferred Stochastics
Dinapoli Macd
Re: Fun with ThinkScript
November 16, 2014 02:39PM
I am new here, but great code & information
ZigZag Net Volume
November 23, 2014 04:26PM
I've been using the ZigZag with Bubbles code for TOS that was posted by robert and would like help from someone to add code for the Net Volume between the swings and display that in the bubbles.
Posted ZigZag Code

Quote
Definition of Net Volume
Investopedia.com DEFINITION of 'Net Volume'

A term in technical analysis that represents a security's uptick volume minus its downtick volume over a specified period. The net volume of a stock is a consolidated total of the positive and negative movements of the security over the period. A stock that is said to have had a positive net volume over a given period will have seen greater upward movement in its price than downward.

InvestorWords.com DEFINITION of 'Net Volume'

Uptick volume minus downtick volume for a given security or exchange over a given period of time.

As I see how this may be done is to use the Sum(IDataHolder data, int length) function to add up all the bullish and bearish volumes between each swing; however, I would think that I need to be able to use the bar count as the length in the Sum() function. How can I get the total number of bars between each ZigZag swing? If anyone knows how to code this and get the net volume to display in the bubbles at the end of each swing, please help me.
Re: Fun with ThinkScript
December 02, 2014 04:43AM
Hi, does anybody have experience with Larry gaines power cycles indicators?
Re: Fun with ThinkScript
December 02, 2014 01:17PM
I was wondering if anyone here could help me with writing a thinkscript
that would be exactly like the current "PercentChg" in ThinkorSwim.
(Just to be clear "PercentChg" not the "% Change" option.)

The only thing that I would like to be different about the "PercentChg"
is that I would like the percentage number to turn green when it is
positive and red when it is a negative number. Currently it stays
yellow regardless of whether it's positive or negative.

I'm using this in a stock hacker scan to be able to track lots of stocks
in lots of time frames and quickly be able to see where the market is
heading. Having it turn red and green would help me to more easily
see the results of the scans.

Anyone's help with this would be greatly appreciated. Thank you.
Re: Fun with ThinkScript
December 02, 2014 04:44PM
Hello

I am Thinkscript programming challenged and would like help developing a custom indicator that:

1. Calculates the number of days since a stock closed above its 5d simple moving average, plots the number as a positive integer, and colors the background in the watchlist output as green.
2. Calculates the number of days since a stock closed below its 5d simple moving average, plots the number as a negative integer, and colors the background in the watchlist output as red.

Thank you
Re: Fun with ThinkScript
December 02, 2014 04:52PM
Hello

I realized I need to stipulate the indicator described above should only track the most recent close above or below the 5d mav. That is to say, if the most recent close is above the mav, the indicator plots #1 above, if the most recent close is below the mav, the indicator plots #2 above.

Thanks... Dan
Sorry, only registered users may post in this forum.

Click here to login