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
April 10, 2016 06:29AM
Tanman, I really appreciate all your help. Thank you . I do have another request. I'm looking for a thinkscript to notify you of a hook reversal pattern with a slow stochastics overbought or oversold. In the pattern you would need 4 or 5 consecutive red or green bars all with closes higher/ lower than previous day. Maybe a dot forming above the candle or arrow above the high of the fifth bar and on. With stochastics in agreement.

This wouldn't be an entry by itself, I would use this as too far too fast. So the first candle that opened below the pivot in an uptrend is a possible reversal or at least a reversion back to the mean.

If you could code up something like this that would be great! Thanks again for all your hard work.
Re: Fun with ThinkScript
April 12, 2016 03:59PM
Hi! Anyone knows how to do a simple compound operation with fold?
For example every time THIS CONDITION IS TRUE then + 1??

Thanks!
Re: Fun with ThinkScript
April 12, 2016 05:55PM
-



Edited 1 time(s). Last edit at 05/05/2016 09:50PM by FluffyClouds.
Re: Fun with ThinkScript
April 13, 2016 07:17AM
please anyone,
i would like to have an indicator to chart this concept..Tanman, I believe did something similar with a coefficient but it is always moving.. this would plot the 20 Period ATR RANGE above and below on the chart ..and would change color if either is breached but would not move during the CURRENT DAY


[screencast.com]

[screencast.com]

[screencast.com]


thanks in advance..ht65!
Tom Demark 13 sell signal indicator
April 15, 2016 08:53PM
Hi all,

I've been reading some interesting stuff about this indicator. I know a very successful professional trader that calls it "the most powerful indicator in the market" I found the thinkscript code below (generic version) it seems to work fairly well but I cant be sure it fires at the time the indicator is suppose to. I would also like to scan for the conditions "buy" and "sell", if someone can look at the script and ad a scan code I would appreciate it. You may also want to reference the web site link below that explains the study to check if the data is correct

(generic 13 counter)

declare upper;def Data1 = reference sequenceCounter(13,9)."Perfect Buy";def Data2 = reference sequenceCounter(13,9)."Perfect Sell";def Data3 = reference sequenceCounter(13,9)."Perfect Array Buy";def Data4 = reference sequenceCounter(13,9)."Perfect Array Sell";Alert(data1,"Perfect Buy",alert.BAR,sound.bell);Alert(data2,"Perfect Sell",alert.BAR,sound.bell);Alert(data3,"Perfect Array Buy",alert.BAR,sound.bell);Alert(data4,"Perfect Array Sell",alert.BAR,sound.bell);

Description of indicator for reference:

[tradetrekker.wordpress.com]
Tracking IV on previous earning dates
April 17, 2016 01:59PM
Hello Fellow Traders,

I have been reading all the posts around Earnings and learnt a lot from them.

I have a question..

Does anyone know how to pick out the IV on specific earning days in the past? I am using TOS and would like to know what the IV was during the past 4 earnings days inorder to calculate the average. I want to incorporate this into a scan so that all stocks with upcoming earnings will show up where the Avg IV was around 50% above its normal IV.

Appreciate your help.

Thanks smiling smiley
Re: Tracking IV on previous earning dates
April 18, 2016 11:17AM
As I recall, Robert has some earnings scripts on his website that may do what you need.
Re: Fun with ThinkScript
April 20, 2016 09:16AM
Trying to find an upper study that will show me the 15 and 30 opening range.
Re: Fun with ThinkScript
April 20, 2016 11:41AM
TexasJohn Wrote:
-------------------------------------------------------
> Trying to find an upper study that will show me
> the 15 and 30 opening range.

Robert posted one here about a year ago.

# Opening Range
# Change the opening range period (5 min, 30 min, etc.) from within the settings panel
# Opening range is drawn in yellow
# Range break-out lines are drawn in green
# Robert Payne
# [rrpayne.blogspot.com]

input agg = AggregationPeriod.Thirty_MIN;
input ShowTodayOnly = yes;
def today = if !ShowTodayOnly then 1 else GetDay() == GetLastDay();
def lookback = SecondsFromTime(0930) / GetAggregationPeriod() * 1000;

