Login Page - Create Account

Support Board


Date/Time: Sat, 30 Nov 2024 01:32:40 +0000



[User Discussion] - coding help

View Count: 391

[2023-01-05 01:04:28]
User259724 - Posts: 43
I am trying to write a simple colour bar based on alert. I want the bar to be coloured when 4 lines are in a certain order. Some of the bars are coloured at the wrong time.
I want the bar to be coloured (see screenshot) when the purple line>cyan line>yellow line>green line.
The purple line is ID20
The cyan line is ID16
The yellow line is ID13
The green line is ID3
Here is my code =ID20.SG2>ID16.SG2>ID13.SG2>ID3.SG2
I have set my Input data in "settings and inputs" to last.
ID20, ID16,and ID13 are installed on the chart using "Study/Price Overlay" study from longer term range charts. The Destination chart is also a range bar chart.

I have included a screen shot with some comments.

Thanks for any help received.
imageF.US.ENQh23 [CV][M] 6.00 Range #5 2023-01-04 19_45_09.398.png / V - Attached On 2023-01-05 00:58:44 UTC - Size: 48.35 KB - 87 views
Attachment Deleted.
[2023-01-05 03:44:54]
Sawtooth - Posts: 4123
Try this:
=AND(ID20.SG2>ID16.SG2>ID13.SG2>ID3.SG2)
[2023-01-05 03:50:42]
User183724 - Posts: 183
and(id20.sg1>id16.sg1 , id13.sg1>id3.sg1)
[2023-01-05 12:01:28]
User259724 - Posts: 43
Thank you for the responses. Unfortunately, the changes suggested did not change how the bars are coloured in any way.

I believe I need to use "Study Overlay-OHLC Study" in order to have proper results. I will try this.

Thanks
Date Time Of Last Edit: 2023-01-05 12:06:02
[2023-01-05 14:12:28]
Sawtooth - Posts: 4123
Some of the bars are coloured at the wrong time.
Since you are using the Study/Price Overlay study, there will be times when this occurs.
This is because the destination chart bars don't always align with the source chart bars timestamp.

In the overlay study, the Data Copy Mode and the Bar Time Matching Method settings are the settings that affect this.
However, there is no combination of these settings that will always eliminate all anomalies in all situations.

The Data Copy Mode needs to be set to Use Earliest... if bars are not time-based.
Auto Trade System Back Testing: Performing Back Testing on a Trading System That Uses Multiple Charts
Then you can try Nearest Match or Containing Match for the Bar Time Matching Method to get the best results.

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

Login

Login Page - Create Account