GettingYourDucksLinedUp For ThinkOrSwim

csricksdds

Active member
VIP
This is a new indicator in my AsGood Indicators: It is called AsGood_GettingYourDucksLineUp. This is the Link http://tos.mx/yrslE7K
This is the verbiage for it:

#AsGood_GettingYourDucksLinedUp Indicator
#This isdicator looks at five time frames and shows Green/Red arrows when direction is the same in all time frames.
#The time frames will be multiples of then chart time frame being used. Multiples are set to 2-3-4-5 alignments thus a 1 MIN Chart will show direction alignment of the 1-2-3-4-5 minute charts; A 5 min chart would show alignments of the 5-10-15-20-25 min charts, etc.
#The White Label shows the Current Time Frame Trend UP/Down with default set at 6 Bars.
#Once indicator is added go to Added Studies And Strategies Click on the Wheel and change Drawing to Up/DownsideGapThreeMethods Arrows and then Click on_volume "Save As Default"
#AsGood_GettingYourDucksLinedUp by Charles Ricks 3/17/23

This is the code:

declare lower;
declare once_per_bar;

input tf4_mplier = 5;
input tf3_mplier = 4;
input tf2_mplier = 3;
input tf1_mplier = 2;

def htf1c = if barNumber()/tf1_mplier == Ceil(barNumber()/tf1_mplier) then 1 else 0;
def tf1_h = if !htf1c[1] then max(high,tf1_h[1]) else high;
def tf2 = if !htf1c[1] then min(low,tf2[1]) else low;
def tf3 = if htf1c[1] then open else tf3[1];
def tf4 = close;

def haclose1 = (tf1_h+tf2+tf4) / 4;
def haopen1 = if htf1c[1] then (haopen1[1] + haclose1[1]) / 2 else haopen1[1];
def diff1 = haclose1 - haopen1;

def htf2c = if barNumber()/tf2_mplier == Ceil(barNumber()/tf2_mplier) then 1 else 0;
def htf2_h = if !htf2c[1] then max(high,htf2_h[1]) else high;
def htf2_l = if !htf2c[1] then min(low,htf2_l[1]) else low;
def htf2_o = if htf2c[1] then open else htf2_o[1];
def htf2_c = close;

def aclose2 = (htf2_h+htf2_l+htf2_c+htf2_o) / 4;
def aopen2 = if htf2c[1] then (aopen2[1] + aclose2[1]) / 2 else aopen2[1];
def diff2 = aclose2 - aopen2;

def tf3c = if barNumber()/tf3_mplier == Ceil(barNumber()/tf3_mplier) then 1 else 0;
def htf3_h = if !tf3c[1] then max(high,htf3_h[1]) else high;
def htf3_l = if !tf3c[1] then min(low,htf3_l[1]) else low;
def htf3_o = if tf3c[1] then open else htf3_o[1];
def htf3_c = close;

def aclose3 = (htf3_h+htf3_l+htf3_c+htf3_o) / 4;
def aopen3 = if tf3c[1] then (aopen3[1] + aclose3[1]) / 2 else aopen3[1];
def diff3 = aclose3 - aopen3;

def tf4c = if barNumber()/tf4_mplier == Ceil(barNumber()/tf4_mplier) then 1 else 0;
def tf4_h = if !tf4c[1] then max(high,tf4_h[1]) else high;
def tf4_l = if !tf4c[1] then min(low,tf4_l[1]) else low;
def tf4_o = if tf4c[1] then open else tf4_o[1];
def tf4_c = close;

def haclose4 = (tf4_h+tf4_l+tf4_c+tf4_o) / 4;
def haopen4 = if tf4c[1] then (haopen4[1] + haclose4[1]) / 2 else haopen4[1];
def diff4 = haclose4 - haopen4;

def aclose5 = (open + high + low + close) / 4;
def haopen5 = CompoundValue(1, (haopen5[1] + aclose5[1]) / 2, (open[1] + close[1]) / 2);
def diff5 = aclose5 - haopen5;

