Highest/Lowest value since X time ago, various indicatorsThis script will count the bars back since the last time the current bar indicator value was either this low or this high.
It will provide the time in either, seconds, minutes, hours, days, weeks, months, or years.
please note:
There are currently no alerts setup for this script.
the length options only apply to the sources that have the "(MA)" in their name.
There is a horizontal line display issue which corrects once you adjust the amount of sources you want to use.
Once you select the amount of sources you would like to use, align the indicator so the horizontal lines match up with the table lines.
If find any bugs in the script, let me know.
Barssince
GenericTradingLibrary "GenericTrading"
This library aims to collect rare but useful operations for
get_most_recent_long_or_short_position_closed_index() : returns most recent long/short closed bar index.
get_most_recent_long_or_short_position_open_index() : returns most recent long/short closed bar index.
These two functions designed to help to speed up the coding for strategies that contains "re-enter" logic.
These two functions also could applies in the situations where time-count is needed in your condition.
Barssince Context TestThis is just published for visibility as a public service until the Pine devs are able to fix or document this behavior. The barssince() function returns different values when inside a conditional context. As long as it can be documented (and relied upon), this could be a pretty cool feature, but right now this is now how I read the help documentation to describe the function's intended behavior.
Anyway, in the script you'll see that test and test2 agree on red bars, but on green bars test gets a much lower value, which was pretty shocking to me until I traced down this particular cause within my larger script.
Nth-Occurrence Custom barssince() Function by Cryptorhythms [CR]Nth-Occurrence Custom barssince() Function by Cryptorhythms
Description
The vanilla barssince() function in pine only finds the number of bars since the most recent occurrence of the condition. This version allows you to specify an Nth occurrence back to check the bars since! Its also a nice little one liner.
I really hope you enjoy it and if you're looking for more, this is our 79th script on TV, so there is plenty to choose from!
Let me know in the comments if you create anything useful from this or think of anyway to improve it!
barssince() Built-in Replacement with 2nd Occurrence ParameterThis is a barssince() replicant with a 2nd `Occurrence` Parameter. The Pine built-in barssince() function only has the `condition` parameter. It's a handy little function I believe will be very useful in the future for developers of the Tradingview community.
Use it as you please, this is free code to implement into your new Pine projects. I don't require credit for anyone to use this function. I simply don't want any credit. I would however like to see some great ideas utilizing this when I randomly and accidentally come across them in the public library. I didn't know where to put this script, so I just tossed into the "Trend Analysis" category. I'm pondering we members need a "Miscellaneous" category some time in the future.
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Triple Moving Average HeatmapHi everyone
I didn't publish on Friday because I was working on an Expert Advisor in MT4. The day I don't publish, some scripts spamming guys published many (not useful) scripts the same to kick me out of the TOP #1 ranking.
So what I'm going to do about it? crying or sharing more quality scripts than before? :)
I guess you know the answer :) I'm gonna share a few quality scripts that I have in my library. I noticed that you guys tend to like more the scripts useful for your trading actually making you money rather than a copy-paste (of another copy-paste)
Alright, enough for the trolling now let's introduce the Three MA heatmap which is an upgrade of that script : MA-heatmap-Double-cross-edition/
The challenge was to keep the heatmap not rolling and to make it match with the MA cross. I did it using this
```
since_ma_buy = barssince(macrossover)
since_ma_sell = barssince(macrossunder)
heatmap_color() =>
since_ma_buy < since_ma_sell ? color.new(color.green, 20) : since_ma_buy > since_ma_sell ? color.new(color.red, 20) : na
```
This is a technique that I found after drinking three glasses of red wine (#french) to keep the heatmap stable and not rolling.
To get what I'm saying I invite you to replace the piece of code above by what everyone would normally do
```
heatmap_color() =>
macrossunder() ? color.new(color.green, 20) : macrossover() ? color.new(color.red, 20) : na
```
Ah and I'm not done sharing for the day, a few scripts are coming also after that one and tonight !!!!! I want to live in a world where you guys can enjoy quality scripts (mostly) :)
PS
____________________________________________________________
Feel free to hit the thumbs up as it shows me that I'm not doing this for nothing and will motivate to deliver more quality content in the future.
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
We Are Witnessing A Historical Event With A Clear Outcome!!!"Full Disclosure: I came across this information from www.SentimenTrader.com
I have no financial affiliation…They provide incredible statistical facts on
The General Market, Currencies, and Futures. They offer a two week free trial.
I Highly Recommend.
The S&P 500 has gone 43 trading days without a 1% daily move, up or down.
which is the equivalent of two months and one day in trading days.
During this stretch, the S&P has gained more than 4%,
and it has notched a 52-week high recently as well.
Since 1952, there were nine other precedents. All of
these went 42 trading days without a 1% move, all of
them saw the S&P gain at least 4% during their streaks,
and all of them saw the S&P close at a 52-week highs.
***There was consistent weakness a week later, with only three
gainers, and all below +0.5%.
***After that, stocks did better, often continuing an Extraordinary move higher.
Charts can sometimes give us a better nuance than
numbers from a table, and from the charts we can see a
general pattern -
***if stocks held up well in the following
weeks, then they tended to do extremely well in the
months ahead.
***If stocks started to stumble after this two-
month period of calm, however, then the following months
tended to show a lot more volatility.
We already know we're seeing an exceptional market
environment at the moment, going against a large number
of precedents that argued for weakness here, instead of
the rally we've seen. If we continue to head higher in
spite of everything, these precedents would suggest that
we're in the midst of something that could be TRULY EXTRAORDINARY.
Custom Indicator Clearly Shows If Bulls or Bears are in Control!The Two Versions of this Indicator I learned from Two Famous and Highly Successful Traders. This Indicator shows With No Lag Clear Up and Down Trends in Market by Documenting Clearly If Bulls or Bears are in Control. The Version In SubChart 1 Shows Consecutive Closes if the Current Close is Greater than of Less than the Midpoint of the Previous Bar (Why Midpoint Explained in Detail in 1st Post). The Version in SubChart 2 Shows Consecutive Closes that are Greater than or Less Than the Previous Close (Will Discuss Specific Uses in 1st Post). Works on Stocks, Forex, Futures, on All Timeframes.