plot ORh = if !today then double.nan else GetValue(high(period = agg), lookback);
ORh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ORh.SetDefaultColor(Color.YELLOW);
ORh.SetLineWeight(2);
plot ORl = if !today then double.nan else GetValue(low(period = agg), lookback);
ORl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ORl.SetDefaultColor(Color.YELLOW);
ORl.SetLineWeight(2);

def dailyRange = high(period = "day" )[1] - low(period = "day" )[1];
def range = Average(dailyRange, 10);

plot entryLine1 = if !today then double.nan else ORh + (range * 0.06);
entryLine1.SetDefaultColor(Color.GREEN);
entryLine1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

plot entryLine2 = if !today then double.nan else ORl - (range * 0.06);
entryLine2.SetDefaultColor(Color.GREEN);
entryLine2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

AssignBackgroundColor(if (close > ORh and close > high[1]) then CreateColor(102, 119, 58) else if (close < ORl and close < low[1]) then CreateColor(141, 80, 62) else color.current);
Re: Fun with ThinkScript
April 21, 2016 10:45PM
Greeting thinkscripters -

Have been looking over the net trying to find some info on the coding of candles, and in this particular case, gaps, etc.


I have cobbled together pieces of things that seem like they should work, but clearly I am missing something. Any pointers to info or where I am wrong would be most appreciated.

I’d like to paint an arrow that shows where the open opens below the lower candle body of 1 bar ago.

For a bar 1 bar ago that is an up close, that lower body would be the open.

For a bar 1 bar ago that is a down close, that lower body would be the close.

If the current open opens below either of the above, by one or more increments (Tick, Pip, cent), plot an arrow.

Again, any thoughts would be most appreciated!

Thanks -
Re: Fun with ThinkScript
April 22, 2016 01:48PM
Hello All,

Wow what a great find!!! I have spent the last few hours reading this forum. You skill in thinkscript is incredible.

I was wondering if anyone would be able to help me out with 2 indicators.

Indicator #1- 5m chart
A. Last candle opens below 9 ema and 20 ema.
B. Last candle close above 9ema and 20 ema.
C. Last candle close below most recent pivot high or peak
D. Alert when the current candle opens above theEMAs and paint the last candle dark green with an up arrow underneath.
E. opposite for a short set up.

Indicator #2 - just a bit of code

I just need a script that will scan for stocks that are consolidating or coiling near a moving average.


If anybody could help with this i would greatly appreciate it. I have been searching high and low for this with no luck.

Thanks in advance.
Re: Fun with ThinkScript
April 25, 2016 04:47PM
.



Edited 1 time(s). Last edit at 05/05/2016 09:53PM by FluffyClouds.
Re: Fun with ThinkScript
April 28, 2016 02:55PM
I am learning the script and would appreciate help with plotting a horizontal line on a 5 minute chart from say the closing bar of 7 am to 8 am, and then another line from the closing bar of 8 am to 9 am, etc.

Thanks!
Re: Fun with ThinkScript
April 28, 2016 10:09PM
Hi Everyone

Is there any way to increase label font size on chart ,Please help me on this
Any help greatly appreciated
Re: Fun with ThinkScript
April 29, 2016 09:16AM
rob miller,


I would love some help with getting alerts with the "E" Success system when we have

plot dotUp1 = if bulltrade and !bulltrade[1] then low - 1 else Double.NaN; 
dotUp1.SetPaintingStrategy(PaintingStrategy.POINTS); 
dotUp1.SetLineWeight(5); 
dotUp1.SetDefaultColor(Color.blue); 
plot dotDn1 = if beartrade and !beartrade[1] then high + 1.0 else Double.NaN; 
dotDn1.SetPaintingStrategy(PaintingStrategy.POINTS); 
dotDn1.SetLineWeight(5); 
dotDn1.SetDefaultColor(Color.dark_red);

I'm thinking the alert think script should look like

alert(dotUp1, getsymbol() + " Bull E Trade Signal", alert.bar, sound.bell);
alert(dotDn1, getsymbol() + " bear E Trade ", alert.bar, sound.bell);

Am I close? what am I missing?



Edited 1 time(s). Last edit at 05/02/2016 08:57AM by TexasJohn.
Re: Fun with ThinkScript
May 01, 2016 05:48PM
Hi Guys,