def Long = if diff1 > 0 and diff2 > 0 and diff3 > 0 and diff4 > 0 and diff5 > 0 then 1 else 0;
def Short = if diff1 <= 0 and diff2 <= 0 and diff3 <= 0 and diff4 <= 0 and diff5 <= 0 then 1 else 0;

plot TrendUp = if diff1 > 0 and diff2 > 0 and diff3 > 0 and diff4 > 0 and diff5 > 0 then 0 else Double.NaN;
TrendUP.SetDefaultColor(Color.GREEN);
TrendUp.SetLineWeight (5);
plot TrendDown =if diff1 <= 0 and diff2 <= 0 and diff3 <= 0 and diff4 <= 0 and diff5 <= 0 then 0 else Double.NaN;
TrendDown.SetDefaultColor(Color.RED);

TrendDown.SetLineWeight (5);

alert(TrendUp and !TrendUp[1], "Bullish Alignment", alert.bar, sound.Chimes);
alert(TrendDown and !TrendDown[1], "Bearish Alignment", alert.bar, sound.Chimes);

AddLabel(yes, if close > Average(close, 6) then "CurrentTimeFrameTrendUp" else "CurrentTimeFrameTrendDown",color.White);


This should be link for a picture: I am using my AsGood Colored Bars MTF in the charting shown
 
This is a new indicator in my AsGood Indicators: It is called AsGood_GettingYourDucksLineUp. This is the Link http://tos.mx/yrslE7K
This is the verbiage for it:

#AsGood_GettingYourDucksLinedUp Indicator
#This isdicator looks at five time frames and shows Green/Red arrows when direction is the same in all time frames.
#The time frames will be multiples of then chart time frame being used. Multiples are set to 2-3-4-5 alignments thus a 1 MIN Chart will show direction alignment of the 1-2-3-4-5 minute charts; A 5 min chart would show alignments of the 5-10-15-20-25 min charts, etc.
#The White Label shows the Current Time Frame Trend UP/Down with default set at 6 Bars.
#Once indicator is added go to Added Studies And Strategies Click on the Wheel and change Drawing to Up/DownsideGapThreeMethods Arrows and then Click on_volume "Save As Default"
#AsGood_GettingYourDucksLinedUp by Charles Ricks 3/17/23

This is the code:

declare lower;
declare once_per_bar;

input tf4_mplier = 5;
input tf3_mplier = 4;
input tf2_mplier = 3;
input tf1_mplier = 2;

def htf1c = if barNumber()/tf1_mplier == Ceil(barNumber()/tf1_mplier) then 1 else 0;
def tf1_h = if !htf1c[1] then max(high,tf1_h[1]) else high;
def tf2 = if !htf1c[1] then min(low,tf2[1]) else low;
def tf3 = if htf1c[1] then open else tf3[1];
def tf4 = close;

def haclose1 = (tf1_h+tf2+tf4) / 4;
def haopen1 = if htf1c[1] then (haopen1[1] + haclose1[1]) / 2 else haopen1[1];
def diff1 = haclose1 - haopen1;

def htf2c = if barNumber()/tf2_mplier == Ceil(barNumber()/tf2_mplier) then 1 else 0;
def htf2_h = if !htf2c[1] then max(high,htf2_h[1]) else high;
def htf2_l = if !htf2c[1] then min(low,htf2_l[1]) else low;
def htf2_o = if htf2c[1] then open else htf2_o[1];
def htf2_c = close;

def aclose2 = (htf2_h+htf2_l+htf2_c+htf2_o) / 4;
def aopen2 = if htf2c[1] then (aopen2[1] + aclose2[1]) / 2 else aopen2[1];
def diff2 = aclose2 - aopen2;

def tf3c = if barNumber()/tf3_mplier == Ceil(barNumber()/tf3_mplier) then 1 else 0;
def htf3_h = if !tf3c[1] then max(high,htf3_h[1]) else high;
def htf3_l = if !tf3c[1] then min(low,htf3_l[1]) else low;
def htf3_o = if tf3c[1] then open else htf3_o[1];
def htf3_c = close;

def aclose3 = (htf3_h+htf3_l+htf3_c+htf3_o) / 4;
def aopen3 = if tf3c[1] then (aopen3[1] + aclose3[1]) / 2 else aopen3[1];
def diff3 = aclose3 - aopen3;

