Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 03:18:09 +0000



Color Bar Based on Alert on PNF Chart

View Count: 384

[2023-07-19 08:28:54]
Oz - Posts: 48
Hi,
I'm trying to get a simple alert on a point & figure chart with numbers bars.
Whereby we have a negative close (or down bar) with positive delta and then positive close (up bar) with negative delta.

I'm using the study: Color Bar Based on Alert Condition:
=AND(C<O, AV-BV>0)
however it's not working properly, I think it's due to the way a PNF chart defines the open and close of a bar.
Or I've missed something here?
Works fine on a 1 minute candlestick chart but not on PNF.
Is there a way to do this? or a work around for PNF?
Any assistance greatly appreciated.
cheers
imageAlerts on PNF1.png / V - Attached On 2023-07-19 08:26:02 UTC - Size: 299.49 KB - 64 views
[2023-07-19 15:31:59]
John - SC Support - Posts: 31362
There is nothing special about how the Point and Figure deal with the Open and Close. So your formula should work, and we tried it ourselves and everything is fine. We are not sure how you are using the Color Bar Based on Alert Condition study, so your issue may be related more to that setup than to your formula.

Try using the Spreadsheet Formula study with your Alert Condition (the Spreadsheet Formula study uses the Alert Syntax, so you can just copy and paste your alert). You will see that the alert works fine in the Spreadsheet Formula. Then work forward from there to figure out what is not working as you expect.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-07-19 17:20:56]
Oz - Posts: 48
Thanks John,
What input are you using on the Color Bar Based On Alert Condition?
[2023-07-19 17:36:04]
Oz - Posts: 48
John,
Do you have your graph draw type set to: Candlestick Bars or Point & Figure XO,
I have it working on Candlestick Bars but it's not correct on PNF XO.
Cheers
[2023-07-19 18:14:22]
John - SC Support - Posts: 31362
What you showed in your image was a Numbers Bars chart.

What exactly do you want to do?
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-07-20 01:39:05]
Oz - Posts: 48
Hi John,
Thank you for your time and reply.

Please see 2 pics attached.

Point & Figure charts show the up and down legs as marked with X+O's
Yes that is a numbers chart with settings:
Bar Period Type: Point And Figure Bar
Bar Period Value: 1 -5
Graph Draw Type: Point and Figure XO

The alert condition does not work properly when
Graph Draw Type: Point and Figure XO

PS>> It does work when Graph Draw Type = Candlesticks, however this does not give a true representation of up and down legs as per PNF XO (1-5).

Hence the question is:
How can I get the alert to work based on
PNF Bar Period and PNF XO

What does the Alert need to be modified to for PNF XO Chart to show the mentioned divergences.

Thanks again,
cheers
imageAlerts on PNFA set to PNFXO.png / V - Attached On 2023-07-20 01:35:14 UTC - Size: 372.61 KB - 71 views
imageAlerts on PNFB set to Candlesticks.png / V - Attached On 2023-07-20 01:35:32 UTC - Size: 379.75 KB - 65 views
[2023-07-20 16:04:56]
John - SC Support - Posts: 31362
We are not seeing any difference in the alert condition based on whether the bars are set to a Point and Figure XO or Candlestick.

We think you are expecting to see a difference, since Point and Figure XO uses an oscillating Up/Down bar pattern, but again, since you are just testing Open versus Close, this will not be reflected.

The one way we can think to do this is to use the Bar Numbering study and use the MOD() function (modulus) to check if the bar is either an Even or an Odd number. You would have to line up the particular one you want for when it is a down bar.

For example, if the Bar Numbering study is ID3, and your down bars are on the even numbered bars, then your formula would look like the following:
=AND(MOD(ID3.SG1, 2) = 0, AV-BV > 0)

If the down bars are on the odds, then your formula would be the following:
=AND(MOD(ID3.SG1, 2) <> 0, AV-BV > 0)

We are not sure if the Point And Figure XO always starts with the same type (up or down) in the chart, so you would have to check this to ensure that your formula matches up if you change the chart, or when you first open Sierra Chart.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-07-20 16:44:58]
Oz - Posts: 48
Hi John,
Thank you again for your efforts. I got an idea.
PNF XO charts should alternate with each rotation from bar to bar,
this does not happen when set to Candlestick hence why I think there is an issue as we are always referencing the open and or close of each bar in the alert.
From my observation PNF bars always alternate, however my settings reset at session open, so this throws a spanner in the works.

One thing I observe:
a. each up bar has a higher low.
b. each down bar has lower high.
they alternate, except for at session opens.


Could we not have a syntax that reads:
a. for an up bar, if current bar has a higher low than the prior bar and delta is negative then condition is true = paint bar?
b. for a down bar, if current bar has a lower high than the prior bar and delta is positive then condition is true = paint bar?

Just a thought, would that work?

Thank you.
Cheers
[2023-07-20 17:48:31]
John - SC Support - Posts: 31362
What you suggest will work. From the documentation for the Point and Figure Study (which is where the documentation for the Point and Figure bars is located), it states the following:
A Point & Figure column High in the case of a down Point & Figure column is always one box size below the prior High. The market may not have traded at that price.

A Point & Figure column Low in the case of an up Point & Figure column is always one box size above the prior Low. The market may not have traded at that price.