I have been working on my previous request but have been running into a few issues. The short entries have for the most part been spot on. I have, however, been unsuccessful with the long entries. Do you have any suggestions on the long conditions based on the short ones? Also how do I scan for stocks that have triggered the short or long entry?

Example of code working

Any suggestions would be helpful. thanks

input magnitude = 3; 
def ema9 = ExpAverage(close, 9);
def ema20 = ExpAverage(close, 20);

# define and plot the most recent peak 
def peak = high >= Highest(high[1], magnitude) and high >= Highest(high[-magnitude], magnitude); 
def peakvalue = if BarNumber() < magnitude then Double.NaN else if peak then high else Double.NaN; 

# define and plot the most recent valley 
def valley = low <= Lowest(low[1], magnitude) and low <= Lowest(low[-magnitude], magnitude); 
def valleyvalue = if BarNumber() < magnitude then Double.NaN else if valley then low else Double.NaN; 

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

########High Volume########

def HighVol =  volume > average(volume,20);

 
####Long Condition###
def crossabove9 = (open < ema9) and  (close > ema9);
def above20 = open < ema20 and close > ema20;
#def belowHigh = close > peak;
def maUP = ema9 < ema20;
plot LongEntry = if crossabove9 and above20 and maUP  then 1 else 0;

LongEntry.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); 
LongEntry.AssignValueColor(color.GREEN); 
LongEntry.SetLineWeight(3); 
Alert(LongEntry, "Go Long!!", Alert.bar, Sound.Ring);



####Short Condition###
def crossbelow9 = (open > ema9) and  (close < ema9);
def below20 = (open and close) < ema20;
def aboveLow = open  > valley;
def maDN = ema9 < ema20;
plot ShortEntry = if crossbelow9  and aboveLow and HighVol and maDN and below20 then 1 else 0;
ShortEntry.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down); 
ShortEntry.AssignValueColor(color.RED);
ShortEntry.SetLineWeight(3); 
Alert(ShortEntry, "GO SHORT!!!", Alert.bar, Sound.Ring);

# paint entry candle if user so desires
input PaintEntryCandle = yes;
AssignPriceColor(if PaintEntryCandle and  ShortEntry then Color.red else Color.CURRENT);
AssignPriceColor(if PaintEntryCandle and LongEntry  then color.yellow else Color.CURRENT);



Edited 1 time(s). Last edit at 05/01/2016 05:57PM by BenT.
Re: Fun with ThinkScript
May 02, 2016 09:27AM
The alert code seems to be working. Why I am not getting are text to my phone?

alert(dotUp1, getsymbol() + " Bull E Trade Signal", alert.bar, sound.bell);
alert(dotDn1, getsymbol() + " bear E Trade ", alert.bar, sound.bell);







Edited 3 time(s). Last edit at 05/02/2016 09:34AM by TexasJohn.
Re: Fun with ThinkScript
May 02, 2016 09:08PM
Quick question,

Trying to make a simple gap scan that compares the current mark or open price to yesterday's close price. This is what i have so far. Doesn't seem to work correctly but it runs. Also can't get the scan to work with premarket prices.

def closing = close[1];
def opening = open;
def numerator = opening - closing;
plot scan = numerator/opening*100 >= 3;

Any help is greatly appreciated
Re: Fun with ThinkScript
May 03, 2016 07:51AM
Hey guys I have a question if anyone can help me write a script on Range bars. Basically what I need is calculate the range bar from the open to the close up and down and show me two lines where it might end up. Preferably to any tick size range bar.





Edited 2 time(s). Last edit at 05/03/2016 07:55AM by Dnice638.
Re: Fun with ThinkScript
May 03, 2016 01:47PM
thanks again TanMan, I have always been very interested in Elder's work and divergences in general. I have exchanged email with him on occasions. One thing I dont understand is why he dismisses hidden divergences when comparing them to regular divergences. Hidden divergences follow the trend which should be more reliable right? I asked him that same question and his response was:

"why do you want to use something that doesn't work? "

I find it very hard to understand why regular would work but not hidden.

If you have any other studies or insights regarding divergences please, let me know... thanks





