Mimicking "Power X Strategy" by Markus Heitkoetter

Status
Not open for further replies.
Hi Cos,

Yes, exactly. That's what I'm looking for to have the RSI and SKD (and keep the SmoothK and the SmoothD plotted) separated so the 3 lower indicators can be viewed separately similar to the MACD (similar to how they appear in the Power X pdf). Thanks!
 

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

thanks!!! i'll check em out!
By quick glance, they are not the same indicators. I can set them up to read the same way but what I like about those were the one line. I may have mis-typed but i was actually looking for the top 2 of the 3 lower indicators. The RSI and the Stoch.

thanks for the fast response!
 
A quick update to this thread. For those of you not wanting to use the strategy portion of the script and who may also be looking for an MTF version of this script, I modified the original strategy. Please beware, if you use this version and set your current chart to a higher timeframe IT WILL REPAINT due to the higher timeframe candle needing to close. I also removed the strat portion and replaced it with just the green up and red down arrows to show entry. As usual you can use this in conjunction with other indicators to help time an entry/exit. Please let me know if you see any issues with this version.

Code:
#START OF RSI/Stochastic/MACD Confluence Strategy for ThinkOrSwim
#
#CHANGELOG
# 2020.10.27 V1.0 @cos251 - Added RSI, StochasticSlow and MACD to same indicator
#             - also calculates MACD;
#               Will shade the lower plot area of the following conditions are met
#                    Shade GREEN = RSI > 50 and SlowK > 50 and (macd)Value > (macd)Avg
#                    Shade RED = RSI < 50 and SlowK < 50 and (macd)Value < (macd)Avg
# 2020.11.12 V1.1 @cos251 - Changed from strategy to standard study. Added Green Arrow UP
#                and Red Arrow down when trend starts.  Added option to change to high
#                timeframe but this WILL repaint; if used, should be used with other
#                indicators to confirm an entry/exit.
#                  
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
#               Stoch Slow 5(not14) and 3 WILDERS
#               MACD 12,26,9 WEIGHTED

declare upper;

################################################################
##########                 Variables                   #########
################################################################
input aggPeriod = AggregationPeriod.MIN;
input paintBars = yes;
input showShade = no;
input tradetype = { default "long", "short", "both" };
input showLabels = no;


