♥ 0 |
right now, the count returns the number of valid conditions out of the past 10 periods, with the color changing based on that condition and one other. i’d prefer how many periods it’s been since the last instance of a valid condition, again with the color changes. Can you help? Thanks! input period = 14; def timer = SecondsTillTime(1615); def momentum = volume/deltaT; def aveSM = Average(momentum, period); input count_length = 10; def count_above1 = sum (momentum > sdave, count_length) ; def count_above2 = sum (momentum > spikecap, count_length); plot value = count_above1; value.AssignValueColor(if value < 1 then color.red else if count_above2 >= count_above1 then color.green else color.white);
Marked as spam
|
Private answer
Each post in this Q&A Forum must be targeted to provide solutions that benefit the majority of our viewers. This is not the place to request one-off solutions that only serve a single individual. That's what our prefessional services are for. So I have updated the title of your question to reach the broadest possible audience and the solution I am providing is designed as a template to serve all of our viewers.
Using this template, those who are comfortable writing their own custom tools for Thinkorswim will be able to create counters for just about anything they can imagine. There is a more advanced solution in which the condition to be counted is two dimensional. Meaning that it resets each time a crossover event occurs and continues counting bars while the price and moving average continue in the same condition as the crossover. That post can be found here: https://www.hahn-tech.com/ans/display-bars-since-cross-above-hma/
Marked as spam
|
Please log in to post questions.