Login Page - Create Account

Support Board


Date/Time: Thu, 28 Nov 2024 00:32:49 +0000



Alert if price is near a line, not past or to it yet, but near it?

View Count: 1008

[2020-07-04 15:21:53]
Chadly - Posts: 65
Im curious if there's a way to program that price is near a line.

The idea is that perhaps you have linear regression built in and you want to say "only if price is below this line by 20 percent" or something like that.

So, a buy signal for example would fire, but only if the price is not too close to the top line of linear regression.

Is there a way to do this?
[2020-07-04 15:34:00]
ForgivingComputers.com - Posts: 960
"only if price is below this line by 20 percent"

This is the same as saying price is less than 80% of this line.

If the line is ID1.SG1:

=(C<0.8*ID1.SG1)

Will produce a 1 or true if the condition is true.
[2020-07-04 19:11:01]
ondafringe - Posts: 286
Brad gave you what you asked for, but what you asked for isn't really what you want because price will be 20% or more below your regression line most of the time, which would result in numerous alerts. If I understood your post, what you really want to know is, as price is rising, sound an alert when price gets within 20% of your regression line.

I would create a new study by adding "Study Subgraph Multiply".
In "Settings and Inputs > Standard Precedence > Based On," select the study that includes your regression line.
Set the Chart Region to 1

For "Input Data," select your regression line.
Set the Multiplier to 0.8

That should give you a continuous line that is always 20% below your regression line.

Then create a =CROSSOVER() alert for when price crosses the 80% line.
Date Time Of Last Edit: 2020-07-04 19:16:34
[2020-07-09 02:00:27]
Chadly - Posts: 65
Thank you both. Brad has it right on the money. I have a recipe that has many stipulations but for example I don't want that buy recipe to fire if the price is too close to the top of the regression. So, if the price is 20% below the top of the regression than any buy signal can fire, but if it's above the 20% close to the line...it does not fire.
[2020-07-09 03:08:55]
ondafringe - Posts: 286
But buy signal will also fire when price is anywhere below the 20% mark; anywhere within the 80%. So if your line is, say, 100, buy will fire anywhere between 0 and 80.

If that's what you want, then you're good to go. But if you want your buy to fire at exactly 20% below your regression line...
Date Time Of Last Edit: 2020-07-09 03:16:12
[2020-07-09 13:19:15]
Chadly - Posts: 65
well, I think the converse would happen for buy vs sell in the code. I'd have to mess with it a little, but I think the code will work. Then only the buy recipe goes into the buy alert and the sell recipe goes into the sell alert so none are mixed.... so as long as the code can be converse by changing 80 to 20 and/or changing the ID.SG then I should be good.
[2020-12-06 16:45:28]
Chadly - Posts: 65
Thank you everyone.

Specifically I was curious if a drawn line could be input as the reference. Not so much a regression or a study, but a drawn line I manually input.

Could you add that the drawn line is the reference, then as that line is crossed, obviously you've broken that channel and if that happens with your recipe of other things/volume/momentum etc, then you know this will continue to break through that channel. The channel though would likely need to be drawn.

I haven't found a study that automatically and accurately marks channels. Linear Regression is nice for visual, but as someone stated here, it moves and that's just not what needs to happen here I guess.

THanks
[2020-12-06 17:43:02]
ForgivingComputers.com - Posts: 960
Specifically I was curious if a drawn line could be input as the reference. Not so much a regression or a study, but a drawn line I manually input.

Harder to do as a drawn line is not visible as a study subgraph, unless you use the Horizontal Line study. It can be done in ACSIL, with a custom study.
Date Time Of Last Edit: 2020-12-06 17:44:01
[2020-12-07 15:27:33]
John - SC Support - Posts: 36350
WRT Post #7, you can reference drawings in alerts. Refer to the following section, specifically the section for Reference by Bar Value section for what you are looking for.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-06-14 17:30:04]
Saddlefree - Posts: 3
Hi, hope all is well.

I am new to Sierra chart, and was trying to set alerts on the 2stdev upper & lower bands of the Linear regression channel.
I followed Ondafringe's instructions and keep getting an error message.
Is the =CROSSOVER() applied to the alert section of the Study Subgraph Multiply?
This is how I typed it in, =CROSSOVER(ID33.SG3). Is this accurate?
Could you please point me in the right direction?
Thanks in advance
[2023-06-14 19:02:01]
John - SC Support - Posts: 36350
The CROSSOVER() function requires 2 parameters. The first is the data that is doing the crossing and the second is the item that is being crossed. From the above, what you are checking is the Last price (Close) against the Study Subgraph Multiply. Therefore, your alert would be the following:
=CROSSOVER(C, ID33.SG3)

Where C is a shorthand available within Sierra Chart for the Close.

Refer to the following for information on the CROSSOVER() function:
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#CROSSOVER_Function

You enter the Alert on the Alert tab of studies or on the Chart Settings window. The main thing you want to ensure is that whatever study you put it on is one of the last to calculate for the items you need. Putting it on the study itself that is being referenced is one of the safest ways to ensure this, so you are good the way you have it setup. Refer to the following:
Study/Chart Alerts And Scanning: To Enter an Alert Condition on a Study

Study/Chart Alerts And Scanning: Referencing Other Studies on the Chart
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account