Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 18:16:03 +0000



Indicating the 4th bar in the same direction

View Count: 724

[2022-10-10 15:41:26]
User187934 - Posts: 40
I would like to automatically indicate every 4th Heiken ashi bar in a sequence so if there are 4 up bars in a row then indicate this in a different color or with a dot. The same for 4 down bars in a row. Is this possible and how?
[2022-10-10 17:57:33]
John - SC Support - Posts: 31355
You would need to use the Color Bar Based On Alert Condition and check the Close against the Open to determine direction and do it for the 3 previous bars and the current one. Refer to the following:
Color Bar Based on Alert Condition

Your alert condition would look like the following for a string of 4 up bars in a row:
=AND(C[-3] > O[-3], C[-2] > O[-2], C[-1] > O[-1], C > O)
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-10-10 19:22:42]
User187934 - Posts: 40
Thank you for the info. Is it possible to base the condition on the heiken ashi output color rather than on the open and close criteria as the current formula is not providing the correct signal which would be every time there are 4 of the same heiken ashi color bars in a row.

Red arrows in the attached screenshot are missed signals.
imageChartImage.jpg / V - Attached On 2022-10-10 19:22:08 UTC - Size: 280.72 KB - 90 views
[2022-10-10 19:43:47]
User187934 - Posts: 40
I used the following and this is closer but still not perfect:
=AND(OHLC > OHLC[-1], OHLC[-1] > OHLC[-2],OHLC[-2] > OHLC[-3], OHLC[-3] > OHLC[-4])

If the criteria could just be based on whatever the heiken ashi formula is then I think that could solve it.
[2022-10-10 21:45:43]
John - SC Support - Posts: 31355
Heikin-Ashi does use the same criteria for determining the color of the bar in terms of Open and Close.

But we realize that in the formula we gave you, we assumed that you were using the Heikin-Ashi as the main price graph.

It sounds like this is not the case, in which case, your formula needs to be the following:

=AND(IDx.SG4[-3] > IDx.SG1[-3], IDx.SG4[-2] > IDx.SG1[-2], IDx.SG4[-1] > IDx.SG1[-1], IDx.SG4 > IDx.SG1)

Where the x in IDx is replaced with the ID of the Heikin-Ashi study.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-10-11 08:23:49]
User187934 - Posts: 40
That worked perfectly thank you. I added a condition so that only the 4th bar indicates and so got exactly what I wanted.

I have a few more questions please:

1. What does the SG1 and SG4 stand for?
2. Would it be possible to create a zig zag type indicator using the signals? I have an alert for up bars and for down bars so would it be possible to some how draw a line between the up signal and down signal? I have added a screen shot to explain. Ideally the zig zag H/L would go to the H/L of the final bar of the same color after the signal bar


Thanks for the help.
imageChartImage.jpg / V - Attached On 2022-10-11 08:23:12 UTC - Size: 340.47 KB - 76 views
[2022-10-11 15:19:52]
John - SC Support - Posts: 31355
SG1 and SG4 are subgraphs (SG stands for Subgraph). In the Heikin-Ashi study SG1 is the Open and SG4 is the Close/Last. Refer to the following for how to use Subgraphs in Alerts:
Study/Chart Alerts And Scanning: Referencing Study Subgraphs

There is not a built-in method to draw a line between the points as you are wanting. The Zig Zag study does it by using the Drawing Tools to do it. You could create a custom study to do what you want, refer to the following:
Advanced Custom Study Interface and Language (ACSIL)
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2022-10-11 16:23:54]
Sawtooth - Posts: 3992
Would it be possible to create a zig zag type indicator using the signals?
:
You could do it with the Spreadsheet Formula study, with a formula like this in its Formula field:
=IF(4thUpBar>0,H,IF(4thDownBar>0,L,0))

Set Draw Zeros to No.
Use the Line draw style.
[2022-10-13 14:08:30]
User187934 - Posts: 40
@tomgilb, Thanks for the input. I have tried but I don't really know what I am doing. If these are the formulas that I am using for the alerts then what would I do next. Never used the spreadsheet formula befor.

