June 5, 2020 at 1:20 am #58401
I want to shade a chart wherever there has been a % rise or fall in price over time (like areas identified manually below except shading over full view).
Lets say I want to identify all periods in DJI history where the market has corrected > 50% over a 3 year period.
I’ve have been working with the scripting below without the result I expect. Would it be possible to capture a rise and then further 50% fall in the same 3 year period if it were to occur or does that require the grunt of pascal programming…?
Thanks for any guidance.
Andrew1234567891011121314V1 = HIGHESTHIGH(BARS=3,BACKTYPE=Years, RANGE=All History);V2 = LOWESTLOW(BARS=3, BACKTYPE=Years, RANGE=All History);D = V1-V2;%D = (D/V1)*100;Show = %D < -50;Show//V1= CHANGE(Year(PERIODAMOUNT=1), BARS=3);//V1 < -50%//V1=CHANGE(INT_COUNT=3, INT_TYPE=Year);//V1<-50June 5, 2020 at 8:57 am #58407Mathew
- Topics: 28
- Replies: 1,373
- Posts: 1,401
Think about this as two scripts which are combined in a SWITCH function. Then you need to think about the conditions to turn on the switch and the conditions to turn it off again.
In your script just make “Show” line into V3 = %D CrossesBelow -50;
Then you can use a Switch(V1, V3) function.
Hope that helps
June 15, 2020 at 9:43 am #58555
- This reply was modified 1 month ago by Mathew.
Morning guys – I’m still trying to achieve the outcome I am after with this script. Grateful if you could help me understand why the 50+RISE script in the attached workbook is signalling on 18 Mar 1907 ?
Ultimately I am looking to identify the periods where the market has increased by 50% or more from the LL for a defined period, in this script currently 3 years. I want to get to something like the image attached (50+ RISE goal).
Grateful for any assistance or more of a guide in the right direction here.
You must be logged in to access attached files.June 15, 2020 at 2:08 pm #58569Matthew
- Topics: 4
- Replies: 269
- Posts: 273
When your script is broken down to show the %D plot with a Horizontal Line at 50, you will see that on the date in question the line jumps just above 50, and so the criteria is met.
Based on this it seems to be working as expected.June 16, 2020 at 9:27 am #58593
Thanks Matthew, I located my error.
It has been suggested that I work with the SWITCH function, how do I identify v3 trigger and then lookback to where v1 initiated to shade that area?
- You must be logged in to reply to this topic.