If you need help creating the formula, let us know. In particular, refer to the following for how to reference a prior bar in an alert:
Study/Chart Alerts And Scanning: Referencing Data Other Than on the Last Bar/Column In the Chart
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-07-21 12:49:06]
Oz - Posts: 48
Hi John,
Thank you for your help.
I got it to work using:
=AND(H<H[-1], AV-BV>0)

and

=AND(L>L[-1], AV-BV<0)

however there is a slight issue.
After a big move in one direction we often get a lower high and a higher low bar or an inside bar (please see pic).

So we need to add an exception or give preference to one side.
What do you suggest?

Is there a syntax for an inside bar? and then give preference to the other side when the prior bar is a down bar.
This will assume the next is an up bar, hence correcting the issue.

Any suggestions appreciated, PS with syntax explained as I feel I'm getting way out of my league here :>)
Many thanks
imagePNF Inside Bar Example1.png / V - Attached On 2023-07-21 12:48:27 UTC - Size: 258.81 KB - 65 views
Attachment Deleted.
[2023-07-21 14:29:22]
John - SC Support - Posts: 31362
Just for information, since you were wanting to find the Down bar, you would need to test the Highs of the two bars. But as we think about this, it is not enough to guarantee that the bar is actually a Down bar. Since an Up bar could also meet this criteria.

The only thing we can think to do would be to use the Spreadsheet Study and check whether the first bar of the Session is up or down (test if Close is higher or lower than the Open). This will give you initial direction which you can then use with the Bar Numbering study to determine if any particular bar is Up or Down.

The tricky part is that you will have to have create a column to know if the bar numbering for the Down bar is going to be on the Even or Odd numbers for that session.

This is getting beyond what we can put together for you, so you will have to work it out yourself - or perhaps with help from the community.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-07-21 14:43:30]
Sawtooth - Posts: 3993
You can use the Spreadsheet Formula study to find up and down bars, using this formula in its Formula field:

=IF(OR(C>O,AND(O>C[-1],O=C)),1,IF(OR(C<O,AND(O<C[-1],O=C)),-1,ID5.SG1[-1]))
where ID5 is this Spreadsheet Formula study.
Up bars will return 1, down bars will return -1.

This is an Alert syntax conversion from this spreadsheet syntax:
Spreadsheet Example Formulas and Usage: Formula that Matches the Coloring of Up and Down Price Bars
[2023-07-21 14:54:00]
Oz - Posts: 48
Hi John,
I don't like that option as mentioned previously due to a new bar forming at the start of each session which is likely to put it out of sync.

If anyone has any idea's please let me know.
Cheers
[2023-07-21 14:58:26]
Oz - Posts: 48
Hi @Tomgilb,
Thank you, just saw your reply.

I have not ventured into the spreadsheet studies yet.
Looks like that's where I'll be for the week-end :>)
I'll give that a try and see if I can get it going.

Many thanks,
cheers
[2023-07-21 15:04:23]
Sawtooth - Posts: 3993
I have not ventured into the spreadsheet studies yet.
Despite its name, the Spreadsheet Formula study is not a spreadsheet study.

It uses Alert syntax, which you are already using.
[2023-07-21 16:14:07]
Oz - Posts: 48
@TomGilb,
Thank you. I did not realize that.
I'll have a read of the documentation over the week-end.
Obviously I'll need to revert back to the color bar study and use the formula:
=AND(C<O, AV-BV>0)
and
=AND(C>O, AV-BV<0)

Quick question as I don't fully understand this yet.

The Spreadsheet Formula setting Based On; is set to <Main Graph>
and

Color Bar Based on Alert Condition settings
Based On: Spreadsheet Formula
with Input Data (In:6) set to: Result

Is this right?

Thank you.
[2023-07-21 18:03:42]
Sawtooth - Posts: 3993
Is this right?
No, instead you would reference the Spreadsheet Formula's ID#.SG# in your formulas, like this:
=AND(H<H[-1], AV-BV>0, ID5.SG1=-1)
and
=AND(L>L[-1], AV-BV<0, ID5.SG1=1)
[2023-07-22 02:27:18]
Oz - Posts: 48
@Tomgilb,
Thank you.
I've added the Spreadsheet Forumla study and set Formula (in:1) as per studies to graph.
I may have a setting wrong, but when graph type is set to Point & Figure I'm not getting the correct +1/-1 value as shown in subgraph 3.
Are my setting correct?
Thanks
Cheers
imagePNF AlignmentOut1.png / V - Attached On 2023-07-22 02:26:54 UTC - Size: 446.13 KB - 63 views
[2023-07-22 18:58:49]
Sawtooth - Posts: 3993
Are my setting correct?
A PnF chart will produce alternating X and O (green and red) bars.
They will not match a candlestick of the PnF bar type.

The bar direction formula will accurately follow the PnF candlestick Graph Draw Type, but not the PnF XO Graph Draw Type.

You would need to use John's suggestion in post #7 to determine the location of the alternating X and O bars.
Maybe the Chart Settings >> Session Times >> New Bar at Session Start setting of Yes would determine a starting bar.
Date Time Of Last Edit: 2023-07-22 19:01:54
[2023-07-23 03:02:08]
Oz - Posts: 48
@TomGilb,
Thank you I'll consider that.
Appreciate all your efforts as always, your the best.
I'll continue to dig deeper into Sierra know-how.
cheers
Date Time Of Last Edit: 2023-07-23 03:02:27

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

Login

Login Page - Create Account