Login Page - Create Account

Support Board


Date/Time: Sun, 28 Apr 2024 18:53:39 +0000



How to reference a Spreadsheet output in a Color Bar Based on Alert study

View Count: 947

[2018-11-05 09:56:55]
DaxTrader54 - Posts: 8
Hi guys, I have a trading strategy that I have automated on Sierra charts.

The strategy is a stop and reverse strategy which stays in a BUY mode or SELL mode for some time, perhaps 40-50 candles. Whilst the strategy is in a BUY mode, it may offer 6-10 buy signals. Whilst the strategy is in a SELL mode, it may offer 6-10 sell signals. What I want to do is build an alert for when we change from the BUY mode to the SELL mode and vice versa.

So I have a column (M) which records the current signal as either a '1' or a '2' based on the most recent signal being a buy or a sell.

This is based on a simple IF statement, referring to my K and L columns (these columns are grabbing my buy/sell signals from the spreadsheet):
=if(K3>0,1,if(L3>0,2,M4))

Now, I want to put an arrow on the chart (using the Color Bar Based on Alert Condition study) when it flips from a buy to a sell, or when it flips from a '2' to a '1'. So I would compare the two most recent numbers in the (M) column, to see if they have changed or not.

Currently the spreadsheet study is ID14 and the (M) column is SG3.

I was thinking I could use two Color Bar Based on Alert Condition studies, with one including something like:
=and(id14.sg3[-1]=1,id14.sg3=2)

and the other saying
=and(id14.sg3[-1]=2,id14.sg3=1)

But this is not working for me. It seems that when I reference the spreadsheet study column (using the id14.sg3) in the Color Bar Based on Alert Condition study, it is not seeing a 1 or 2, so perhaps I am misunderstanding the array, or what data is stored in the array?

My question remains: How do I refer to the spreadsheet study's formula column 'value' or 'output' in the Color Bar by Alert Condition study?

Any help would be appreciated (assuming I have provided enough background.

Regards
[2018-11-05 20:04:13]
Sierra Chart Engineering - Posts: 104368
This is considered programming help, but one thing you must consider is study calculation order which is likely the reason for the issue you are having:
Chart Studies: Study Calculation Precedence And Related Issues

Also what is stored in the spreadsheet Subgraph arrays are just simply numbers. So you can work with those as they are.

We did run a quick test of referencing a spreadsheet column from a Color Bar Based on Alert Condition study and it did work properly. We recommend doing something very simple just like =ID2.SG3 = 5 and put a 5 in the M column.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-11-05 20:08:57

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

Login

Login Page - Create Account