Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 13:46:29 +0000



[Programming Help] - Comparing Delta between bars

View Count: 1448

[2020-12-22 06:34:52]
User135370 - Posts: 162
Hi I'm trying to have an alert when the current bar's delta is say 2X the previous bar's delta

If the previous bars delta is positive and the current is positive it works OK, the issue is when one of the 2 numbers is negative then it does not give me the right read.

Delta in current bar = 68
Delta in previous bar = 450-
So I want to say

ID2.SG1-ID1>SG1[-1]>4*ID2.SG1[-1] for a buy signal

ID2.SG1-ID1>SG1[-1]<4*ID2.SG1[-1] for a sell signal

Hope it's clear the issue I'm having, any solutions to my issue and how I can get an accurate reading
[2020-12-22 13:30:08]
Sawtooth - Posts: 4120
Which study is ID1?
Which study is ID2?
Which subgraph is SG1 for each ID#?
[2020-12-22 13:36:15]
User135370 - Posts: 162
Sorry ID1 is Number Bar Calculated Values
SG1 is Delta


There is no ID 2

So Delta in the current bar is 4 X More than Delta in the previous bar for a buy
And Delta in he Current Bar is 4 X Less than Delta in the previous bar for a sell
[2020-12-22 15:09:49]
Sawtooth - Posts: 4120
Positive delta is when AVOL > BVOL
Negative delta is when AVOL < BVOL
How do you want to compare AVOL with BVOL?

Do you only want to compare the current bar's delta with the previous bar's delta if they are both the same polarity?
Date Time Of Last Edit: 2020-12-22 15:49:18
[2020-12-22 16:24:07]
User135370 - Posts: 162
Yes exactly I want to compare the current bar’s delta with the previous bar, and be alerted when say the current bar is 2 times the previous delta
[2020-12-22 16:28:18]
User135370 - Posts: 162
Are you saying rather than use Delta better to use AVOL and BVOL because they are always positive numbers so should get accurate readings which I haven’t been getting because trying to compare positive delta to negative delta which is a minus number is a head f***

Worth trying I guess

The whole idea is to see when delta shifts between bars So of the last bars delta is -100 and the current bar is + 300 I want to be alerted because that’s a shift from selling to 4 times more buying if you catch my drift, any ideas?
[2020-12-22 16:33:27]
Sawtooth - Posts: 4120
So you only want a buy alert when the polarity changes from - to + AND the difference is 4x the absolute value of the previous bar?
And the opposite for a sell alert.
[2020-12-22 16:59:48]
User135370 - Posts: 162
Yes exactly any ideas?
[2020-12-22 19:09:13]
Sawtooth - Posts: 4120
Try these:

Buy alert:
=AND(ID1.SG1[-1] <0, ID1.SG1 >0, ID1.SG1 - ID1.SG1[-1] >= ABS(ID1.SG1[-1]) *4)

Sell alert:
=AND(ID1.SG1[-1] >0, ID1.SG1 <0, ABS(ID1.SG1 - ID1.SG1[-1]) >= ID1.SG1[-1] *4)
Date Time Of Last Edit: 2020-12-22 19:09:33
[2020-12-22 19:20:14]
User135370 - Posts: 162
Thank you I will try that when I get back to the terminal what does ABS mean
[2020-12-22 19:29:59]
Sawtooth - Posts: 4120
The ABS function returns the absolute value of a negative number. IOW ABS(-300) = 300

https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#ABS_Function
[2020-12-22 20:00:04]
User135370 - Posts: 162
Awesome thanks you, much appreciate your time on this. Will try it when II get to the terminal
[2020-12-22 20:33:27]
User135370 - Posts: 162
Amigo thank you very much it worked perfect yo don't know how long this has been bugging me
[2023-08-26 10:30:31]
User344477 - Posts: 4
HI, I had a same concern but in this i would like to add a study in which i would like to see delta turn from negative to positive for example

if previous bar delta is -229 and next bar delta is 69, study must suggest that delta spike more than 100%

I have tried to upload the image as well for example
imagedelta spike image.jpg / V - Attached On 2023-08-26 10:29:50 UTC - Size: 17.95 KB - 141 views

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

Login

Login Page - Create Account