Join useThinkScript to post your question to a community of 21,000+ developers and traders.
will this show 15 min lines on a smaller time frame? like I don't want current agg signals I just want to see 15 mins signal lines on all time frames only.@Learnbot Remove all the fifteen code and change open, high, low, close to use current_agg as period. open(period = current_agg)
oh ok.. I just use it to draw key levels on chart before the market opens so I don't think repainting would affect it (I think ) I use a higher time frame because little noise aka false signals u know what I mean.. thank you buddy for your time@Learnbot It will show but if you're doing this for live trading then it can repaint because you're using higher aggregation.
one more question plz, so this indicator is working well for me however I do have a quick question. So currently I check 1hr time frame then 45min and then 15 min time frame, to draw my levels however i wanted to see if there is a way to plot 1hr and 45min levels along with 15 min levels all on one chart so i don't have to mark every single levels in each time frame rather i would see them all on 15 min chart.@Learnbot Change the current_agg to make it show up on different aggs.
Code:# # # TD Ameritrade IP Company, Inc. (c) 2011-2020 # #wizard plots #wizard text: Inputs: length: #wizard input: length #wizard text: trend setup: #wizard input: trendSetup input length = 20; input trendSetup = 3; input current_agg = AggregationPeriod.FIFTEEN_MIN; def nan = Double.NaN; def fifteen = GetAggregationPeriod() == current_agg; def BodyMax = Max(open, close); def BodyMin = Min(open, close); def IsEngulfing = BodyMax > BodyMax[1] and BodyMin < BodyMin[1]; def IsWhite = open < close; def IsBlack = open > close; def IsPrevDoji = IsDoji(length)[1]; plot Bearish = IsAscending(close, trendSetup)[1] and (IsWhite[1] or IsPrevDoji) and IsBlack and IsEngulfing and fifteen; plot Bullish = IsDescending(close, trendSetup)[1] and (IsBlack[1] or IsPrevDoji) and IsWhite and IsEngulfing and fifteen; Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); Bearish.SetDefaultColor(GetColor(1)); Bearish.SetLineWeight(2); Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); Bullish.SetDefaultColor(GetColor(2)); Bullish.SetLineWeight(2); def bu_high = if bullish and fifteen then high[1] else bu_high[1]; def bu_low = if bullish and fifteen then close[1] else bu_low[1]; def be_high = if bearish and fifteen then high[1] else be_high[1]; def be_low = if bearish and fifteen then open[1] else be_low[1]; def buhh = if IsNaN(close) then buhh[1] else bu_high; def bull = if IsNaN(close) then bull[1] else bu_low; def behh = if IsNaN(close) then behh[1] else be_high; def bell = if IsNaN(close) then bell[1] else be_low; plot bu_hh = buhh; plot bu_ll = bull; plot be_hh = behh; plot be_ll = bell; bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); bu_hh.SetDefaultColor(Color.YELLOW); bu_ll.SetDefaultColor(Color.YELLOW); be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); be_hh.SetDefaultColor(Color.YELLOW); be_ll.SetDefaultColor(Color.YELLOW);
@Learnbot Just load the script 3 times and change the agg.
#
#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup
input length = 20;
input trendSetup = 3;
input current_agg = AggregationPeriod.FIFTEEN_MIN;
def nan = Double.NaN;
def fifteen = GetAggregationPeriod() == current_agg;
def hour = AggregationPeriod.hour;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];
plot Bearish = IsAscending(close, trendSetup)[1] and
(IsWhite[1] or IsPrevDoji) and
IsBlack and
IsEngulfing and
fifteen;
plot Bullish = IsDescending(close, trendSetup)[1] and
(IsBlack[1] or IsPrevDoji) and
IsWhite and
IsEngulfing and
fifteen;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(1));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(2));
Bullish.SetLineWeight(2);
def bu_high = if bullish and fifteen then high[1] else bu_high[1];
def bu_low = if bullish and fifteen then close[1] else bu_low[1];
def be_high = if bearish and fifteen then high[1] else be_high[1];
def be_low = if bearish and fifteen then open[1] else be_low[1];
def buhh = if IsNaN(close) then buhh[1] else bu_high;
def bull = if IsNaN(close) then bull[1] else bu_low;
def behh = if IsNaN(close) then behh[1] else be_high;
def bell = if IsNaN(close) then bell[1] else be_low;
plot bu_hh = buhh;
plot bu_ll = bull;
plot be_hh = behh;
plot be_ll = bell;
bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh.SetDefaultColor(Color.YELLOW);
bu_ll.SetDefaultColor(Color.YELLOW);
be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh.SetDefaultColor(Color.YELLOW);
be_ll.SetDefaultColor(Color.YELLOW);
def bu_high1 = if bullish and hour then high[1] else bu_high1[1];
def bu_low1 = if bullish and hour then close[1] else bu_low1[1];
def be_high1 = if bearish and hour then high[1] else be_high1[1];
def be_low1 = if bearish and hour then open[1] else be_low1[1];
def buhh1 = if IsNaN(close) then buhh1[1] else bu_high1;
def bull1 = if IsNaN(close) then bull1[1] else bu_low1;
def behh1 = if IsNaN(close) then behh1[1] else be_high1;
def bell1 = if IsNaN(close) then bell1[1] else be_low1;
plot bu_hh1 = buhh1;
plot bu_ll1 = bull1;
plot be_hh1 = behh1;
plot be_ll1 = bell1;
bu_hh1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh1.SetDefaultColor(Color.red);
bu_ll1.SetDefaultColor(Color.red);
be_hh1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh1.SetDefaultColor(Color.red);
be_ll1.SetDefaultColor(Color.red);
#
#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup
input length = 20;
input trendSetup = 3;
input agg = AggregationPeriod.FIFTEEN_MIN;
def open = open(period = agg);
def high = high(period = agg);
def low = low(period = agg);
def close = close(period = agg);
def nan = Double.NaN;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];
plot Bearish = IsAscending(close, trendSetup)[1] and
(IsWhite[1] or IsPrevDoji) and
IsBlack and
IsEngulfing;
plot Bullish = IsDescending(close, trendSetup)[1] and
(IsBlack[1] or IsPrevDoji) and
IsWhite and
IsEngulfing;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(1));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(2));
Bullish.SetLineWeight(2);
def bu_high = if bullish then high[1] else bu_high[1];
def bu_low = if bullish then close[1] else bu_low[1];
def be_high = if bearish then high[1] else be_high[1];
def be_low = if bearish then open[1] else be_low[1];
def buhh = if IsNaN(close()) then buhh[1] else bu_high;
def bull = if IsNaN(close()) then bull[1] else bu_low;
def behh = if IsNaN(close()) then behh[1] else be_high;
def bell = if IsNaN(close()) then bell[1] else be_low;
plot bu_hh = buhh;
plot bu_ll = bull;
plot be_hh = behh;
plot be_ll = bell;
bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh.SetDefaultColor(Color.YELLOW);
bu_ll.SetDefaultColor(Color.YELLOW);
be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh.SetDefaultColor(Color.YELLOW);
be_ll.SetDefaultColor(Color.YELLOW);
# Generation time: 2021-03-30T17:26:20.467Z
def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
IsDown[4] and
IsDown[3] and
IsDown[2] and
You are a genius! I didnt even think abt this way of solving the problem! THANK YOU! so my problem is mostly solved but I wanted to make it a little bit cleaner if possible. Here is the script I came up with:@Learnbot Apply what you learned from this thread and use AddCloud function to connect the two lines.
# Generation time: 2021-03-30T17:26:20.467Z
input hidecloud = no;
def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
def PatternPlot =
IsDown[4] and
IsDown[3] and
IsDown[2] and
IsUp[1] and
IsUp[0] and
open[4] > open[3] and
close[1] < close[0] and
close[4] > close[3] and
close[3] > close[2] and
open[3] > open[2];
def b_h = if PatternPlot then open[1] else b_h[1];
def B_l = if PatternPlot then close[1] else b_l[1];
plot hh = b_H;
plot ll = b_l;
hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
hh.SetDefaultColor(Color.YELLOW);
ll.SetDefaultColor(Color.YELLOW);
addcloud(if !HideCloud then hh else double.nan, ll, color.gray, color.gray);
Here you go:
#Englufing Supply and Demand:
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup
input length = 20;
input trendSetup = 3;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];
plot Bearish = IsAscending(close, trendSetup)[1] and
(IsWhite[1] or IsPrevDoji) and
IsBlack and
IsEngulfing;
plot Bullish = IsDescending(close, trendSetup)[1] and
(IsBlack[1] or IsPrevDoji) and
IsWhite and
IsEngulfing;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(2));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(1));
Bullish.SetLineWeight(2);
def bu_high = if bullish then high[1] else bu_high[1];
def bu_low = if bullish then close[1] else bu_low[1];
def be_high = if bearish then high[1] else be_high[1];
def be_low = if bearish then open[1] else be_low[1];
plot bu_hh = bu_high[-1];
plot bu_ll = bu_low[-1];
plot be_hh = be_high[-1];
plot be_ll = be_low[-1];
bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh.SetDefaultColor(Color.cyan);
bu_ll.SetDefaultColor(Color.cyan);
be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh.SetDefaultColor(Color.pink);
be_ll.SetDefaultColor(Color.pink);
AddCloud(bu_hh, bu_ll, Color.cyan, Color.cyan);
AddCloud(be_hh,Be_ll, Color.pink, Color.PINK);
Here is code for 1 Hr time frame
#Engulfing Sup/Dem 1Hr
#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup
input length = 20;
input trendSetup = 3;
input agg = AggregationPeriod.hour;
def open = open(period = agg);
def high = high(period = agg);
def low = low(period = agg);
def close = close(period = agg);
def nan = Double.NaN;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];
plot Bearish = IsAscending(close, trendSetup)[1] and
(IsWhite[1] or IsPrevDoji) and
IsBlack and
IsEngulfing;
plot Bullish = IsDescending(close, trendSetup)[1] and
(IsBlack[1] or IsPrevDoji) and
IsWhite and
IsEngulfing;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(1));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(2));
Bullish.SetLineWeight(2);
def bu_high = if bullish then high[1] else bu_high[1];
def bu_low = if bullish then close[1] else bu_low[1];
def be_high = if bearish then high[1] else be_high[1];
def be_low = if bearish then open[1] else be_low[1];
def buhh = if IsNaN(close()) then buhh[1] else bu_high;
def bull = if IsNaN(close()) then bull[1] else bu_low;
def behh = if IsNaN(close()) then behh[1] else be_high;
def bell = if IsNaN(close()) then bell[1] else be_low;
plot bu_hh = buhh;
plot bu_ll = bull;
plot be_hh = behh;
plot be_ll = bell;
bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh.SetDefaultColor(Color.red);
bu_ll.SetDefaultColor(Color.red);
be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh.SetDefaultColor(Color.red);
be_ll.SetDefaultColor(Color.red);
#Engulfing Sup/Dem 15 min
#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#
#wizard plots
#wizard text: Inputs: length:
#wizard input: length
#wizard text: trend setup:
#wizard input: trendSetup
input length = 20;
input trendSetup = 3;
def agg = aggregationPeriod.FIFTEEN_MIN;
def open = open(period = agg);
def high = high(period = agg);
def low = low(period = agg);
def close = close(period = agg);
def nan = Double.NaN;
def BodyMax = Max(open, close);
def BodyMin = Min(open, close);
def IsEngulfing = BodyMax > BodyMax[1] and
BodyMin < BodyMin[1];
def IsWhite = open < close;
def IsBlack = open > close;
def IsPrevDoji = IsDoji(length)[1];
plot Bearish = IsAscending(close, trendSetup)[1] and
(IsWhite[1] or IsPrevDoji) and
IsBlack and
IsEngulfing;
plot Bullish = IsDescending(close, trendSetup)[1] and
(IsBlack[1] or IsPrevDoji) and
IsWhite and
IsEngulfing;
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Bearish.SetDefaultColor(GetColor(1));
Bearish.SetLineWeight(2);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Bullish.SetDefaultColor(GetColor(2));
Bullish.SetLineWeight(2);
def bu_high = if bullish then high[1] else bu_high[1];
def bu_low = if bullish then close[1] else bu_low[1];
def be_high = if bearish then high[1] else be_high[1];
def be_low = if bearish then open[1] else be_low[1];
def buhh = if IsNaN(close()) then buhh[1] else bu_high;
def bull = if IsNaN(close()) then bull[1] else bu_low;
def behh = if IsNaN(close()) then behh[1] else be_high;
def bell = if IsNaN(close()) then bell[1] else be_low;
plot bu_hh = buhh;
plot bu_ll = bull;
plot be_hh = behh;
plot be_ll = bell;
bu_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
bu_hh.SetDefaultColor(Color.cyan);
bu_ll.SetDefaultColor(Color.cyan);
be_hh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_ll.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
be_hh.SetDefaultColor(Color.pink);
be_ll.SetDefaultColor(Color.pink);
AddCloud(bu_hh, bu_ll, Color.cyan, Color.cyan);
AddCloud(be_hh,Be_ll, Color.pink, Color.PINK);
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
D | Help drawing line | Questions | 4 | |
A | Help Drawing fib level lines | Questions | 7 | |
Fractal Pivots Indicator - Need help adding signal | Questions | 1 | ||
M | Help adding ATR in my scans | Questions | 1 | |
S | Help on Price crosses above prev day high study | Questions | 9 |
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.