tanman Wrote:
-------------------------------------------------------
> fvaldez and jakesdad,
>
> You are welcome. This has been very useful to me
> as well, and I thank you fvaldez for bringing
> Elder's rules to my attention. Thank you jakesdad
> for offering me other divergence scripts and I
> will let you know when I need them. Previously, I
> have used momentum divergence based on modified
> AwesomeOscillator lower study with settings of
> 7/14/exponential which also works very well.
> Recently, I have invented a new volume based lower
> study to be used for divergence in /ES and SPY
> which has shown amazing performance. I am still
> testing it in real time so it might need to be
> fine tuned. I am also working on a script based on
> it to paint divergence arrows on upper chart, and
> coding that upper study has been extremely
> challenging.
>
> I will have to check the alerts for the MACD
> divergence script in real time during trading
> hours. I think playing around with the [1] in the
> alert line and changing it to [2] or removing it
> might work.
>
> As far as scans are concerned, the script that I
> posted has a "plot" for Diff at the beginning
> which needs to be changed to "def", so there is
> only one plot line in the scan script.
> Additionally, you might have to add [1] or [2] or
> [3] etc. to the divergence signal variable. My
> scan worked when I added [3]. For example,
> following is the scan for bearish divergence and
> you can modify script in similar way for scanning
> other divergences.
>
> I changed the default number of bars to determine
> swing high/low to 4 because it gives better
> results in my experience. You can change it to
> whatever you like. I also added input for filter
> number to eliminate tiny divergences. You can set
> it to 0 if you want to see every divergence, even
> if it is microscopic, or increase it if you want
> to see only strong divergences. In my experience
> 0.005 gives good results.
>
>
> input bar = 4;
> input filter = 0.005;
>
> input fastLength = 12;
> input slowLength = 26;
> input MACDLength = 9;
> input averageType = AverageType.EXPONENTIAL;
>
> def Diff = MACD(fastLength, slowLength,
> MACDLength, averageType).Diff;
>
> def SwingHigh = Diff > 0 and Diff >=
> highest(Diff[1], bar) and Diff >=
> highest(Diff[-bar], bar);
> def SHprice = if SwingHigh then Diff else
> SHprice[1];
> def SHBar = if SwingHigh then BarNumber() else
> SHBar[1];
> def CrossBarL = if Diff crosses below 0 then
> BarNumber() else CrossBarL[1];
>
> def SwingLow = Diff < 0 and Diff <=
> lowest(Diff[1], bar) and Diff <=
> lowest(Diff[-bar], bar);
> def SLprice = if SwingLow then Diff else
> SLprice[1];
> def SLBar = if SwingLow then BarNumber() else
> SLBar[1];
> def CrossBarH = if Diff crosses above 0 then
> BarNumber() else CrossBarH[1];
>
> def SHSP = if SwingHigh then high else SHSP[1];
> def SLSP = if SwingLow then low else SLSP[1];
>
> def BearDiv = Diff > 0 and CrossBarL[1] > SHBar[1]
> and Diff < SHprice[1] and high > SHSP[1] and
> SHprice[1] - Diff > filter;
> def BullDiv = Diff < 0 and CrossBarH[1] > SLBar[1]
> and Diff > SLprice[1] and low < SLSP[1] and Diff -
> SLprice[1] > filter;
> def HiddenBearDiv = Diff > 0 and Diff > SHprice[1]
> and high < SHSP[1] and Diff - SHprice[1] > filter;
>
> def HiddenBullDiv = Diff < 0 and Diff < SLprice[1]
> and low > SLSP[1] and SLprice[1] - Diff > filter;
>
>
> plot BearD = BearDiv[3];
Re: Fun with ThinkScript
May 03, 2016 01:49PM
jakesdad Wrote:
-------------------------------------------------------
> Tanman, I like the Macd Divergence study you
> posted. I have always been intrigued by divergence
> and have several studies. I modified your code
> with the following lengths: 16,97,2 and like the
> results. I am however having problems scanning for
> the condition, do you have some scan code to help
> recognize the divergence when it occurs? Also I
> have not been able to get your alert to work, have
> you tested the alerts?
>
> appreciate your work and let me know if your
> interested in some more divergence studies

