Course Name: Price Action Trading Strategies Using Python, Section No: 10, Unit No: 7, Unit type: Notebook
Hello, for this notebook and also the notebook in Section 6, Lesson 7 we have a flaw when applying filter related to the condition 4:
It works good when the left shoulder's price is bigger than the second's price. However when the second shoulder's price is bigger than the first shoulder's price we have a problem.
Look at this example where left shoulder has a price of 80 and the right shoulder has a price of 70. Left shoulder's price is bigger than right shoulder's price.
However when the left shoulder's price is smaller than right shoulder's price a problem occurs:
Fix:
cond_4 = (np.abs(a-e) <= np.mean([a,e]) * 0.015) and (np.abs(b-d) <= np.mean([b,d]) * 0.015)
Using "np.abs" for calculating the distance between shoulders should fix this issue.
Hi Daniel,
Yes it seems you're right. However, condition 4 is correctly defined in Section 6, Unit 7 as:
cond_4 = (abs(a-e) <= np.mean([a, e]) * 0.015) and (abs(b-d) <= np.mean([b, d])*0.015)
We will be updating Section 10, Unit 7 soon. Thanks for pointing this out!
Okay, great! Thanks!