Login Page - Create Account

Support Board


Date/Time: Thu, 18 Apr 2024 22:49:07 +0000



[User Discussion] - locking state plus a value

View Count: 1428

[2014-01-22 03:21:01]
Bedhog - Posts: 167
I have managed to preserve the state of H3=TRUE when O3=TRUE using the SawtoothTrade example.
H3 will reset to H3=FALSE when P3=TRUE.

At the moment H3=TRUE, I want to save the value of D3 into Q3 (to plot on the chart). Column Q should continue to print this same value until H3=FALSE. When H3=FALSE, Column Q should begin printing 0.






Date Time Of Last Edit: 2014-01-22 03:22:18
[2014-01-22 04:45:26]
Bedhog - Posts: 167
Maybe there was an easier way, but here is how I solved it...

The way stash the value of D3 upon a true condition into Column S as shown below. The value will stay in S3 as long as H3 remains true.

O3=IF(AND(AA3<AB3,AA4>=AB4),D3,0)
P3=IF(AND(AA3>AB3,AA4<=AB4),C3,0)
Q3=MATCH(TRUE,O3:O100<>0,0)+2
R3=MATCH(TRUE,P3:P100<>0,0)+2
S3=IF($H$3,INDIRECT("O"&Q$3),0)

Now I need your help to plot a point at this value for as long as the number is non-zero. I've tried color bar based on alert using =ID1.SG9, but that simply puts a point on the low of every candle as long as S3 is non-zero. I want to plot a point at the value of S3, not on the low of every subsequent candle.

COLUMN
S1
S2
S3 4.410999775
S4 4.410999775
S5 4.410999775
S6 4.410999775
S7 4.410999775
S8 4.410999775
S9 4.410999775
S10 4.410999775
S11 0
S12 0

Date Time Of Last Edit: 2014-01-22 04:46:06
[2014-01-22 14:02:07]
Bedhog - Posts: 167
Okay, I'm ready for someone to jump in with an easier way.

I would like to plot horizontal points across the low of the 1st candle after 2 moving averages cross.

When the MAs cross the other direction, I would like to plot horizontal points across the high of that candle.

I've got it partially working... however, the new plot fills all 2000 rows with the latest value, clearing the previous plot values and drawing one big line across the chart.


[2014-01-24 00:20:13]
Sawtooth - Posts: 3973
Another way to lock the TRUE is to use double IF statements. This allows a way to lock a TRUE at all bars until you release it. For example (in cell Z3):

IF(StartLineConditions,TRUE,IF(StopLineConditions,FALSE,Z4))

Then find the value at the first TRUE, and retain it until you release it. (in cell Y3):
=IF(AND(Z3=TRUE,Z4=FALSE),D3,IF(Z3=FALSE,0,Y4))
This is the value you plot.

[2020-06-22 23:08:28]
j4ytr4der_ - Posts: 913
Oh wow, the nested IF approach is so much easier to follow for my mind. It's funny I was on that track just sortof by accident but hadn't quite realized what I was doing until I read your explanation here Tom. So many years later and your efforts are still helping others. Thanks so much!
Date Time Of Last Edit: 2020-07-08 15:28:52

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

Login

Login Page - Create Account