################################################################
##########                 RSI                         #########
################################################################
input lengthRSI = 7;
input price = close;
input averageTypeRSI = AverageType.EXPONENTIAL;
def NetChgAvg = MovingAverage(averageTypeRSI, close(period = aggPeriod) - close(period = aggPeriod)[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(close(period = aggPeriod) - close(period = aggPeriod)[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);


################################################################
##########                 Stochastic Slow             #########
################################################################
input over_boughtSt = 80;
input over_soldSt = 20;
input KPeriod = 5;
input DPeriod = 3;
input averageTypeStoch = AverageType.WILDERS;
def SlowK = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, high(period = aggPeriod), low(period = aggPeriod), close(period = aggPeriod), 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, high(period = aggPeriod), low(period = aggPeriod), close(period = aggPeriod), 3, averageTypeStoch).FullD;



#################################################################
#MACD Calculation
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.WEIGHTED;
def Value = MovingAverage(averageTypeMACD, close(period = aggPeriod), fastLength) - MovingAverage(averageTypeMACD, close(period = aggPeriod), slowLength);
def Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
def Diff = Value - Avg;


#AssignPriceColor
AssignPriceColor(if paintBars and RSI >= 50 and SlowK >= 50 and Value > Avg then Color.GREEN else if paintBars and RSI < 50 and SlowK < 50 and Value < Avg then Color.RED else if paintBars then Color.DARK_GRAY else Color.CURRENT);

#################################################################
############  Shade areas based on criteria; adjust as needed  ##
#################################################################
AddCloud(if showShade and RSI >= 50 and SlowK >= 50 and Value > Avg then Double.POSITIVE_INFINITY else Double.NaN, if RSI >= 50 and SlowK >= 50 and Value > Avg then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_Green);
AddCloud(if showShade and RSI < 50 and SlowK < 50 and Value < Avg then Double.POSITIVE_INFINITY else Double.NaN, if RSI < 50 and SlowK < 50 and Value < Avg then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_RED);



#################################################################
############          SCAN Variables                    #########
#################################################################
plot UpTrend = if RSI >= 50 and SlowK >= 50 and Value > Avg then 1 else 0;
plot DownTrend = if RSI < 50 and SlowK < 50 and Value < Avg then 1 else 0;
UpTrend.Hide();
DownTrend.Hide();
AddLabel(if showLabels then yes else no, if UpTrend == 1 then "::RSM-Signal:LONG" else if DownTrend == 1 then "::RSM-Signal:SHORT" else "::RSM-Signal:IDLE", if UpTrend == 1 then Color.GREEN else if DownTrend == 1 then Color.RED else Color.GRAY);

plot upArrow = if UpTrend == 1 and UpTrend[1] == 0 then low else Double.NaN;
upArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upArrow.SetDefaultColor(Color.GREEN);
upArrow.SetLineWeight(4);

plot downArrow = if DownTrend == 1 and DownTrend[1] == 0 then high else Double.NaN;
downArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
downArrow.SetDefaultColor(Color.RED);
downArrow.SetLineWeight(4);
@cos251 Great job on this!! Anyway to get a watchlist for daily signals?
 
Thanks @cos251 for looking into my request. Just painting regular trade hours is fine, no need to extend them into the future. All I wanted was for the profit / stop target clouds to show with the clouds in the lower panel. Because that is when the buy / sell / hold signals are active on a daily chart. If that makes sense.

You have emboldened me to post my mangled code in an effort to see where I am going wrong. As well as to show what I was trying to accomplish. This is just for the Long side only. Figured to get that working before trying the Short sell side for those that do.


I updated post #7 to include the target price as well as the ADR target number. For those that like labels.


Code:
###-----  test bits, horizontal plots and clouds --- Not displaying as intended as horizontal lines / clouds



def Target = close(period = AggregationPeriod.DAY) + (ADR * 3);
#plot TargX = Target;
#TargX.SetDefaultColor(Color.green);

def StopLoss = close(period = AggregationPeriod.DAY) - (ADR * 1.5);
#plot StopX = StopLoss;
#StopX.SetDefaultColor(Color.pink);

#suggested Profit Target
def Targ = if LongBuy == 1 then(close(period = AggregationPeriod.DAY) + (ADR * 3)) else Double.NaN;
plot TargX = Targ;
TargX.SetPaintingStrategy(PaintingStrategy.Horizontal);
TargX.SetDefaultColor(Color.Violet);


#suggested Entry
def EntryPoint = close(period = AggregationPeriod.DAY);
plot Entry = if  Uptrend then EntryPoint else Double.NaN;;
Entry.SetPaintingStrategy(PaintingStrategy.Horizontal);
Entry.SetDefaultColor(Color.Dark_Green);

#suggested Stop Loss
plot TargStop = if LongBuy and UpTrend then StopLoss else Double.NaN;
TargStop.SetPaintingStrategy(PaintingStrategy.Horizontal);
TargStop.SetDefaultColor(Color.Orange);

#clouds
AddCloud(if UpTrend then Target else Double.NaN, EntryPoint, Color.Light_Green, Color.Light_Green);
AddCloud(if UpTrend then EntryPoint else Double.NaN, StopLoss, Color.Pink, Color.Pink);
 
Last edited by a moderator:
@cos251 great script, thank you for share with us.. a quick question, do you have the strategy for this script for us to back test? if so please can you share with us? do this signal repaint? thank you an advance.
 
@TradeUp - I will post a working version of this code that works on TICK charts today or tomorrow if possible. I have not yet figured out how to make the TICK charts to show signals for higher TICK aggregations, I believe from the documentation and how TOS works this is not possible but I will pursue that task at a later time.

Thanks so much for the feedback.
Thank you for your hard work and I look forward to the next update. I have another suggestion and that is to add volume dots. I found this code from another indicator I hope it helps.

Code:
#Get moving average of volume
def volAvg = MovingAverage(length = volumeLength,data = volume);
#Calculate middle of bar
def volDotLocation = volumeFactor * MidBodyVal();
#calculate 50% increase in average volume
def vol50IncLevel = volAvg * (1 + (volumeGreaterPercent / 100));
#if current volume is greater than the configured length MA of the volume and the price color is not yellow (neutral) or configured to plot on yellow bars (neutral) then plot volume dot
plot volDot = if volume >= vol50IncLevel and (priceColor != 2 or plotVolumeDotOnNeutral) then volDotLocation else Double.NaN;
volDot.SetStyle(Curve.POINTS);
volDot.SetDefaultColor(Color.CYAN);
volDot.SetLineWeight(2);
#AssignPriceColor(Color.BLUE);
##############
 
@Joseph Patrick 18 Joseph, this is really awesome. I appreciate your work and the others are sharing. I have troubles to set up the scan. I dont know what I am doing wrong. Would you be so kind to share the link for the scan you use? Thank you vey much.
Hi Samoya sorry it took me a while to get back to you but here is the premarket scan that I use before market opens...anymore questions just let me know and I will get back to you asap!

http://tos.mx/ecZ5bII
 
A quick update to this thread. For those of you not wanting to use the strategy portion of the script and who may also be looking for an MTF version of this script, I modified the original strategy. Please beware, if you use this version and set your current chart to a higher timeframe IT WILL REPAINT due to the higher timeframe candle needing to close. I also removed the strat portion and replaced it with just the green up and red down arrows to show entry. As usual you can use this in conjunction with other indicators to help time an entry/exit. Please let me know if you see any issues with this version.

Code:
#START OF RSI/Stochastic/MACD Confluence Strategy for ThinkOrSwim
#
#CHANGELOG
# 2020.10.27 V1.0 @cos251 - Added RSI, StochasticSlow and MACD to same indicator
#             - also calculates MACD;
#               Will shade the lower plot area of the following conditions are met
#                    Shade GREEN = RSI > 50 and SlowK > 50 and (macd)Value > (macd)Avg
#                    Shade RED = RSI < 50 and SlowK < 50 and (macd)Value < (macd)Avg
# 2020.11.12 V1.1 @cos251 - Changed from strategy to standard study. Added Green Arrow UP
#                and Red Arrow down when trend starts.  Added option to change to high
#                timeframe but this WILL repaint; if used, should be used with other
#                indicators to confirm an entry/exit.
#                  
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
#               Stoch Slow 5(not14) and 3 WILDERS
#               MACD 12,26,9 WEIGHTED

declare upper;

################################################################
##########                 Variables                   #########
################################################################
input aggPeriod = AggregationPeriod.MIN;
input paintBars = yes;
input showShade = no;
input tradetype = { default "long", "short", "both" };
input showLabels = no;


################################################################
##########                 RSI                         #########
################################################################
input lengthRSI = 7;
input price = close;
input averageTypeRSI = AverageType.EXPONENTIAL;
def NetChgAvg = MovingAverage(averageTypeRSI, close(period = aggPeriod) - close(period = aggPeriod)[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(close(period = aggPeriod) - close(period = aggPeriod)[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);


################################################################
##########                 Stochastic Slow             #########
################################################################
input over_boughtSt = 80;
input over_soldSt = 20;
input KPeriod = 5;
input DPeriod = 3;
input averageTypeStoch = AverageType.WILDERS;
def SlowK = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, high(period = aggPeriod), low(period = aggPeriod), close(period = aggPeriod), 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, high(period = aggPeriod), low(period = aggPeriod), close(period = aggPeriod), 3, averageTypeStoch).FullD;



#################################################################
#MACD Calculation
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.WEIGHTED;
def Value = MovingAverage(averageTypeMACD, close(period = aggPeriod), fastLength) - MovingAverage(averageTypeMACD, close(period = aggPeriod), slowLength);
def Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
def Diff = Value - Avg;


#AssignPriceColor
AssignPriceColor(if paintBars and RSI >= 50 and SlowK >= 50 and Value > Avg then Color.GREEN else if paintBars and RSI < 50 and SlowK < 50 and Value < Avg then Color.RED else if paintBars then Color.DARK_GRAY else Color.CURRENT);

#################################################################
############  Shade areas based on criteria; adjust as needed  ##
#################################################################
AddCloud(if showShade and RSI >= 50 and SlowK >= 50 and Value > Avg then Double.POSITIVE_INFINITY else Double.NaN, if RSI >= 50 and SlowK >= 50 and Value > Avg then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_Green);
AddCloud(if showShade and RSI < 50 and SlowK < 50 and Value < Avg then Double.POSITIVE_INFINITY else Double.NaN, if RSI < 50 and SlowK < 50 and Value < Avg then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_RED);



#################################################################
############          SCAN Variables                    #########
#################################################################
plot UpTrend = if RSI >= 50 and SlowK >= 50 and Value > Avg then 1 else 0;
plot DownTrend = if RSI < 50 and SlowK < 50 and Value < Avg then 1 else 0;
UpTrend.Hide();
DownTrend.Hide();
AddLabel(if showLabels then yes else no, if UpTrend == 1 then "::RSM-Signal:LONG" else if DownTrend == 1 then "::RSM-Signal:SHORT" else "::RSM-Signal:IDLE", if UpTrend == 1 then Color.GREEN else if DownTrend == 1 then Color.RED else Color.GRAY);

plot upArrow = if UpTrend == 1 and UpTrend[1] == 0 then low else Double.NaN;
upArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upArrow.SetDefaultColor(Color.GREEN);
upArrow.SetLineWeight(4);

plot downArrow = if DownTrend == 1 and DownTrend[1] == 0 then high else Double.NaN;
downArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
downArrow.SetDefaultColor(Color.RED);
downArrow.SetLineWeight(4);
Hey Cos great work! I actually like it better....it feels like it flows better this way with having everything up top...thanks as usual!!!
 
By quick glance, they are not the same indicators. I can set them up to read the same way but what I like about those were the one line. I may have mis-typed but i was actually looking for the top 2 of the 3 lower indicators. The RSI and the Stoch.

thanks for the fast response!

By quick glance, they are not the same indicators. I can set them up to read the same way but what I like about those were the one line. I may have mis-typed but i was actually looking for the top 2 of the 3 lower indicators. The RSI and the Stoch.

thanks for the fast response!
Hi Stock...if I am not mistaken you referring to post #1 with the RSI and STOCH separated? If so here it is ....

http://tos.mx/YBkU7VF

If not pls just let me know what post you are referring to and I will post the share! thanks :)
 
Last edited:
Hi Joseph, thank you for sharing this script with us, a quick question do you have the strategy for back test? if so can you share with us? thank you very much.
 
Hi Stock....I think you are

Hi Stock...if I am not mistaken you referring to post #1 with the RSI and STOCH separated? If so here it is ....

http://tos.mx/YBkU7VF

If not pls just let me know what post you are referring to and I will post the share! thanks :)
awesome!!! yes that is what i was looking for. now If i plug the setting into the indicators from page 1 i should get the same reading correct? I see yours are different......Any reason why?
 
awesome!!! yes that is what i was looking for. now If i plug the setting into the indicators from page 1 i should get the same reading correct? I see yours are different......Any reason why?
also, my MACD has a bottom of -0.1 to top 0.2 my Stoch does not have a 0 at the bottom or a 100 at the top nor does my RSI have a 0 or 100 at bottom or top. If i change the setting to how you have them on the picture it gives my 2 lines on both my rsi and stoch......any help fixing this would be appreciated!
 
Status
Not open for further replies.

BenTen's Watchlist + Setup + Trade Recaps

Get access to Ben's watchlist, swing trading strategy, ThinkorSwim setup, and trade examples.

Learn more

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
333 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