Hi JakesDad, I am also a very passionate divergence student. Can you share some of the studies you have??
Re: Fun with ThinkScript
May 03, 2016 07:05PM
Here's one of my favorites by the great Mobius


plot Data = close;# Mobius at MyTrade
# V01.08.10

input nSMA = 20;
input StDevMult = 2.0;
input ATRfactor = 1.5;
input LineLimit = 200;
input Detrend = 0;
input OnExpansion = yes;
input nRSI = 14;
input OverBought = 70;
input OverSold = 30;
input MidLine = 50;

# Global definitions
def h = high;
def l = low;
def c = close;
def barNumber = barNumber();

# Display Line
def bar = if IsNaN(c)
then Double.NaN
else BarNumber();
def ThisBar = HighestAll(bar) - Detrend;
def cLine = if bar == ThisBar
then c
else Double.NaN;
def cond1 = CompoundValue(1, if IsNaN(c)
then cond1[1]
else c, c);
def location = if ThisBar - LineLimit <= bar
then HighestAll(cLine)
else Double.NaN;

plot ExpLine = if OnExpansion and
IsNaN(c)
then cond1
else Double.NaN;
ExpLine.SetStyle(Curve.SHORT_DASH);
ExpLine.SetLineWeight(1);
ExpLine.SetDefaultColor(CreateColor(150, 150, 150));

# Bollinger Bands and Keltner Channel - Squeeze
def sDev = StDev(c, nSMA);
def Avg = Average(c, nSMA);
def UpperBand = Avg + StDevMult * sDev;
def shift = ATRfactor * Average(TrueRange(h, c, l), nSMA);
def Upper_Band = Avg + shift;
def Squeeze = UpperBand < Upper_Band;
plot SqueezePoints = if Squeeze then location else Double.NaN;
SqueezePoints.SetPaintingStrategy(PaintingStrategy.POINTS);
SqueezePoints.SetDefaultColor(Color.YELLOW);
SqueezePoints.SetLineWeight(2);

# RSI Wilder with Divergence Markers
def NetChgAvg = WildersAverage(c - c[1], nRSI);
def TotChgAvg = WildersAverage(AbsValue(c - c[1]), nRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);

plot RSIOB = if RSI > OverBought then location else Double.NaN;
RSIOB.SetPaintingStrategy(PaintingStrategy.SQUARES);
RSIOB.SetLineWeight(3);
RSIOB.SetDefaultColor(Color.RED);
plot RSIOS = if RSI < OverSold then location else Double.NaN;
RSIOS.SetPaintingStrategy(PaintingStrategy.SQUARES);
RSIOS.SetLineWeight(3);
RSIOS.SetDefaultColor(Color.CYAN);

def lowestLow = if RSI > OverSold
then l
else if RSI < OverSold and
l < lowestLow[1]
then l
else lowestLow[1];
def lowestRSI = if RSI > MidLine
then RSI
else if RSI < MidLine and
RSI < lowestRSI[1]
then RSI
else lowestRSI[1];
def divergentLow = if RSI < OverSold and
l <= lowestLow[1] and
RSI > lowestRSI[1]
then location
else Double.NaN;
plot DLow = divergentLow;
DLow.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
DLow.SetLineWeight(2);
DLow.SetDefaultColor(Color.VIOLET);

def highestHigh = if RSI < OverBought
then h
else if RSI > OverBought and
h > highestHigh[1]
then h
else highestHigh[1];
def highestRSI = if RSI < MidLine
then RSI
else if RSI > MidLine and
RSI > highestRSI[1]
then RSI
else highestRSI[1];
def divergentHigh = if RSI > OverBought and
h >= highestHigh[1] and
RSI < highestRSI[1] and
cond1 within 3 bars
then location
else Double.NaN;

plot DHigh = divergentHigh;
DHigh.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
DHigh.SetLineWeight(3);
DHigh.SetDefaultColor(Color.PLUM);

plot NaN = if IsNaN(c) then Double.NaN else location ;
NaN.SetPaintingStrategy(PaintingStrategy.POINTS);
NaN.SetDefaultColor(Color.BLUE);
NaN.SetLineWeight(3);
Re: Fun with ThinkScript
May 05, 2016 02:46PM
does this Code work for you? for some reason its not giving me any info sad smiley
Re: Fun with ThinkScript
May 08, 2016 07:53AM
Changing the color of AddLabel per a variable value:

