Mimicking "Power X Strategy" by Markus Heitkoetter

Status
Not open for further replies.
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!
Hi ...its because I was only interested in the "50 midline" to see when they all crossed up or down...refer to Power X strategy...(refer to pic #1 & 2 to see where I changed the overbought and oversold inputs to both 50.

Also the STOCH Slow D uncheck the "show plot" box and you'll only see the one line. (pic 1 below)

lemme know if you have anymore questions






 

BenTen's Watchlist + Setup + Trade Recaps

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

Learn more

Hi, is there any way that a label can be made for the RSI, Stoch K and D that can be placed in the upper studies for quick-glance reference?
 
Afternoon all. Here is a quick update to the script. I know there are a few pending requests, some of which can already be had by enabling/disabling certain plots. I went ahead and combined the RSI, Stochastic and MACD Plot options into one script. I set an option to select which plot you want. You can select the following:
  1. RSI only
  2. Stochastic (w/ SlowD) only
  3. Both (RSI & Stochastic)
  4. MACD Only
I did this in order to centralize the script a bit more (not worry about maintaining 2 scripts) and provide the user the option of what to plot. Hopefully this works for you guys, if you do not like it please let me know and we can make further adjustments. There are still a few tweaks we can make to this version but I figured I would at least provide this update. I confirmed all plots are accurate when compared to the originals. If you notice any discrepancies, please do let me know. I'll also keep working on a couple other requests.

Going forward I will try to maintain 4 version of this initiative:
  1. Original Lower Plots (this script posted here); includes RSI, Stoch & Macd Options - LOWER Study that can also paint the price action bars if desired
  2. An UPPER Version only that paints bars and has arrows for start of new up or down trend
  3. An UPPER Version Strategy that will show the open and close of a position for back testing purposes.
  4. An UPPER TICK Version that will work on tick charts (no MTF option) (same as number 2); I have yet to post this code - this should be a quick update - stay tuned
Let me know if I've missed anything

EDIT
See link below for latest code
https://usethinkscript.com/threads/rsm-indicator-for-thinkorswim.5407/
 
Last edited:
This is script #2
UPPER Version with ADR Plots and ADR Shaded area that can be disabled in settings. This is per request from @RickAns - please let me know how we can tweak this further and I'll be happy to keep working on it.

*EDIT - quick update to include options to turn on/off various labels per requests

EDIT
Laste code; link below
https://usethinkscript.com/threads/rsm-indicator-for-thinkorswim.5407/
 
Last edited:
Script 3 - Standard version (non-mtf) will work on Time based and TICK based charts but will not plot high aggregation period signals. Basically this is the original script but for upper use without the indicators at the bottom of your chart. Please let me know if anything is not working. This one also does not include the ADR stuff that @RickAns requested as that requires the use of DAY Aggregation period so I removed it, sorry.


EDIT
Code has been updated, see link below
https://usethinkscript.com/threads/rsm-indicator-for-thinkorswim.5407/
 
Last edited:
Script 3 - Standard version (non-mtf) will work on Time based and TICK based charts but will not plot high aggregation period signals. Basically this is the original script but for upper use without the indicators at the bottom of your chart. Please let me know if anything is not working. This one also does not include the ADR stuff that @RickAns requested as that requires the use of DAY Aggregation period so I removed it, sorry.

Code:
#START OF RSI/Stochastic/MACD Confluence Strategy for ThinkOrSwim
#FVO_RSM_TREND_ADR_TICK_UPPER
#
#CHANGELOG
# 2020.11.30 V1.3 @cos251 - Stripped down TICK Version; No ADR since time based aggregation period do not work on TICK #                           Charts
#
# 2020.11.30 V1.2 @cos251 - Add ADR plots and shading per request; will tweak these settings to improve overall
#                           options
# 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.
#
# 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
#
#                  
#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 showTrendShade = no;
input tradetype = { "long", "short", default "both" };
input showTrendLabels = no;
input showIndLabels = no;
input plotADR = yes;
input showADRZones = no;
input showADRLabels = no;


################################################################
##########                 RSI                         #########
################################################################
input lengthRSI = 7;
input price = close;
input averageTypeRSI = AverageType.EXPONENTIAL;
def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[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, low, close, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullD;



#################################################################
#MACD Calculation
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.WEIGHTED;
def Value = MovingAverage(averageTypeMACD, close, fastLength) - MovingAverage(averageTypeMACD, close, 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 showTrendShade 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 showTrendShade 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 showTrendLabels 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 and (tradetype == tradetype.long or tradetype == tradetype.both) 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 and (tradetype == tradetype.short or tradetype == tradetype.both) then high else Double.NaN;
downArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
downArrow.SetDefaultColor(Color.RED);
downArrow.SetLineWeight(4);
absolutely amazing :)
Thank you very much
 
You have done a lot of work on this @cos251 ! It has really been popular and taken on a life of it's own. Will test out what you have done a little later. Thanks.
 
@cos251.. thank you some much for this awesome strategy, can i ask you for a request? do you think it is possible to add buy and sell order strategy for backtest this amazing strategy. thank you in advance.
 
@cos251 Is there a possibility to create AdaptiveEMA, McGinley MA formulas built into functions so it also can be included along with the standard set of average type input selection?
 
This is script #2
UPPER Version with ADR Plots and ADR Shaded area that can be disabled in settings. This is per request from @RickAns - please let me know how we can tweak this further and I'll be happy to keep working on it.

*EDIT - quick update to include options to turn on/off various labels per requests

Code:
#START OF RSI/Stochastic/MACD Confluence Strategy for ThinkOrSwim
#FVO_RSM_TREND_ADR_UPPER_MTF
#
#CHANGELOG
#
# 2020.11.30 V1.2 @cos251 - Add ADR plots and shading per request; will tweak these settings to improve overall
#                           options
# 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.
#
# 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
#
#                  
#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 showTrendShade = no;
input tradetype = { "long", "short", default "both" };
input showTrendLabels = no;
input showIndLabels = no;
input plotADR = yes;
input showADRZones = no;
input showADRLabels = 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 showTrendShade 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 showTrendShade 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 showTrendLabels 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 and (tradetype == tradetype.long or tradetype == tradetype.both) 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 and (tradetype == tradetype.short or tradetype == tradetype.both) then high else Double.NaN;
downArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
downArrow.SetDefaultColor(Color.RED);
downArrow.SetLineWeight(4);


# Average Daily Range
def isLastBar = !IsNaN(close) and IsNaN(close[-1]);
def beforeStart = GetTime() > RegularTradingStart(GetYYYYMMDD());
def afterEnd = GetTime() < RegularTradingEnd(GetYYYYMMDD());
def ADR = Average(high(period = AggregationPeriod.DAY) - low(period = AggregationPeriod.DAY), 7);
def dailyO = DailyOpen();
def profitADR = (ADR * 3) + DailyOpen();
def stopADR = dailyO - (ADR * 1.5);



plot profitZone = if plotADR and (beforeStart and afterEnd) then profitADR else Double.NaN; # uncheckmark the box in settings to hide this.
plot stopZone = if plotADR and (beforeStart and afterEnd) then stopADR else Double.NaN;
plot o =  if plotADR and (beforeStart and afterEnd) then DailyOpen() else Double.NaN;
plot oneADRPlus = if plotADR and (beforeStart and afterEnd) then (dailyO + ADR) else Double.NaN;
plot twoADRPlus = if plotADR and (beforeStart and afterEnd) then dailyO + (ADR * 2) else Double.NaN;
plot oneADRMinus = if plotADR and (beforeStart and afterEnd) then dailyO - ADR else Double.NaN;

profitZone.SetDefaultColor(Color.GREEN);
stopZone.SetDefaultColor(Color.RED);
o.SetDefaultColor(Color.CYAN);
oneADRPlus.SetDefaultColor(Color.LIGHT_GREEN);
twoADRPlus.SetDefaultColor(Color.LIGHT_GREEN);
oneADRMinus.SetDefaultColor(Color.LIGHT_RED);

AddLabel(if showADRLabels then yes else no, "Open=" + dailyO);
AddLabel(if showADRLabels then yes else no, "Profit Target 1 = " + oneADRPlus, Color.GREEN);
AddLabel(if showADRLabels then yes else no, " : Stop Loss =  -" + ADR * 1.5 + "", Color.PINK);
AddLabel(if showADRLabels then yes else no, " : ADR daily = " + ADR + "", Color.GRAY);
AddLabel(if showADRLabels then yes else no, "RSI:" + RSI + " sK:" + SlowK + " Macd:" + Value, Color.ORANGE);

# ADR Zones
AddCloud(if showADRZones and (beforeStart and afterEnd) then profitADR else Double.NaN, if (beforeStart and afterEnd) then dailyO else Double.NaN, CreateColor(69, 224, 255));
AddCloud(if showADRZones and (beforeStart and afterEnd) then dailyO else Double.NaN, if (beforeStart and afterEnd) then stopADR else Double.NaN, CreateColor(255, 12, 151));
Thanks as always Cos for the amazing work and effort it is truly appreciated!!
 
I'm testing this indicator folks, Started the day with a long position it worked like a charm. Now the instrument is setting up for short, i see labels confirming short. The starting price and profit target label is not updated. Just posting my observations here..

Label-Update-1.jpg
 
Last edited:
I'm testing this indicator folks, Started the day with a long position it worked like a charm. Now the instrument is setting up for short, i see labels confirming short. The starting price and profit target label is not updated. Just posting my observations here..

Label-Update-1.jpg
Had the same issue also.
 
Status
Not open for further replies.

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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