RSI & Ichimoku Scans/Alerts


0
0

Hi Hahn,

I was wondering if you could help me with the following 3x alerts.

1.) If a stock is under the cloud on Ichimoku & then goes above the Ichimoku in a single bar.
2.) Stock with RSI above 79 & crosses below 21 in the same bar or day.
3.) Stock with RSI below 21 & crosses above 79 in the same bar or day

 

Thanks,

Dustin

RESOLVED
Marked as spam
Posted by (Questions: 2, Answers: 3)
Asked on January 28, 2017 11:36 am
931 views
0
Private answer

Ok, I’ll only post the lines of code that you would add to each existing study:

Number One:

def ichiCloudCrossAbove = high[1] < "Span A" and high[1] < "Span B" and close > "Span A" and close > "Span B";
Alert(IchiCloudCrossAbove, "Cross Above Cloud", Alert.BAR, Sound.RING);

Note: the above code assumes a literal interpretation of your specification. So that the high of the previous bar must be under the cloud and the close of the current bar must be above the cloud

Number Two:

def rsiOneBarCrossBelow = RSI[1] > 79 and RSI < 21;
Alert(rsiOneBarCrossBelow, "RSI Cross Below", Alert.BAR, Sound.RING);

Number Three:

def rsiOneBarCrossAbove = RSI[1] < 21 and RSI > 79;
Alert(rsiOneBarCrossAbove, "RSI Cross Above", Alert.BAR, Sound.RING);

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on January 28, 2017 2:38 pm
0

Hi Hahn.

I’m wondering how to plot these Alerts into scans. I’m used to using the ToS Scan tab to ALERT WATCHLIST SCAN when ”Scan” is ”equal to” value ”1”. There’s probably a better way but this is the only way I know.

( at January 30, 2017 9:29 pm)
0

It is very simple to convert an alert into a scan. The Alert() function takes four arguments. Each separated by a comma. The first of the four arguments is the true/false condition. So for the example I did for the Ichimoku, the first argument is ”IchiCloudCrossAbove”. If you want to convert that to a scan simply replace the Alert statement with ”plot scan = IchiCloudCrossAbove;”

( at January 30, 2017 10:46 pm)
0
Hi Hahn, The RSI scans don’t seem to be picking anything up. However, the Ichimoku scan works great!!! I’m not sure if its not working or just has not found anything yet. I have my ToS scans set to alert when value = 1. I took the ToS RSI generic ThinkScript & added your 3 lines at the bottom, but not seeming to produce any results. Thanks again for all your help! ———————-ThinkScript———————————– declare lower; input length = 14; input over_Bought = 80; input over_Sold = 20; input price = close; input averageType = AverageType.WILDERS; 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; plot RSI = 50 * (ChgRatio + 1); plot OverSold = over_Sold; plot OverBought = over_Bought; RSI.DefineColor(\\\\\\\\”OverBought\\\\\\\\”, GetColor(5)); RSI.DefineColor(\\\\\\\\”Normal\\\\\\\\”, GetColor(7)); RSI.DefineColor(\\\\\\\\”OverSold\\\\\\\\”, GetColor(1)); RSI.AssignValueColor(if RSI > over_Bought then RSI.color(\\\\\\\\”OverBought\\\\\\\\”) else if RSI 79 and RSI < 21; plot scan = rsiOneBarCrossBelow; Alert(rsiOneBarCrossBelow, \\\\\\\\\\\\\\\"RSI Cross Below\\\\\\\\\\\\\\\", Alert.BAR, Sound.RING);
( at February 1, 2017 8:50 pm)
0

Your code appears to be missing this line:
def rsiOneBarCrossBelow = RSI[1] > 79 and RSI < 21; The compiler should be giving you an error message while that line is missing.

( at February 1, 2017 10:04 pm)
0

Hahn,

I have that in my code (see below). I guess when I ran out of characters it cut off some of my coding.

——————–
declare lower;

input length = 14;
input over_Bought = 80;
input over_Sold = 20;
input price = close;
input averageType = AverageType.WILDERS;

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;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;

RSI.DefineColor(”OverBought”, GetColor(5));
RSI.DefineColor(”Normal”, GetColor(7));
RSI.DefineColor(”OverSold”, GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color(”OverBought”) else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal")); OverSold.SetDefaultColor(GetColor(8)); OverBought.SetDefaultColor(GetColor(8)); def rsiOneBarCrossBelow = RSI[1] > 79 and RSI < 21; plot scan = rsiOneBarCrossBelow; Alert(rsiOneBarCrossBelow, "RSI Cross Below", Alert.BAR, Sound.RING);

( at February 2, 2017 7:01 am)
0

Ok, that version appears correct. For a lower study, but not for a scan. A scan will only except a single plot statement so there is a lot that needs to be adjusted there. But for a lower study it will plot the RSI indicator along with the alert signal. Problem is the alert signal has a range of 0-1 while the RSI has a range 0-80. So you will never be able to see the signals with the naked eye. If you complete the conversion to a form that can run in a scan, you will be able to plot it as a lower study and see only the signal line.
Another issue to point out is that for the RSI to go from above 79 to below 21in a single bar, almost never happens….. when using the default settings. Go back and look at some charts and see if you can find any single day moves of the RSI from 79 down to 21. Then adjust the settings until you find one. Alternatively, you can change the values from 79 and 21 to something easily achieved such as 70 and 69.

( at February 2, 2017 8:59 am)
0
Private answer

Hey Pete, Thanks for your recent replies to my questions in the forums, YOU THE MAN!!! I want to piggy back on this one, or if you’d like to make it a separate question for others to enjoy also? So I also use the cloud, and I find it to be one of the biggest indicators prices relate to. Specifically when it price goes from below or in the cloud and breaks the cloud. Now I use your amazing chart_alert_ichimoku which is AMAZING! brilliant. but I would like it to improve it if you will?

Question: Are we able to create an alert so that the open of a candle is confirmed of breaking the cloud(you have this set either confirm “cloud break” or “no” in the chart version) but having the alert linked to your watch lists so that it’s not requiring you to have the chart open itself? Instead of clicking thru each stock trying to find one trying to move out of the cloud. The best time would be when it first taps outside the upper cloud so you can watch it immediately after for confirmation. It would be very convenient because if you use it as a scan instead it can be delayed breaking and personally I don’t like having to flip back and forth between scan and charts on TOS.

Thanks again Pete,

Logan

Marked as spam
Posted by (Questions: 2, Answers: 1)
Answered on March 15, 2017 8:29 am
0

This one was posted in the Alerts and Notifications topic. It seems this new request is for a watchlist solution. That would be a different topic. You ask about setting alerts for a watchlist but this is not possible in Thinkorswim at the time of this writing. All we can do is set values and colors to indicate conditions for custom studies.You will likely find that a similar delay is present in the watchlist as you have observed in the scan. Other viewers have reported 3-4 minute delay. If you are working on such a low time frame that a 3-4 minute delay becomes a problem, then a scan or a watchlist is really not going to help.
I will mention that a scan can be saved and loaded into a watchlist. So that the scan results are added/removed from the watchlist as signals are triggered in the scan in real time.

( at March 15, 2017 8:48 am)