Up arrow when price reverses and closes above the high of the lowest bar Hi All, I'm stuck on coding the situation for: Up arrow when price reverses and closes above the high of the lowest bar in a 21 day price channel. Does anyone know if there's some code for this, or has any ideas about how to do this? Thanksby sherwin - Trading Discussion
Thanks for your reply Rigel I get what you’re saying and that will work. I should have used a better variable name than “crossing”. Say I’m using the script on a 30 day: 1day chart, I really want the script to say “7 bars out of 22 bars closed above the 8 EMA” or “13 bars out of 22 bars closed between the 8 EMA and 21 EMA”. My script returns crazy results like “46 barsby sherwin - Trading Discussion
My Thinkscript count formula breaks on the count condition. I want to count the number of times a ticker is above its 8EMA and then calculate the average of the distance of the price from the EMA Here's the study: input length = 8; plot Ema = ExpAverage(close, length); def crossing = close > ema; ##Method 1 def postCrossingRange = if crossing then 1 else 0; def sumOfRanges = totalby sherwin - Trading Discussion