Hi Sally, if i am trying to plot only for current month using GetMonth() != GetMonth()[1] . its acting weired. can you pls help to plot for current month pls.
Code:#HL_Month input showcurrentonly = yes; def hi = if GetMonth() != GetMonth()[1] then high(period = AggregationPeriod.DAY) else hi[1]; plot h = if showcurrentonly and GetMonth() != GetLastMonth() then Double.NaN else hi; h.SetPaintingStrategy(PaintingStrategy.DASHES); h.SetDefaultColor(Color.GREEN); def lo = if GetMonth() != GetMonth()[1] then low(period = AggregationPeriod.DAY) else lo[1]; plot l =...
HI, I am trying to plot 1st Day of the month's High and LOW . i want to use this as a range for my Swings for that month.
Code:#HL_Month def hi = if GetMonth() != GetMonth()[1] then high else hi[1]; plot h = hi; h.SetPaintingStrategy(PaintingStrategy.DASHES); h.setdefaultColor(color.green); def lo = if GetMonth() != GetMonth()[1] then low else lo[1]; plot l = lo; l.SetPaintingStrategy(PaintingStrategy.DASHES); l.setdefaultColor(color.red); input cloud = no; defineGlobalColor("Cloud", color.light_gray); addcloud(if !cloud then double.nan else h, l, globalColor("Cloud"), globalColor("Cloud")); #
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Hi Sally, if i am trying to plot only for current month using GetMonth() != GetMonth()[1] . its acting weired. can you pls help to plot for current month pls.This plots those lines and has an optional cloud.
Hi Sally, if i am trying to plot only for current month using GetMonth() != GetMonth()[1] . its acting weired. can you pls help to plot for current month pls.
Code:#HL_Month input showcurrentonly = yes; def hi = if GetMonth() != GetMonth()[1] then high(period = AggregationPeriod.DAY) else hi[1]; plot h = if showcurrentonly and GetMonth() != GetLastMonth() then Double.NaN else hi; h.SetPaintingStrategy(PaintingStrategy.DASHES); h.SetDefaultColor(Color.GREEN); def lo = if GetMonth() != GetMonth()[1] then low(period = AggregationPeriod.DAY) else lo[1]; plot l = if showcurrentonly and GetMonth() != GetLastMonth() then Double.NaN else lo; l.SetPaintingStrategy(PaintingStrategy.DASHES); l.SetDefaultColor(Color.RED); input cloud = no; DefineGlobalColor("Cloud", Color.LIGHT_GRAY); AddCloud(if !cloud then Double.NaN else h, l, GlobalColor("Cloud"), GlobalColor("Cloud")); #
Hi Sleepyz, Thank you . Trying to see how can we draw the range for Highs and lows of 1st 10 business days of the month(January for example ) . I see above has different approaches which cant be used to find out for 10 days. can you help meThis should plot just the current month's h/l. This version should also work on intraday charts with enough days displayed on the chart for the month.
Hi Sleepyz, Thank you . Trying to see how can we draw the range for Highs and lows of 1st 10 business days of the month(January for example ) . I see above has different approaches which cant be used to find out for 10 days. can you help me
Thank you
Code:#Plot H/L 1st 10 trading days of Last Month Extended input days = 10; def ymd = GetYYYYMMDD(); def ct = if GetMonth() != GetMonth()[1] and ymd then 1 else if ymd != ymd[1] then ct[1] + 1 else ct[1]; def h = if isnan(close) then h[1] else if ct[1] != 1 and ct == 1 then high else if ct <= days then Max(high, h[1]) else h[1]; plot hh_x_days = if GetMonth() != GetLastMonth() then Double.NaN else h; def l = CompoundValue(1, if isnan(close) then l[1] else if ct[1] != 1 and ct == 1 then low else if ct <= days then Min(low, l[1]) else l[1], low); plot ll_xdays = if GetMonth() != GetLastMonth() then Double.NaN else l; input verticals = yes; addverticalLine(verticals and getmonth()!=getmonth()[1], " ", color.white); addverticalLine(verticals and ct==11 and ct[1] == 10, " ", color.white); #
THANK YOU SkeepyZ. Each version has diff logic . Any idea how can we have this as a scan column for the stocks which close is above high / Low of this range
Code:#Plot H/L 1st 10 trading days of Last Month Extended input days = 2; def ymd = GetYYYYMMDD(); def ct = if GetMonth() != GetMonth()[1] and ymd then 1 else if ymd != ymd[1] then ct[1] + 1 else ct[1]; def h = if isnan(close) then h[1] else if ct[1] != 1 and ct == 1 then high else if ct <= days then Max(high, h[1]) else h[1]; plot scan_high = close > h; def l = CompoundValue(1, if isnan(close) then l[1] else if ct[1] != 1 and ct == 1 then low else if ct <= days then Min(low, l[1]) else l[1], low); #plot scanlow = close < l; #
Start a new thread and receive assistance from our community.
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.
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.