def tf4c = if barNumber()/tf4_mplier == Ceil(barNumber()/tf4_mplier) then 1 else 0;
def tf4_h = if !tf4c[1] then max(high,tf4_h[1]) else high;
def tf4_l = if !tf4c[1] then min(low,tf4_l[1]) else low;
def tf4_o = if tf4c[1] then open else tf4_o[1];
def tf4_c = close;

def haclose4 = (tf4_h+tf4_l+tf4_c+tf4_o) / 4;
def haopen4 = if tf4c[1] then (haopen4[1] + haclose4[1]) / 2 else haopen4[1];
def diff4 = haclose4 - haopen4;

def aclose5 = (open + high + low + close) / 4;
def haopen5 = CompoundValue(1, (haopen5[1] + aclose5[1]) / 2, (open[1] + close[1]) / 2);
def diff5 = aclose5 - haopen5;

def Long = if diff1 > 0 and diff2 > 0 and diff3 > 0 and diff4 > 0 and diff5 > 0 then 1 else 0;
def Short = if diff1 <= 0 and diff2 <= 0 and diff3 <= 0 and diff4 <= 0 and diff5 <= 0 then 1 else 0;

plot TrendUp = if diff1 > 0 and diff2 > 0 and diff3 > 0 and diff4 > 0 and diff5 > 0 then 0 else Double.NaN;
TrendUP.SetDefaultColor(Color.GREEN);
TrendUp.SetLineWeight (5);
plot TrendDown =if diff1 <= 0 and diff2 <= 0 and diff3 <= 0 and diff4 <= 0 and diff5 <= 0 then 0 else Double.NaN;
TrendDown.SetDefaultColor(Color.RED);

TrendDown.SetLineWeight (5);

alert(TrendUp and !TrendUp[1], "Bullish Alignment", alert.bar, sound.Chimes);
alert(TrendDown and !TrendDown[1], "Bearish Alignment", alert.bar, sound.Chimes);

AddLabel(yes, if close > Average(close, 6) then "CurrentTimeFrameTrendUp" else "CurrentTimeFrameTrendDown",color.White);


This should be link for a picture: I am using my AsGood Colored Bars MTF in the charting shown
Is there a way to scan for uptrend / downtrend or alerts when it switches?
 
Need help writing a scan for this multiple time frame indicator I want the scan to pick up when all four time frames are aligned / combined either red or green not yellow.

Thanks

declare lower;
declare once_per_bar;

defineGlobalColor("TrendUp", color.green);
defineGlobalColor("TrendDown", color.red);

input higher_time_frame_4_multiplier = 5;
input higher_time_frame_3_multiplier = 4;
input higher_time_frame_2_multiplier = 3;
input higher_time_frame_1_multiplier = 2;

def htf1c = if barNumber()/higher_time_frame_1_multiplier == Ceil(barNumber()/higher_time_frame_1_multiplier) then 1 else 0;
def htf1_h = if !htf1c[1] then max(high,htf1_h[1]) else high;
def htf1_l = if !htf1c[1] then min(low,htf1_l[1]) else low;
def htf1_o = if htf1c[1] then open else htf1_o[1];
def htf1_c = close;

def haclose1 = (htf1_h+htf1_l+htf1_c+htf1_o) / 4;
def haopen1 = if htf1c[1] then (haopen1[1] + haclose1[1]) / 2 else haopen1[1];
def diff1 = haclose1 - haopen1;

def htf2c = if barNumber()/higher_time_frame_2_multiplier == Ceil(barNumber()/higher_time_frame_2_multiplier) then 1 else 0;
def htf2_h = if !htf2c[1] then max(high,htf2_h[1]) else high;
def htf2_l = if !htf2c[1] then min(low,htf2_l[1]) else low;
def htf2_o = if htf2c[1] then open else htf2_o[1];
def htf2_c = close;

def haclose2 = (htf2_h+htf2_l+htf2_c+htf2_o) / 4;
def haopen2 = if htf2c[1] then (haopen2[1] + haclose2[1]) / 2 else haopen2[1];
def diff2 = haclose2 - haopen2;

