Hi,
I want to mark some selected bars and display the high price of that bar.
I use the following script:
A1 = STRDATE(DATE=2023-07-27) ;
A2 = BARDATE() == A1;
A3 = IF(A2 == 1, HIGH(), 0) ;
A4 = A3 ;
B1 = STRDATE(DATE=2022-08-16) ;
B2 = BARDATE() == B1;
B3 = IF(B2 == 1, HIGH(), 0) ;
B4 = B3 ;
NumD = B4 ;
NumD
Here is the chart:
As you can see the script woks as it should.
BUT when I use TWO dates in the script only the values are “1.00” displayed.
Here is the script with two dates:
A1 = STRDATE(DATE=2023-07-27) ;
A2 = BARDATE() == A1;
A3 = IF(A2 == 1, HIGH(), 0) ;
A4 = A3 ;
B1 = STRDATE(DATE=2022-08-16) ;
B2 = BARDATE() == B1;
B3 = IF(B2 == 1, HIGH(), 0) ;
B4 = B3 ;
NumD = A4 or B4 ;
NumD
Here is the chart with two dates in the script:
I use for the Show Bar tool the following settings:
Any suggestion why only the values “1.00” are displayed when two dates are used in the script?
Thanks,
Thomas
DEJHMA8
(Darren Hawkins)
12 January 2024 08:12
2
Hi Thomas,
A value of 1 indicates a true condition, so NumD is true on those dates. To show values for multiple dates the ‘or’ condition needs to be before the IF() statement:
A1 = STRDATE(DATE=2023-07-27) ;
B1 = STRDATE(DATE=2022-08-16) ;
B2 = BARDATE() == A1 or BARDATE() == B1;
NumD = IF(B2 == 1, HIGH(), 0);
NumD
DEJHMA8
(Darren Hawkins)
12 January 2024 08:28
3
Hi Thomas,
You can also use the swing values to mark highs / lows automatically. For 10% swing highs use this with the Show Bar Position property set to High:
V1=PERCENTSWING(PERCENT=10.0);
IF(HIGH()==SWINGEND(V1),SWINGEND(V1), 0)
For lows (set to Low position):
V1=PERCENTSWING(PERCENT=10.0);
IF(LOW()==SWINGEND(V1),SWINGEND(V1), 0)
Hi Darren,
Thank you very much for your support in this matter. Without your help I would not have managed it so quickly and smoothly.
You have helped me already so much on so many issues and I would like to take this opportunity to thank you once again.
Many thanks again!