input Length = 20;
def LowLow; def HighBar;
def HighThresh; def Sig;
if Close == lowest(Close,Length) {
LowLow = lowest(Low,Length);
if Low == LowLow {
HighBar = Double.NaN;
HighThresh = High;
} else {
HighBar =
fold Index = 0 to Length - 1 with Bar while IsNan(Bar) do
if Low[Index] == LowLow then Index
else Double.NaN;
HighThresh = getValue(High,HighBar);
}
Sig = Double.NaN;
} else {
Sig = crosses(High, HighThresh[1], crossingDirection.ABOVE);
HighThresh = if Sig then Double.NaN else HighThresh[1];
LowLow = Double.NaN;
HighBar = Double.NaN;
}
plot Signal = Sig;
Signal.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
plot Threshold = HighThresh;
Threshold.setPaintingStrategy(paintingStrategy.HORIZONTAL);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
S | Price Close within the Weekly Range | Questions | 2 | |
T | Price Crossing 20 EMA on Daily | Questions | 1 | |
T | Can Thinkscript track the mark price of an option? | Questions | 1 | |
P | trigger a buy order when a close price is reached? | Questions | 3 | |
J | Extra bands to SMA to mark a certain distance in price | Questions | 2 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.