I'd like for the AddLabel for the todayvol variable to be light green if it is greater than the previous day, pink if less than then previous day, and white if it is the same as the previous day; rare but needs to be there.

This is the code so far:

def yesterdayvol = volume(period = ”DAY”)[1];
def todayvol = volume(period = ”DAY”);
def volg = todayvol is greater than yesterdayvol;
def voll = todayvol is less than yesterdayvol;


AddLabel(yes, "Y_Vol: " + yesterdayvol, Color.white);

This last line of code is where the error is and can't figure it out. I've looked through the thread and found a few similar posts with the E Success info but still stuck.

AddLabel(yes, "T_Vol: " + todayvol, if volg then Color.light_green else if voll then color.pink else color.white);

Thanks



Edited 2 time(s). Last edit at 05/08/2016 09:03AM by Palmer.
Re: Fun with ThinkScript
May 08, 2016 09:35AM
Nevermind...got it. Those darn parenthesis....
Re: Fun with ThinkScript
May 09, 2016 08:16AM
Well...still have an issue:

The code compares the volume from today to the previous day. I have this running on a 1minute chart so I don't have to switch to a daily chart to see the volume value from yesterday. I neglected to take into account the break from Friday to Monday so here is an edit:

input PDaysBack = 2;

def yesterdayvol = volume(aggregationPeriod.DAY [PDaysBack];
def todayvol = volume(period = ”DAY”);
def volg = todayvol is greater than yesterdayvol;
def voll = todayvol is less than yesterdayvol;


AddLabel(yes, "Y_Vol: " + yesterdayvol, Color.light_gray);

AddLabel(yes, ("T_Vol: " + todayvol), if todayvol > yesterdayvol then Color.lime else if todayvol < yesterdayvol then color.red else color.light_gray);

But I am getting an error from the second line of code def yesterdayvol = volume(aggregationPeriod.DAY [PDaysBack]; that is giving me an Invalid Statement def

This needs to compare the previous Day volume so Day has to be designated so it does not look at the minute bars that the label is on.

Any thoughts?
Re: Fun with ThinkScript
May 09, 2016 05:35PM
Figured that one out...now the next...

A simple addition to the scan page to look for stocks that closed up 20% as compared to the previous day:

In this example the code compares the close of 6 days ago to the close 5 days ago to look for those stocks that closed up greater than 20%. I'm getting stocks that closed above and below the 20%. Can't see why. I do have some volume and price parameters set in the scan to limit some of the results but it's still incorrect. It is being run with the time frame set to D for day.

def firstday = close[6];
def secondday = close[5];

def change = secondday - firstday;
def diff = change /firstday;
def percentchange = diff *100;

plot moveup = percentchange > 20;

Thanks
Re: Fun with ThinkScript
May 13, 2016 05:31AM
Hi everyone,
I would like to know if someone could help me create a script who could signal
with an arrow when the 8 SMA and the 13 SMA cross each other.

Thank you for the consideration
Re: Fun with ThinkScript
May 13, 2016 09:29AM
Just use their script ... plug in your 8 / 13
Re: Fun with ThinkScript
May 13, 2016 10:22AM
Palmer Wrote:
-------------------------------------------------------
> Figured that one out...now the next...
>
> A simple addition to the scan page to look for
> stocks that closed up 20% as compared to the
> previous day:
>
> In this example the code compares the close of 6
> days ago to the close 5 days ago to look for those
> stocks that closed up greater than 20%. I'm
> getting stocks that closed above and below the
> 20%. Can't see why. I do have some volume and
> price parameters set in the scan to limit some of
> the results but it's still incorrect. It is being
> run with the time frame set to D for day.
>
> def firstday = close[6];
> def secondday = close[5];
>
> def change = secondday - firstday;
> def diff = change /firstday;
> def percentchange = diff *100;
>
> plot moveup = percentchange > 20;
>
> Thanks




Palmer,

you can use this:

def  FD = close[6];
def SD = close[5];


def pctChg =  ((sd - fd) / fd) * 100; 

plot scan= if  pctchg >= 20 then 1 else 0;
Sorry, only registered users may post in this forum.

Click here to login