Simple Yet Very POWERFUL Swing Trading Strategy

technicallydreaming

technicallydreaming

Member
Still not sure why 7 period is better then 14 period for 5 min chart. I have been using a similar system as this one for a while now, but with the standard 14 period. Would consider dropping it 7 but thinking that would give more false signals? What do you think? I actually used to double the RSI to get less signals to 28, but you miss a lot of the action doing that so I went back to default.

60 Is my RSI number too. There is a widely known strategy by a trader (sorry forgot his name) where he writes 66.6 is the magic number. I find that to be too high as a good portion of the "move" is gone by that point.

Friendly tip (although somewhat obvious) I sort my watch list high RSI to low RSI every morning. You can add the column by default in ToS and change settings. Very helpful for when deciding what stocks to focus on when you have too many on your list.
 
R

rogtrader

New member
This seems to be working in Strategy, but how do we automate this process using Order Rules based on Conditions?
 
M

martyrjohn

Member
Can someone help me out with this. I read through the forum, but am still confused on what the strategy is. Do you just go long immediately when RSI daily cross above 40 and hourly crosses above 60 on good volume with a trending moving averages?
 
R

ramizlol

New member
This doesn't seem to backtest to the number mentioned by other members... this is the code that i tested.
Code:
##############################################################################################

input length = 7;
input over_Bought = 60;
input over_Sold = 40;
input price = close;
input averageType = AverageType.WILDERS;


input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);
def BEAR = over_Sold;
def BULL = over_Bought;
def UpSignal = if RSI crosses above BEAR then BEAR else Double.NaN;
def DownSignal = if RSI crosses below BULL then BULL else Double.NaN;

#RSI ALERT
def Bearish = RSI crosses below 60;
def Bullish = RSI crosses above 40;

Alert(Bullish, ” EMA Possible SIGNAL UP ”, Alert.BAR, Sound.Ding);
Alert(Bearish, " EMA2 Possible SIGNAL DOWN ", Alert.BAR, Sound.Ding);

#For Orders
def TradeSize = 2;

def Ent = RSI("length" = 7)."RSI" crosses above 60 ;
def Ext = RSI("length" = 7)."RSI" crosses below 60 or RSI("length" = 7)."RSI" >= 85;

AddOrder(OrderType.BUY_TO_OPEN, Ent, close, TradeSize);
AddOrder(OrderType.SELL_TO_CLOSE, Ext, close, TradeSize);

#request by ykd2018x
#1. 5 MIN CHART time frame ,
#def TradeSize =2;
#def Ent= RSI("length" = 7)."RSI" crosses above 60 ;
#close condition , if/when rsi =85 close it /// OR cross below 60 close it

##############################################################################################
I tried it for AAPL, MSFT, AMZN. I tried it for 1hr for 30 days. all negative. Am i doing something wrong?
 
M

martyrjohn

Member
@ykd2018x
Im new here and i have been trying to piece together a trading system for options for awhile with all the bells and whistles, latest studies, multiple indicators, and now I see it's right under my nose! The RSI. Thanks for showing me.

Do you have any experience/backtesting looking at the RSI crossing at multiple different time frames? Or does that defeat its simplicity? This afternoon, after the market closed, I threw together a multi time frame scanner with Condition Wizard and the results all looked very nice.

The scan was:
1 Hr RSI(7) crosses 40,
Daily RSI(7) crosses 60,
increasing volume
price above 5,8, 13 EMA

Tried putting the scan code into a strategy and was having issues with "AggregatingPeriod." Maybe the conditions weren't being meet but anyone have thoughts on this strategy?

PS would be nice with auto support and resistance...
did the strategy end up being effective for you?
 
M

martyrjohn

Member
Does anyone know if in this strategy the hourly has to be crossing the 40 point or it just has to be in between the 40 and 60? Same with daily. Does it need to be crossing above 60 or just above 60.


Also, are there any ways I can optimize this trading strategy using any other indicators, or should I just always buy when the criteria is met
 
M

martyrjohn

Member
Used this strategy today for first time. Up $400+ and left another 200+ on the table due to being a rookie at this. I expect to get better at entries and exits. Many thanks ykd2018x.
are you still using this strategy. If so, can you review your entry. I know it is somewhere earlier in this thread, but I am having a hard time understanding.
 
Rojo Grande

Rojo Grande

