March 20, 2022 at 4:19 pm #67725
I’m trying to use this script to scan for prices that have moved less than 10% in the last 10 bars.
However it is returning price ranges up to 20%123456789//Set Price VariablesH = HIGHESTHIGH(BARS=20);L = LOWESTLOW(BARS=20);//HH - LL Price RangeR = H - L;//Price Range as a % of HH < 10%(R/H < 0.1)
TimMarch 21, 2022 at 9:28 am #67727
I would calculate the Daily % Range, then use BarsTrue() to find where it was less than 10% over the last 10 days.
Script Example:12345678//Find High / Low Range as a %V1 = (ABS(Low() - High()) / HIGH()) * 100 ;//High Low Range % is less than 10%V2 = V1 <= 10 ;//Last 10 Bars have had a Range of 10% or lessBARSTRUE(V2) == 10
If you mean has moved less than 10% over the entire 10 day period (not on a daily basis) a ROC would work.123ROC(BARS=10) <= 10
March 21, 2022 at 1:25 pm #67731
- This reply was modified 6 months ago by Matthew.
Thanks. I didn’t occur to me to work it out on a bar by bar basis.
TimMarch 21, 2022 at 2:46 pm #67733
I’m still getting a few outside <=10.
Please see attached workbook.
TimMarch 21, 2022 at 3:06 pm #67737
The ROC() uses Close only to compare. Are you wanting to include High and Low ranges within the scope of % movement over that 10 day period?March 22, 2022 at 10:47 am #67743
I’m trying to scan for “consolidation patterns”.
Number of bars, say 20, that are trading in a price range, say less than 10%.
I’ve attached an example.
Thanks,March 22, 2022 at 9:59 pm #67755Darren
- Topics: 70
- Replies: 873
- Posts: 943
This will calculate when the percentage difference between the 10 day high and low is less than 10%:123456H1 = HIGHESTHIGH(RANGE=Look Back Period, BARS=10, INCBAR=True);L1 = LOWESTLOW(RANGE=Look Back Period, BARS=10, INCBAR=True);//Calc % range;1-(L1/H1) < 0.1March 23, 2022 at 1:31 pm #67763
Thanks – that’s the calculation I was looking for.
However when I run the script in the Scanning Manager I am still getting some results outside the 10%.
See attached Daily Chart.
I must be making a mistake with the Scanning Manager.
The settings I am using are ASX All Ords/Current Membership/Date Range – Last Week/Date Timeframe- 1 Day/Display – Latest Match.March 23, 2022 at 1:42 pm #67767
Apply V1 and V2 to your charts using a Show Plot and you will see why the result is being returned. Highest High and Lowest Low values are dynamic, what covers a 10% range today may be different to the 10% range 5 days ago.
If you are only using the script to scan with (don’t need historical matches) you could wrap V1 and V2 in a LAST() function, this should give you the result you are expecting.March 25, 2022 at 2:58 pm #67801
By applying the variables as a Show Plot I can see what you are saying and the difference when using LASRT().
- You must be logged in to reply to this topic.