Get LowestLow between HighestHigh and last 10 bars


Category:
0
0

Good morning, I have been making a scanner in thinkscript, it is supposed to scan between the last 20 to 10 bars, get the highest high in between and then search for the lowest low after; that is between the HH and the 10 bars, I’m just missing the part where it searches for the LL after the HH because the Lowest function needs constants in the length parameter, so I’m stuck trying to figure out how can I get the number of days between the HH and the 10-day bar. Thank you in advance, have a good day.
input BetweenOldestBar = 20;
input BetweenNewestBar = 10;
input PercentageDifference = 5;
def DifferenceBars = BetweenOldestBar – BetweenNewestBar;
def HHigh = Highest(HIGH[BetweenNewestBar], DifferenceBars);
def lowAfterHighest = if HHigh then Lowest(low[-BetweenNewestBar],BetweenNewestBar-1) else lowAfterHighest[1];
def DollarDifference = HHigh – lowAfterHighest;
def ConverterDollarTOPercentage = DollarDifference/HHigh;
def PercentageConverter = PercentageDifference/100;
def Condition = ConverterDollarTOPercentage > PercentageConverter and LowAfterHighest > High[BetweenOldestBar];
plot Scan = Condition;

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 14, 2021 10:59 am
219 views
0
Private answer

It would be faster for me to build this from scratch instead of trying to modify (fix) your existing code. However even starting from scratch this is far too complex for me to solve in the brief 15 minutes I allow for free solutions in the Q&A Forum.

Marked as spam
Posted by (Questions: 37, Answers: 4121)
Answered on February 14, 2021 12:53 pm