Login Page - Create Account

Support Board


Date/Time: Thu, 23 Jan 2025 00:01:50 +0000



[Programming Help] - Stochastic Alert

View Count: 1861

[2016-10-04 18:56:50]
User292365 - Posts: 20
Hello, I understand that if I use this alert equation for stochastic: =AND(CROSSOVER(SG1, SG2), SG1 > 70), when the %K line crosses the %D line and %K is above 70, then an alert will be given.

I would also have a stochastic alert that triggers if SG1 < 70. How do I add this to the formula? I know I have to use the OR command.

Would it be something like =OR(CROSSOVER(SG1, SG2), SG1 > 70, SG1 < 30)? But see, I know this is not going to work because the alert will be triggered if anyone of these conditions are triggered. I still want to make sure the stochastic is either overbought (above 70) or oversold (below 30).

So, what about if I use something like this: =or(and(CROSSOVER(SG1, SG2), SG1 > 70), and(CROSSOVER(SG1, SG2), SG1 < 70))

Would the alert above work. It is telling me to give me a stochastic alert if K crosses D and stochastic is overbought or if K crosses D and stochastic is oversold. I'm trying out this equation to see if it works.

If u guys could help me out with this u'll be life savers!

Thanks!

PS: How do I delete a question once I've posted to the forum?
Date Time Of Last Edit: 2016-10-04 20:00:14
[2016-10-05 04:48:30]
Sierra Chart Engineering - Posts: 104368
Yes this is the correct formula:
=or(and(CROSSOVER(SG1, SG2), SG1 > 70), and(CROSSOVER(SG1, SG2), SG1 < 70))

Why do you want to delete the question? We do not see anything private here or anything that should be deleted. It may be useful for others. This is the whole reason why we have a public support board.

If you start deleting questions, it may lead to a case where we do not even provide support at all to you. If there is a good reason to delete a post, it can be done.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-10-26 02:07:18]
User798620 - Posts: 29
Ok ive got this same alert, but is there a way to have it alert only if it crosses from above or below a given line? for example if its over bought i only want the alert if SG1 crosses down, i dont need one if it crosses up... but when i put this in i get an alert on every crossover... kinda annoying.
[2018-10-26 09:15:41]
Xfanman1 - Posts: 320
Use the CROSSFROMABOVE or CROSSFROMBELOW commands instead of your CROSSOVER command if you want to insure directionality.

Or you could look back to the previous bar using [-1] and make your condition directional by having the previous bar be higher AND SG1 crossing will accomplish the same thing as CROSSFROMABOVE.

The look back portion would something like ..

ID05.SG1<ID05.SG1[-1]
(ID05 being your Stochastic Study)

Scott
Date Time Of Last Edit: 2018-10-26 09:21:26
[2018-10-27 16:22:10]
User798620 - Posts: 29
Thanks this is super helpful im loving how much i can do! i have one last question, what if i want my stochastic cross to combine with my line movemnt on my DMI lines. heres the problem it doesn't always happen on the same candlestick, sometimes its lags by one period. usually the stochastic crosses first. and then the next period i get my DMI signal. but i dont simply want to say one line is over the other because i need a recent Cross, it cant just be line 1 is over line 2... can i use this [1] for a signal a period ago? hope thats clear....
Date Time Of Last Edit: 2018-10-30 00:19:00
[2018-10-30 01:04:00]
Xfanman1 - Posts: 320
Sure, you can look back as many bars/periods as you wish. You can also define a range and not a specific bar. You can look forward too by using a positive value depending on your formula.

Don’t forget the negative symbol in your lookback period [-2] otherwise it’s looking forward.


Scott

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account