def htf3c = if barNumber()/higher_time_frame_3_multiplier == Ceil(barNumber()/higher_time_frame_3_multiplier) then 1 else 0;
def htf3_h = if !htf3c[1] then max(high,htf3_h[1]) else high;
def htf3_l = if !htf3c[1] then min(low,htf3_l[1]) else low;
def htf3_o = if htf3c[1] then open else htf3_o[1];
def htf3_c = close;

def haclose3 = (htf3_h+htf3_l+htf3_c+htf3_o) / 4;
def haopen3 = if htf3c[1] then (haopen3[1] + haclose3[1]) / 2 else haopen3[1];
def diff3 = haclose3 - haopen3;

def htf4c = if barNumber()/higher_time_frame_4_multiplier == Ceil(barNumber()/higher_time_frame_4_multiplier) then 1 else 0;
def htf4_h = if !htf4c[1] then max(high,htf4_h[1]) else high;
def htf4_l = if !htf4c[1] then min(low,htf4_l[1]) else low;
def htf4_o = if htf4c[1] then open else htf4_o[1];
def htf4_c = close;

def haclose4 = (htf4_h+htf4_l+htf4_c+htf4_o) / 4;
def haopen4 = if htf4c[1] then (haopen4[1] + haclose4[1]) / 2 else haopen4[1];
def diff4 = haclose4 - haopen4;

def haclose5 = (open + high + low + close) / 4;
def haopen5 = CompoundValue(1, (haopen5[1] + haclose5[1]) / 2, (open[1] + close[1]) / 2);
def diff5 = haclose5 - haopen5;

Plot HTF1 = if close then 4 else double.nan;
plot HTF2 = if close then 3 else double.nan;
plot HTF3 = if close then 2 else double.nan;
plot HTF4 = if close then 1 else double.nan;
plot HTF5 = if close then 0 else double.nan;

HTF1.setPaintingStrategy(paintingStrategy.POINTS);
HTF2.setPaintingStrategy(paintingStrategy.POINTS);
HTF3.setPaintingStrategy(paintingStrategy.POINTS);
HTF4.setPaintingStrategy(paintingStrategy.POINTS);
HTF5.setPaintingStrategy(paintingStrategy.POINTS);
HTF1.setLineWeight(5);
HTF2.setLineWeight(5);
HTF3.setLineWeight(5);
HTF4.setLineWeight(5);
HTF5.setLineWeight(5);

HTF1.assignValueColor(if diff4 > 0 then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
HTF2.assignValueColor(if diff3 > 0 then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
HTF3.assignValueColor(if diff2 > 0 then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
HTF4.assignValueColor(if diff1 > 0 then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
HTF5.assignValueColor(if diff5 > 0 then GlobalColor("TrendUp") else GlobalColor("TrendDown"));

HTF1.hideBubble();
HTF2.hideBubble();
HTF3.hideBubble();
HTF4.hideBubble();
HTF5.hideBubble();

HTF1.hideTitle();
HTF2.hideTitle();
HTF3.hideTitle();
HTF4.hideTitle();
HTF5.hideTitle();

plot divider = 5;
divider.setDefaultColor(color.gray);
divider.hideBubble();
divider.hideTitle();

def alignmentLong = if diff1 > 0 and diff2 > 0 and diff3 > 0 and diff4 > 0 and diff5 > 0 then 1 else 0;
def alignmentShort = if diff1 <= 0 and diff2 <= 0 and diff3 <= 0 and diff4 <= 0 and diff5 <= 0 then 1 else 0;

plot combinedTrend = if alignmentLong then 6 else if alignmentShort then 6 else double.nan;
combinedTrend.setPaintingStrategy(paintingStrategy.POINTS);
combinedTrend.setLineWeight(5);
combinedTrend.assignValueColor(if alignmentLong then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
combinedTrend.hideBubble();
combinedTrend.hideTitle();

alert(alignmentLong and !alignmentLong[1], "MTF Trend Bullish Alignment", alert.bar, sound.ding);
alert(alignmentShort and !alignmentShort[1], "MTF Trend Bearish Alignment", alert.bar, sound.ding);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
330 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

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?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top