Login Page - Create Account

Support Board


Date/Time: Thu, 01 May 2025 21:58:21 +0000



Alert on past condition

View Count: 258

[2025-02-20 12:51:49]
User823328 - Posts: 35
Hello i would like to know if it's possible to create an alert with the color bar based on alert conditions study using a past condition. So i use the initial balance range to enter on position at a breakout of the low or the high of initial balance. I want to get an alert when price cross the high or the low of the initial balance but only if price have already crossed before the opposite line (to be clear i want an alert if price cross the high of the IB only if before on the day price have already crossed the low of the IB)and same for opposite signal. Can you tell me if this is possible and point me on how i can do this please ?
[2025-02-20 16:19:51]
John - SC Support - Posts: 39605
This can be done, but it requires that you create a "Persistent Variable" to capture when the line has crossed the opposing line first. And you would need to add a condition to control that it is just looking at today's incident. For example, here is how the persistent variable would be written for the Low of a bar to have crossed the Initial Balance Low line using the "Spreadsheet Formula" study:
=IF(AND(BARDATE = TODAY(), CROSSOVER(L, ID1.SG9)), 1, ID2.SG1[-1])

Where ID1 is the ID of the Initial Balance study and SG9 is the IB Low subgraph of the Initial Balance study; ID2 is the ID of the Spreadsheet Formula study and SG1 is the Result subgraph of the Spreadsheet Formula study.

You would then use this with a test for a crossing through the IB High to get what you want.

Refer to the following:
Study/Chart Alerts And Scanning: Alert Condition Formula Format

Spreadsheet Formula
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2025-02-20 19:32:34]
User823328 - Posts: 35
I have applied your formula on the spredsheet formula study but i dont understand when thé price cross the low of the IB the value is always 0. I use it on replay chart i dont know if this is the problem.
Date Time Of Last Edit: 2025-02-20 19:39:03
[2025-02-20 20:29:42]
John - SC Support - Posts: 39605
The formula we gave you is only one part of what you need to do, and you need to update the formula for the specific IDs and Subgraphs of the studies you are using.

You need to work through what you want to do. We have given you the start of it. It is up to you to do the rest of the work.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2025-02-20 20:41:11]
User823328 - Posts: 35
Yes i have applied the formula you gave me with the good id and subgraph but the value stay at zéro when price cross the low of the IB so i dont understand what i dit wrong. The value have to be 1 when price cross no ? And after to get the alert i suppose i had to specify on the formula alert the condition that the spredsheet formula =1.
Date Time Of Last Edit: 2025-02-20 20:41:33
[2025-02-20 21:10:59]
John - SC Support - Posts: 39605
In that formula the Low of a bar at some time today would have had to cross the Initial Balance Low line to get a "True" (non-zero) result. Did that occur at all today?

Keep in mind that this could apply to the overnight session as well, so depending on how you have your Initial Balance setup, a crossing of the low of a bar with the IB Low will give a non-zero result that will carry forward until the next day starts and then it waits for that crossover to occur again.

If you have the crossing occurring and you are not getting a non-zero value for the Spreadsheet Formula, then we would need to see your chart where this is occurring. We have attached an image of what you should see when this occurs. Note the jump in the Spreadsheet Formula study from zero at 08:51 to one at 08:52 where the crossover occurs.

Note that the Crossover is going to give either a -1, 0, or 1 result, depending on whether the crossover is from below, does not occur, or is from above. Refer to the following:
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#CROSSOVER_Function

There are other crossing options as noted near the link just give above if you want to only look for a crossing in a certain direction.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
imageESH25-CME[M] 1 Min #1 2025-02-20 15_10_32.997.png / V - Attached On 2025-02-20 21:10:49 UTC - Size: 111.68 KB - 26 views
[2025-02-21 09:09:32]
User823328 - Posts: 35
I've tested whether the formula works in chart replay over the last 3 days and the value always stays at 0 despite the line crossing and I don't understand why, but today in live trading the value went to 1 when the IB formed (which I don't want, I want to check the crossing only after the ib has formed).
[2025-02-21 16:14:47]
John - SC Support - Posts: 39605
Then you do not have something correct. Please get us an image of your chart with the "Spreadsheet Formula" study showing (if you have hidden it, then please unhide it) and be sure to have the chart scrolled to a position where you are expecting to see the Spreadsheet Study go from zero to one.

And please copy and paste the exact formula as you have it in your "Spreadsheet Formula" so we can see what you have entered.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2025-02-21 16:56:10]
User823328 - Posts: 35
https://www.sierrachart.com/image.php?Image=1740156411295.png
here is the screencshot of my graph where you can see the price cross the low of the ib and the value stay at zero.
here is the copie paste of the exact formula that i have on the spreadsheet formula study:=IF(AND(BARDATE = TODAY(), CROSSOVER(L, ID2.SG9)), 1, ID14.SG1[-1])
where id2 is the ib study and id14 is the spreadsheet formula study
[2025-02-21 18:06:39]
John - SC Support - Posts: 39605
This will not work during a replay because it is checking for the current day by the use of the "TODAY()" function. This will always give the current real date (so right now this would be February 21, 2025), therefore during a replay, it is checking the date of the bar (February 20, 2025) against today's date (February 21, 2025).

This will work properly in live data, just not during a replay.

Also, we did notice that by using the "CROSSOVER()" function, you could get an incorrect signal early in the day due to a low in the previous day that makes a crossover from below occur. Therefore, we would recommend changing this to "CROSSFROMABOVE()" instead.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2025-02-22 06:41:00]
User823328 - Posts: 35
Ok thanks you i understand but i really need to backtest this strat. Is there another way to get what i want that works both live and in chart replay ?
[2025-02-22 07:38:08]
User167760 - Posts: 3
Plot the low of day(session). If low of day is less than IB low, it has crossed IB low. Does this work, or am I oversimplifying what you are looking to do? and(IB low<Low of day, crossfrombelow(IB high))
[2025-02-22 08:15:05]
User823328 - Posts: 35
No, it won't work because I don't use the study initial balance at the start of the day, I configure it on a timetable during the day to determine a certain range.But thanks for the Idea i will wait to see if support give me another solution and if there is not another way I will try your idea by changing the session times so that they start at the time corresponding to the ib.
Date Time Of Last Edit: 2025-02-22 08:24:15
[2025-02-23 06:02:50]
User167760 - Posts: 3
There is a High/Low for a specific time period study
[2025-02-23 06:56:50]
User823328 - Posts: 35
Ah yes cool! Thanks i think it can solve my issue with that

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

Login

Login Page - Create Account