• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Scan for Low Tail Year Candles

we29125

Member
I can't get this scan to work. Can someone help ?

Code:
def agg = AggregationPeriod.YEAR;

def ydiff = (high(period = AggregationPeriod.YEAR)[1] - low(period = AggregationPeriod.YEAR)[1]);

(low(period=agg) >= (open(period=agg)-(ydiff*0.24)) and close >= (open(period=agg)))  or

(high(period=agg) <= ((open(period=agg)+(ydiff*0.24)) and close <= (open(period=agg)));
 

MerryDay

Well-known member
VIP
@we29125 The last 2 lines of code are undefined. Removing them solves your syntax problem.

But as there is no plot or label, this code will not provide any information in a chart, watchlist, or scan.
 
Last edited:

generic

Active member
@we29125
Code:
def agg = AggregationPeriod.YEAR;

def ydiff = (high(period = AggregationPeriod.YEAR)[1] - low(period = AggregationPeriod.YEAR)[1]);

plot data = (low(period=agg) >= (open(period=agg)-(ydiff*0.24)) and
            close >= open(period=agg))
            or
            (high(period=agg) <= (open(period=agg)+(ydiff*0.24)) and
            close <= open(period=agg));
 

we29125

Member
Pc8RP8t.jpg


I think secondary period can't work.
 

divinci01

New member
Trying to figure out a way to scan for quarterly and yearly time-frames. When you add a filter to scans, the highest timeframe only shows monthly. Would like to be able to scan for inside year and quarterly bars. Any help would be appreciated.
 

XeoNoX

Well-known member
VIP
@Mandalorianknight63 @divinci01 with thinkscript the quarterly is pretty much just 12/4 -- so every 3 months beginning with Jan-March being Q1, so you would just define the Months of Jan Feb March.. and so on and so forth and set the aggregation to monthly.

if you want lower aggregation you can set to days and get creative

example 15 percent from the high in last 6 months

Code:
input Months = 6; #Months you want to scan for

input days_In_Trading_Month = 21; # average trading days in a month

input price = close;

input Pct = 15; #percent below highestHigh

Def Total_Days = Months * days_In_Trading_Month;

Def Close_True = if close <= ((1 - Pct/100) * Highest(Price,Total_Days)) then 1

else 0;

Plot scan = if Close_True then 1 else 0;
 
Last edited:

Similar threads

Top