- Topics: 0
- Replies: 17
- Posts: 17
I found some minor changes in #4 section to achieve your goal.
After looking at the plots of GS1stTopValue and GS2ndDTopValue in Show View, the 1st Top value you are looking for is actually GS1stTopValue or Offset(GS1stTopValue, OFFSET=1) which is the previous Bar value of the GS1stTopValue. Because they become equal when swings turn at the 2nd Top.
So here is the script for #4
// #4 +++++ Compare 1st and 2nd Top, 2nd Top to be between 0 and 0.5% higher than 1st Top
// Get Double Top High Prices
GS1stTopValue = PRICEATSIGNAL(GS1stTopSignal, PRICE=High);
GS2ndDTopValue = PRICEATSIGNAL(GS2ndTopSignal, PRICE=High);
// % range between 1st Top and 2nd Top
DoubleTopRatio = 100 * (GS2ndDTopValue – GS1stTopValue) / GS1stTopValue;
// Test if Top Ratio in range -0.25 to +0.25
DoubleTopSignal = If(GS2ndTopSignal AND DoubleTopRatio >= 0 AND DoubleTopRatio < 0.5 , 1, 0);