TOS Scan for "imaginary" horizontal price level

J@ckJ@ck

New member
I would like to know if anyone thinks it is possible for TOS to scan for a price level that only Candle wicks have passed through.

For example: In the past 120 days scan for a price level that does not fall within the open or close of any candle on a weekly timeframe AND that has 4 or more weekly candle wicks passing through it.

It sounds impossible from the get-go go but I wanted to see if anyone has something similar to it or knows how to do it. Thanks!

Solution
No can do, sorry.

Here is what I was working on, its nowhere near finished, but its already running into fold iteration limitations.

Ruby:
``````Def Highest; Def Lowest; Def PriceLevel;
Highest =
if High > Highest[1]
then High
else Highest[1]
;
Lowest =
if low < Lowest[1]
then Low
else Lowest[1]
;
if !isNaN(close) and isNaN(close[-1]) {
PriceLevel =
Fold index = Lowest * 100 to highest * 100
with Price = Double.NaN
while isNaN(Price) do
if
Fold i = 0 to BarNumber() with p = no
while p == no do
if between(
Index * 0.01,
getvalue(open,i),
getvalue(close,i)
)
then yes else p...``````
No can do, sorry.

Here is what I was working on, its nowhere near finished, but its already running into fold iteration limitations.

Ruby:
``````Def Highest; Def Lowest; Def PriceLevel;
Highest =
if High > Highest[1]
then High
else Highest[1]
;
Lowest =
if low < Lowest[1]
then Low
else Lowest[1]
;
if !isNaN(close) and isNaN(close[-1]) {
PriceLevel =
Fold index = Lowest * 100 to highest * 100
with Price = Double.NaN
while isNaN(Price) do
if
Fold i = 0 to BarNumber() with p = no
while p == no do
if between(
Index * 0.01,
getvalue(open,i),
getvalue(close,i)
)
then yes else p
== no then index else double.nan
;
;
} else {
PriceLevel = Double.NaN;
}

plot x = pricelevel;``````

Last edited:
No can do, sorry.

Here is what I was working on, its nowhere near finished, but its already running into fold iteration limitations.

Ruby:
``````Def Highest; Def Lowest; Def PriceLevel;
Highest =
if High > Highest[1]
then High
else Highest[1]
;
Lowest =
if low < Lowest[1]
then Low
else Lowest[1]
;
if !isNaN(close) and isNaN(close[-1]) {
PriceLevel =
Fold index = Lowest * 100 to highest * 100
with Price = Double.NaN
while isNaN(Price) do
if
Fold i = 0 to BarNumber() with p = no
while p == no do
if between(
Index * 0.01,
getvalue(open,i),
getvalue(close,i)
)
then yes else p
== no then index else double.nan
;
;
} else {
PriceLevel = Double.NaN;
}

plot x = pricelevel;``````
Sorry for the late reply. Thanks for trying! Let me know if you have any breakthroughs

I would like to know if anyone thinks it is possible for TOS to scan for a price level that only Candle wicks have passed through.

For example: In the past 120 days scan for a price level that does not fall within the open or close of any candle on a weekly timeframe AND that has 4 or more weekly candle wicks passing through it.

It sounds impossible from the get-go go but I wanted to see if anyone has something similar to it or knows how to do it. Thanks!

here is a different way of approaching the problem.
would it be of use to have a visual, a column of color after the last bar?
where clouds are drawn over the prices ranges of the weekly open/close, with horizontal gaps where there is no range.

Ruby:
``````# wicklines_futurecloud_00b

def bn = barnumber();
def na = double.nan;

def lastbarbn = highestall( if !isnan(close) then bn else 0 );
def lastbar = if bn == lastbarbn then 1 else 0;

input future = 0;
def x1 = lastbar[future];
input cldwide = 6;

def cldx = if (bn >= lastbarbn + future and bn <= lastbarbn + future + cldwide) then 1 else 0;

input show_agg_clouds = yes;
def agg = AggregationPeriod.week;
def o = open( period=agg)[0];
def c = close( period=agg)[0];
plot z1 = if show_agg_clouds then o else na;
plot z2 = if show_agg_clouds then c else na;
z1.setdefaultcolor(getcolor(6));
z2.setdefaultcolor(getcolor(5));
z1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);

#  green / red
#input col1 = 6;
#input col2 = 5;

input col1 = 9;
input col2 = 9;

#-----------------------------
#set1 , repeat 24x
def oagg = open( period=agg)[0+future];
def cagg = close( period=agg)[0+future];
addcloud( (if cldx then oagg else na), (if cldx then cagg else na), getcolor(col1), getcolor(col2) );

#-----------------------------

