♥ 0 |
Hi Pete, I was wondering how to create an alert on the actual chart itself regardless of the symbol. I have a script I created for study alerts, but I would like it on the actual chart just like for example when you gave out the Heikin Ashi bar color change alert. Here is my script, basically I just want it to alert me when the stochastics are Overbought/Oversold or 70+ & 30- StochasticFull(“k period” = 9, “d period” = 3).”FullK” is less than 30 or StochasticFull(“k period” = 9, “d period” = 3).”FullK” is greater than 70
Marked as spam
|
Private answer
I updated the title of your question to better describe the context of your request. This will help the rest of our viewers to locate this solution using the search function. There are many examples of chart study alerts scattered throughout this forum. But I don't think anyone has requested a solution for Stochastic FullK overbought/oversold. Let's begin by providing the language reference for the Alert() function used in Thinkorswim: https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Others/Alert From that resource we see that the Alert() function takes 4 parameters. The first of which is the true/false conditions used to trigger the alert. You sample script combines the overbought and oversold conditions into one statement. We can separate that into separate true/false conditions as follows:
Notice that those conditions are merely checking if the FullK is in the oversold condition or the overbought condition. If we use them exactly as they are, the chart study alert will get triggered for each and every bar in which the FullK is either overbought or oversold. Some may find this annoying, and prefer a solution which only captures the first bar which crosses into oversold or overbought range. However that would not exactly match the behavior of the sample script you provided. So this solution will attempt to hold true to the exact conditions you have specified. In order to add the chart study alerts we only need to add two more lines of code:
The only thing lacking now are some plots. We can take those same conditions which trigger the alerts and use them to plot arrows on the price graph. The following solution puts all those pieces together:
And I know many folks are going to find that pretty annoying, having the alert fire off for every bar that is overbought or oversold instead of just the first bar that crosses. So you can modify the plot statements as follows:
Marked as spam
|
Please log in to post questions.