4th Green candle alert: =AND(ID:6.SG4[-3] > ID:6.SG1[-3], ID:6.SG4[-2] > ID:6.SG1[-2], ID:6.SG4[-1] > ID:6.SG1[-1], ID:6.SG4 > ID:6.SG1, ID:6.SG4[-4] <= ID:6.SG1[-4])

4th Red candle alert: =AND(ID:6.SG4[-3] < ID:6.SG1[-3], ID:6.SG4[-2] < ID:6.SG1[-2], ID:6.SG4[-1] < ID:6.SG1[-1], ID:6.SG4 < ID:6.SG1, ID:6.SG4[-4] >= ID:6.SG1[-4])
[2022-10-13 16:14:25]
Sawtooth - Posts: 3992
If these are the formulas that I am using for the alerts then what would I do next.
Despite its name, the Spreadsheet Formula study is not a spreadsheet study; it uses the same Alert syntax you are using.

You can reference the color bar studies that your formulas are in, like this:
=IF(ID7.SG1>0,H,IF(ID8.SG1>0,L,0))
where ID7 is the green candle alert, and ID8 is the red candle alert.

Position the Spreadsheet Formula study below both color bar studies in the Studies to Graph list.
Date Time Of Last Edit: 2022-10-20 03:05:47
[2022-10-13 18:25:26]
User187934 - Posts: 40
I tried that but nothing shows so not sure what I am doing wrong. I think I followed the steps exactly as you explained
[2022-10-13 21:23:17]
Sawtooth - Posts: 3992
Are you seeing the markers without the zigzag lines?

If so, have you edited the example formula in post #10 to reference your specific color bar studies?
[2022-10-16 12:40:04]
User187934 - Posts: 40
Yes I am seeing the markers but no zig zag lines and I did edit the formula to reference the correct studies.
[2022-10-16 12:49:45]
Sawtooth - Posts: 3992
Please Direct Message me.
[2022-10-20 03:09:52]
Sawtooth - Posts: 3992
I found an error in the formula in post #10.
It has been corrected.

Please try again using the edited formula in post #10

Also, the attached chartbook is an example of this.
attachmentZZ lines at 4th same candle of CDelta.Cht - Attached On 2022-10-20 03:09:42 UTC - Size: 4.69 KB - 87 views
[2022-10-20 08:39:23]
User187934 - Posts: 40
Thank you @tomgilb that worked now so I am getting there. Do you think it would be possible to complicate the criteria a little so that the zig zag H/L snaps to the relevant swing H/L. So the initial criteria for a zig zag line up is the 4 bar alert but then the top of that up move is the highest point. I have saved the chart file and indicated with arrows where the ideal zig zag points would be.
attachmentZZ lines at 4th same candle of CDelta.Cht - Attached On 2022-10-20 08:39:17 UTC - Size: 9.26 KB - 80 views
[2022-10-20 12:34:25]
Sawtooth - Posts: 3992
Do you think it would be possible to complicate the criteria a little so that the zig zag H/L snaps to the relevant swing H/L
In short, probably not.
What you are asking is more than a little complicated.

What would be your rules for isolating that H/L ?
[2022-10-20 13:33:19]
User187934 - Posts: 40
The criteria for the high would be:
1. 4 green candles in a row
2. H of zig zag snaps to the highest H after that 4 bar sequence.
3. The H is confirmed as such once there is a 4 bar red candle sequence which then initiates the L criteria.

L Criteria:
1. 4 red candles in a row
2. L of zig zag snaps to the lowest L after the 4 bar sequence
3. L is confirmed when the next 4 green bar sequence prints
[2022-10-20 17:12:24]
Sawtooth - Posts: 3992
It is possible to find the H of the up candle that precedes the first down candle, after 4 up candles occurred.
It is possible to find the L of the down candle that precedes the first up candle, after 4 down candles occurred.

It would have these limitations:
- It would not necessarily be the highest H/lowest L.
- It would not necessarily always toggle H,L,H,L, etc.
- It would not draw until the close of the first opposite-colored candle. (it would have a 1 bar lag.)
Are these limitations acceptable?
[2022-10-20 17:20:27]
User187934 - Posts: 40
Yes sure, that will be pretty close to what I was looking for I think.
[2022-10-20 20:07:42]
Sawtooth - Posts: 3992
I will DM you about this.

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

Login

Login Page - Create Account