#-----------------------------
# set2
def oagg2 = open( period=agg)[1+future];
def cagg2 = close( period=agg)[1+future];
addcloud( (if cldx then oagg2 else na),(if cldx then cagg2 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set3
def oagg3 = open( period=agg)[2+future];
def cagg3 = close( period=agg)[2+future];
addcloud( (if cldx then oagg3 else na),(if cldx then cagg3 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set4
def oagg4 = open( period=agg)[3+future];
def cagg4 = close( period=agg)[3+future];
addcloud( (if cldx then oagg4 else na),(if cldx then cagg4 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set5
def oagg5 = open( period=agg)[4+future];
def cagg5 = close( period=agg)[4+future];
addcloud( (if cldx then oagg5 else na),(if cldx then cagg5 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set6
def oagg6 = open( period=agg)[5+future];
def cagg6 = close( period=agg)[5+future];
addcloud( (if cldx then oagg6 else na),(if cldx then cagg6 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set7
def oagg7 = open( period=agg)[6+future];
def cagg7 = close( period=agg)[6+future];
addcloud( (if cldx then oagg7 else na),(if cldx then cagg7 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set8
def oagg8 = open( period=agg)[7+future];
def cagg8 = close( period=agg)[7+future];
addcloud( (if cldx then oagg8 else na),(if cldx then cagg8 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set9
def oagg9 = open( period=agg)[8+future];
def cagg9 = close( period=agg)[8+future];
addcloud( (if cldx then oagg9 else na),(if cldx then cagg9 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set10
def oagg10 = open( period=agg)[9+future];
def cagg10 = close( period=agg)[9+future];
addcloud( (if cldx then oagg10 else na),(if cldx then cagg10 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
#-----------------------------
# set11
def oagg11 = open( period=agg)[10+future];
def cagg11 = close( period=agg)[10+future];
addcloud( (if cldx then oagg11 else na),(if cldx then cagg11 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set12
def oagg12 = open( period=agg)[11+future];
def cagg12 = close( period=agg)[11+future];
addcloud( (if cldx then oagg12 else na),(if cldx then cagg12 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set13
def oagg13 = open( period=agg)[12+future];
def cagg13 = close( period=agg)[12+future];
addcloud( (if cldx then oagg13 else na),(if cldx then cagg13 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set14
def oagg14 = open( period=agg)[13+future];
def cagg14 = close( period=agg)[13+future];
addcloud( (if cldx then oagg14 else na),(if cldx then cagg14 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set15
def oagg15 = open( period=agg)[14+future];
def cagg15 = close( period=agg)[14+future];
addcloud( (if cldx then oagg15 else na),(if cldx then cagg15 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set16
def oagg16 = open( period=agg)[15+future];
def cagg16 = close( period=agg)[15+future];
addcloud( (if cldx then oagg16 else na),(if cldx then cagg16 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set17
def oagg17 = open( period=agg)[16+future];
def cagg17 = close( period=agg)[16+future];
addcloud( (if cldx then oagg17 else na),(if cldx then cagg17 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set18
def oagg18 = open( period=agg)[17+future];
def cagg18 = close( period=agg)[17+future];
addcloud( (if cldx then oagg18 else na),(if cldx then cagg18 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set19
def oagg19 = open( period=agg)[18+future];
def cagg19 = close( period=agg)[18+future];
addcloud( (if cldx then oagg19 else na),(if cldx then cagg19 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set20
def oagg20 = open( period=agg)[19+future];
def cagg20 = close( period=agg)[19+future];
addcloud( (if cldx then oagg20 else na),(if cldx then cagg20 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
#-----------------------------
# set21
def oagg21 = open( period=agg)[20+future];
def cagg21 = close( period=agg)[20+future];
addcloud( (if cldx then oagg21 else na),(if cldx then cagg21 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set22
def oagg22 = open( period=agg)[21+future];
def cagg22 = close( period=agg)[21+future];
addcloud( (if cldx then oagg22 else na),(if cldx then cagg22 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set23
def oagg23 = open( period=agg)[22+future];
def cagg23 = close( period=agg)[22+future];
addcloud( (if cldx then oagg23 else na),(if cldx then cagg23 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set24
def oagg24 = open( period=agg)[23+future];
def cagg24 = close( period=agg)[23+future];
addcloud( (if cldx then oagg24 else na),(if cldx then cagg24 else na),getcolor(col1),getcolor(col2) );
#-----------------------------

#-----------------------------
# setx
input test_range = no;
def r = 1;
def oaggx = if test_range then open( period=agg)[r+future] else na;
def caggx = close( period=agg)[r+future];
addcloud( (if cldx[3] then oaggx else na),(if cldx[3] then caggx else na),getcolor(5),getcolor(5) );
#-----------------------------

#``````

TTWO 2hr 90day

Not the exact question you're looking for?

87k+ Posts
134 Online

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?