Member
VIP
are you still using this strategy. If so, can you review your entry. I know it is somewhere earlier in this thread, but I am having a hard time understanding.
It's pretty straight forward. If the 1 hour bar closed above 60 or below 40, that would be my entry. Now the caveat, I also follow a combined avg. RSI of the $DJI & $COMP, watching for strength, weakness, or sideways action. So, if stock crosses 60, but the avg. RSI is sideways or not showing any type of support, I pass. I will also review the 15 and 30 min. charts to aid in any decisions. Did well on $AAPL today. I'm an RSI person for day trading. Also, today I used the 30 min. chart for entry.
 
Last edited:
M

martyrjohn

Member
It's pretty straight forward. If the 1 hour bar closed above 60 or below 40, that would be my entry. Now the caveat, I also follow a combined avg. RSI of the $DJI & $COMP, watching for strength, weakness, or sideways action. So, if stock crosses 60, but the avg. RSI is sideways or not showing any type of support, I pass. I will also review the 15 and 30 min. charts to aid in any decisions. Did well on $AAPL today. I'm an RSI person for day trading. Also, today I used the 30 min. chart for entry.
Wow thank you that makes sense thank you. How do you get the average RSI. Is it a study that actually combines them into one RSI, or do you just look at the two RSI separately and see what they both are doing. If I am using this strategy for swing trading would it work if I wait for a stock crossing the RSI(7) 60 and look at an hourly chart that is in between 40 and 60 and then just use the smaller time frames for entries. Or is there an issue with those conditions. Thats what I kinda understood from reading the directions. Thank you so much for responding and sorry if im bothering you!
 
M

martyrjohn

Member
It's pretty straight forward. If the 1 hour bar closed above 60 or below 40, that would be my entry. Now the caveat, I also follow a combined avg. RSI of the $DJI & $COMP, watching for strength, weakness, or sideways action. So, if stock crosses 60, but the avg. RSI is sideways or not showing any type of support, I pass. I will also review the 15 and 30 min. charts to aid in any decisions. Did well on $AAPL today. I'm an RSI person for day trading. Also, today I used the 30 min. chart for entry.
Also do you also use period 7 RSI for the comp and dji
 
Rojo Grande

Rojo Grande

Member
VIP
Also do you also use period 7 RSI for the comp and dji
Here is the study I use. It was created by mashume. I do use the 7 period for the RSI. If you're swing trading, I believe you want to use the daily chart. This would mean that you go long when it closes above 40 and short when it closes below 60.

Code:
# AVERAGE of RSIs FOR GROUP OF STOCKS
#
# useThinkScript
# 2020-02-26
# [USER=153]@mashume[/USER]


declare lower;

input RSI_TYPE = {default WILDERS, SIMPLE, EXPONENTIAL};
input RSI_LENGTH = 7;

input OS = 40;
input OB = 60;

input ticker_1 = "COMP";
input ticker_2 = "$DJI";

def RSI_1 = RSI(price = close(ticker_1), "average type" = RSI_TYPE, length = RSI_LENGTH);
def RSI_2 = RSI(price = close(ticker_2), "average type" = RSI_TYPE, length = RSI_LENGTH);


plot data = (RSI_1 + RSI_2) / 2;

#plot midline = 50;
#midline.SetDefaultColor(Color.GRAY);

plot oversold = OS;
oversold.SetDefaultColor(Color.RED);

plot overbought = OB;
overbought.SetDefaultColor(Color.GREEN);

#AddLabel(yes, "AVG RSI: " + Data, if Data > OverBought then (Color.GREEN) else if Data < OverSold then (Color.RED) else Color.GRAY);
 
M

martyrjohn

Member
Here is the study I use. It was created by mashume. I do use the 7 period for the RSI. If you're swing trading, I believe you want to use the daily chart. This would mean that you go long when it closes above 40 and short when it closes below 60.

Code:
# AVERAGE of RSIs FOR GROUP OF STOCKS
#
# useThinkScript
# 2020-02-26
# [USER=153]@mashume[/USER]


declare lower;

input RSI_TYPE = {default WILDERS, SIMPLE, EXPONENTIAL};
input RSI_LENGTH = 7;

input OS = 40;
input OB = 60;

input ticker_1 = "COMP";
input ticker_2 = "$DJI";

