Login Page - Create Account

Support Board


Date/Time: Sat, 20 Apr 2024 10:09:04 +0000



[Programming Help] - Line based on slope

View Count: 1044

[2018-09-09 18:20:27]
User976133 - Posts: 38
I have a line with color based on slope.
It is from a different time range than the curremt chart.
Is there a way to use it's color inother indicator?
I am using red/green. How can I access whether the line is red or green?
[2018-09-09 22:24:38]
Xfanman1 - Posts: 320
The Overlay Study has a setting that turns the colors from the original study on or off, Use Colors From Source Study. If you set this to Yes you'll change the colors on the original study, if you set it to No you can change the colors on current study Overlay Study.

Study/Price Overlay Study: Use Colors from Source Study


--
Scott
Date Time Of Last Edit: 2018-09-09 22:25:19
[2018-09-09 22:35:42]
User976133 - Posts: 38
Thanks for the response, but it misses my point.
I have the colors where I want them.
Let's say I want an indicator that places an up arrow when the 8EMA crosses the 21 ema.
No problem. CrossFromBelow(ID1.SG1,ID1.SG2), assuming ID1 represents the moving averages.
Now, I want to add a line to the condition when the higher (or lower) time frame line is green (uptrend).
Is there a way that I can get from the slope of the line, whether it is uptrend or downtrend?
I have used ID2>ID2[-1], but because it is from a different time frame, it is unpredictable and does not accurately reflect what the slope of line accurately represents.
[2018-09-09 23:35:10]
Xfanman1 - Posts: 320
I see, as far as I know you'll have to use the Spreadsheet System Alerts to do this. I think it's too complex to do with Simple Alerts because I don't believe you can directly reference the slope condition on your other timeframe chart with a Simple Alert formula if the Overlay Study results on your main chart are too sporadic. You may want to try referencing your Overlayed MA with the Study Angle study which would allow you to adjust the length smoothing the impulses out somewhat. Not perfect, but it may help.

I am NO expert however so hopefully someone else will chime in and prove me wrong ;^)

--
Scott
[2018-09-09 23:50:23]
Sawtooth - Posts: 3976
You'll need to use a spreadsheet study because of the need for a persistent variable when the line is flat.
Spreadsheet Example Formulas and Usage: Formula that Matches the Slope Coloring of a Study Subgraph Line
[2018-09-10 00:01:48]
User976133 - Posts: 38
OK. Thanks for the tip.
Is there a step by step tutorial for spreadsheets?
What would you recommend as the best way to ffigure it out?
[2018-09-10 00:33:52]
Sawtooth - Posts: 3976
Is there a step by step tutorial for spreadsheets?
Not really, but there is extensive documentation:
https://search.sierrachart.com/?q=spreadsheet&submitted=true
What would you recommend as the best way to figure it out?
Lots of study and trying. When you get stuck, ask questions.

Here are some other tips:
https://www.sawtoothtrade.com/tips.html

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

Login

Login Page - Create Account