def RSI_1 = RSI(price = close(ticker_1), "average type" = RSI_TYPE, length = RSI_LENGTH);
def RSI_2 = RSI(price = close(ticker_2), "average type" = RSI_TYPE, length = RSI_LENGTH);


plot data = (RSI_1 + RSI_2) / 2;

#plot midline = 50;
#midline.SetDefaultColor(Color.GRAY);

plot oversold = OS;
oversold.SetDefaultColor(Color.RED);

plot overbought = OB;
overbought.SetDefaultColor(Color.GREEN);

#AddLabel(yes, "AVG RSI: " + Data, if Data > OverBought then (Color.GREEN) else if Data < OverSold then (Color.RED) else Color.GRAY);
Perfect thank you. Is there any other conditions that just the daily going over 40. Does the hourly chart also have to be going over 60? Or do I just go long when daily chart closes above 40 and COMP and DJI are both uptrending. Thanks again!
 
M

martyrjohn

Member
@Rojo Grande Also how do you get the average rsi of comp and dji
 
Rojo Grande

Rojo Grande

Member
VIP
@Rojo Grande Also how do you get the average rsi of comp and dji
No, the hourly and the daily are separate. Did you load the study I posted for you above? If you did, It will show you the average.
 
B

Beltrame1

New member
Perfect thank you. Is there any other conditions that just the daily going over 40. Does the hourly chart also have to be going over 60? Or do I just go long when daily chart closes above 40 and COMP and DJI are both uptrending. Thanks again!
I copied the code and inserted it, but a message "lower" not allowed came it, so I removed the "declare lower" altogether. Is this supposed to be seen on the upper part of the chart (main screen) or is it supposed to be on the lower chart? Any pictures on how it would look like?
Thanks
 
M

martyrjohn

Member
I copied the code and inserted it, but a message "lower" not allowed came it, so I removed the "declare lower" altogether. Is this supposed to be seen on the upper part of the chart (main screen) or is it supposed to be on the lower chart? Any pictures on how it would look like?
Thanks
It is supposed to be on lower chart. Can you send me a picture of the error popping up?
 
M

martyrjohn

Member
No, the hourly and the daily are separate. Did you load the study I posted for you above? If you did, It will show you the average.
OH! Sorry okay I though that was the RSI of the charts I was looking at. Thannk you so much!
 
Rojo Grande

Rojo Grande

Member
VIP
It is a lower study. I
I copied the code and inserted it, but a message "lower" not allowed came it, so I removed the "declare lower" altogether. Is this supposed to be seen on the upper part of the chart (main screen) or is it supposed to be on the lower chart? Any pictures on how it would look like?
Thanks
I don't know, I just copied the above script and it works on mine.
 
T

thatguytrades

New member
You are correct with the "Range Bars" however the number of trades are way too high with a setting of RSI (7). I changed the code a-bit so you can change the RSI setting with the input setting. Keep in mind this is Long only.

##############################################################################################

#r2 changed the RSI length so it can be adjusted through input setting.

input length = 7;
input over_Bought = 60;
input over_Sold = 40;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);
def BEAR = over_Sold;
def BULL = over_Bought;
def UpSignal = if RSI crosses above BEAR then BEAR else Double.NaN;
def DownSignal = if RSI crosses below BULL then BULL else Double.NaN;

#RSI ALERT
def Bearish = RSI crosses below 60;
def Bullish = RSI crosses above 40;

Alert(Bullish, ” EMA Possible SIGNAL UP ”, Alert.BAR, Sound.Ding);
Alert(Bearish, " EMA2 Possible SIGNAL DOWN ", Alert.BAR, Sound.Ding);

#For Orders
input TradeSize = 2;

def Ent = RSI(length)."RSI" crosses above 60 ;
def Ext = RSI(length)."RSI" crosses below 60 or RSI(length)."RSI" >= 85;

AddOrder(OrderType.BUY_TO_OPEN, Ent, close, TradeSize);
AddOrder(OrderType.SELL_TO_CLOSE, Ext, close, TradeSize);

#end code

#request by ykd2018x on 8.13.2019
#1. 5 MIN CHART time frame ,
#def TradeSize =2;
#def Ent= RSI("length" = 7)."RSI" crosses above 60 ;
#close condition , if/when rsi =85 close it /// OR cross below 60 close it

#################################################################################################
wait will this code automatically make trades for your?
 
Top