Ichimoku Cloud and Bollinger Bands (by Coinrule)The Ichimoku Cloud is a collection of technical indicators that show support and resistance levels, as well as momentum and trend direction. It does this by taking multiple averages and plotting them on a chart. It also uses these figures to compute a “cloud” that attempts to forecast where the price may find support or resistance in the future.
The Ichimoku Cloud was developed by Goichi Hosoda, a Japanese journalist, and published in the late 1960s. It provides more data points than the standard candlestick chart. While it seems complicated at first glance, those familiar with how to read the charts often find it easy to understand with well-defined trading signals.
The Ichimoku Cloud is composed of five lines or calculations, two of which comprise a cloud where the difference between the two lines is shaded in.
The lines include a nine-period average, a 26-period average, an average of those two averages, a 52-period average, and a lagging closing price line.
The cloud is a key part of the indicator. When the price is below the cloud, the trend is down. When the price is above the cloud, the trend is up.
The above trend signals are strengthened if the cloud is moving in the same direction as the price. For example, during an uptrend, the top of the cloud is moving up, or during a downtrend, the bottom of the cloud is moving down.
The Bollinger Bands are among the most famous and widely used indicators. A Bollinger Band is a technical analysis tool defined by a set of trendlines plotted two standard deviations (positively and negatively) away from a simple moving average ( SMA ) of a security's price, but which can be adjusted to user preferences. They can suggest when an asset is oversold or overbought in the short term, thus providing the best time for buying and selling it.
This strategy combines the Ichimoku Cloud with Bollinger Bands to better enter trades.
Long orders are placed when these basic signals are triggered.
Long Position:
Tenkan-Sen is above the Kijun-Sen
Chikou-Span is above the close of 26 bars ago
Close is above the Kumo Cloud
The closing price is greater than the upper standard deviation of the Bollinger Bands
Short Position:
Tenkan-Sen is below the Kijun-Sen
Chikou-Span is below the close of 26 bars ago
Close is below the Kumo Cloud
The upper standard deviation of the Bollinger Band is greater than the closing price
The script is backtested from 1 January 2022 and provides good returns.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
This script also works well on BTC 30m/1h, ETH 2h, MATIC 2h/30m, AVAX 1h/2h, SOL 45m timeframes
Cerca negli script per "order"
J_TPO Velocity VariationThis one is a very random indicator but with an excellent concept. Unfortunately, I don't know much about the origin of this indicator or who made it. Still, the first appearance was around 2004 on a Meta Trader forum. There are a lot of variations of the J_TPO indicator. One of them is the J_TPO Velocity. The difference from the original version is that it uses the price range of the latest candles to change the magnitude of the indicator value, but the concept is the same. 
More info  here 
In its original form, an oscillator between -1 and +1 is a nonparametric statistic quantifying how well the prices are ordered in consecutive ups (+1) or downs (-1), or intermediate cases. The velocity variation adds the price range, and this script variation adds a baseline as a filter for the indicator. This indicator will work as a confirmation indicator. Using it with the trend filter will work as an entry indicator.
Besides the columns representing the indicator's values, 2 more signals will be printed on the chart. One is the middle cross, the other the kicking middle cross. The first will print a signal when the J_TPO crosses the middle line (0) in favor of the trend. A diamond will be printed when the baseline is above 0, and the cross is upwards. The inverse for crosses downwards. The other signal is the Kicking middle cross which will appear when the cross comes after an opposite cross. This will give only one signal per cross in the same direction, which may help identify earlier the trend direction.
Ichimoku Cloud with ADX (By Coinrule)The Ichimoku Cloud is a collection of technical indicators that show support and resistance levels, as well as momentum and trend direction. It does this by taking multiple averages and plotting them on a chart. It also uses these figures to compute a “cloud” that attempts to forecast where the price may find support or resistance in the future.
The Ichimoku Cloud was developed by Goichi Hosoda, a Japanese journalist, and published in the late 1960s. It provides more data points than the standard candlestick chart. While it seems complicated at first glance, those familiar with how to read the charts often find it easy to understand with well-defined trading signals.
The Ichimoku Cloud is composed of five lines or calculations, two of which comprise a cloud where the difference between the two lines is shaded in.
The lines include a nine-period average, a 26-period average, an average of those two averages, a 52-period average, and a lagging closing price line.
The cloud is a key part of the indicator. When the price is below the cloud, the trend is down. When the price is above the cloud, the trend is up.
The above trend signals are strengthened if the cloud is moving in the same direction as the price. For example, during an uptrend, the top of the cloud is moving up, or during a downtrend, the bottom of the cloud is moving down.
DMI is simple to interpret. When +DI > - DI, it means the price is trending up. On the other hand, when -DI > +DI , the trend is weak or moving on the downside. The ADX does not give an indication about the direction but about the strength of the trend.
Typically values of ADX above 25 mean that the trend is steeply moving up or down, based on the -DI and +D positioning. This script aims to capture swings in the DMI, and thus, in the trend of the asset, using a contrarian approach.
Trading on high values of ADX , the strategy tries to spot extremely oversold and overbought conditions. Values of ADX above 45 may suggest that the trend has overextended and is may be about to reverse.
This strategy combines the Ichimoku Cloud with the ADX indicator to better enter trades.
Long/Short orders are placed when these basic signals are triggered.
Long Position:
 
 Tenkan-Sen is above the Kijun-Sen
 Chikou-Span is above the close of 26 bars ago
 Close is above the Kumo Cloud
 MACD line crosses over the signal line
 -DI is greater than +DI
 ADX is greater than 45
 
Short Position:
 
 Tenkan-Sen is below the Kijun-Sen
 Chikou-Span is below the close of 26 bars ago
 Close is below the Kumo Cloud
 MACD line crosses under the signal line
 +DI is greater than -DI
 ADX is less than 45
 
The script is backtested from 1 January 2022 and provides good returns.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
This script also works well on MATIC (15m timeframe), ETH (5m timeframe), and SOL (15m timeframe).
Ichimoku Cloud with MACD (By Coinrule)The Ichimoku Cloud is a collection of technical indicators that show support and resistance levels, as well as momentum and trend direction. It does this by taking multiple averages and plotting them on a chart. It also uses these figures to compute a “cloud” that attempts to forecast where the price may find support or resistance in the future.
The Ichimoku Cloud was developed by Goichi Hosoda, a Japanese journalist, and published in the late 1960s. It provides more data points than the standard candlestick chart. While it seems complicated at first glance, those familiar with how to read the charts often find it easy to understand with well-defined trading signals.
The Ichimoku Cloud is composed of five lines or calculations, two of which comprise a cloud where the difference between the two lines is shaded in.
The lines include a nine-period average, a 26-period average, an average of those two averages, a 52-period average, and a lagging closing price line.
The cloud is a key part of the indicator. When the price is below the cloud, the trend is down. When the price is above the cloud, the trend is up.
The above trend signals are strengthened if the cloud is moving in the same direction as the price. For example, during an uptrend, the top of the cloud is moving up, or during a downtrend, the bottom of the cloud is moving down.
The MACD is a trend following momentum indicator and provides identification of short-term trend direction. In this variation it utilises the 12-period as the fast and 26-period as the slow length EMAs, with signal smoothing set at 9.
This strategy combines the Ichimoku Cloud with the MACD indicator to better enter trades.
Long/Short orders are placed when three basic signals are triggered.
Long Position:
 
 Tenkan-Sen is above the Kijun-Sen
 Chikou-Span is above the close of 26 bars ago
 Close is above the Kumo Cloud
 MACD line crosses over the signal line
 
Short Position:
 
 Tenkan-Sen is below the Kijun-Sen
 Chikou-Span is below the close of 26 bars ago
 Close is below the Kumo Cloud
 MACD line crosses under the signal line
 
The script is backtested from 1 June 2022 and provides good returns.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
This script also works well on MATIC (1h timeframe), AVA (45m timeframe), and BTC (30m timeframe).
Short Term RSI and SMA Percentage ChangeThis strategy utilises common indicators like RSI and moving averages in order to enter and exit trades. The Relative Strength Index (RSI) is a momentum indicator that has a value between 0 and 100, where a value greater than 70 is considered overbought and a value less than 30 is oversold. If the RSI value is above or below these values, then it can signal a possible trend reversal.
The second indicator used in this strategy is the Simple Moving Average (SMA). A SMA is an arithmetic moving average calculated by adding recent prices and then dividing that figure by the number of time periods in the calculation average. For example, one could add the closing price of a coin for a number of time periods and then divide this total by that same number of periods. Short-term averages respond quickly to changes in the price of the underlying coin, while long-term averages are slower to react.
Long/Exit orders are placed when three basic signals are triggered.
Long Position:
 
 RSI is greater than 50
 MA9 is greater than MA100
 MA9 increases by 6%
 
Exit Position:
 
 Price increases 5% trailing
 Price decreases 5% trailing
 
The script is backtested from 1 May 2022 and provides good returns.
A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
This script also works well on AVAX 45m/1h, MATIC 15m/45m/1h and ETH 4h.
Ichimoku Cloud with RSI (By Coinrule)The Ichimoku Cloud is a collection of technical indicators that show support and resistance levels, as well as momentum and trend direction. It does this by taking multiple averages and plotting them on a chart. It also uses these figures to compute a “cloud” that attempts to forecast where the price may find support or resistance in the future.
The Ichimoku Cloud was developed by Goichi Hosoda, a Japanese journalist, and published in the late 1960s. It provides more data points than the standard candlestick chart. While it seems complicated at first glance, those familiar with how to read the charts often find it easy to understand with well-defined trading signals.
The Ichimoku Cloud is composed of five lines or calculations, two of which comprise a cloud where the difference between the two lines is shaded in.
The lines include a nine-period average, a 26-period average, an average of those two averages, a 52-period average, and a lagging closing price line.
The cloud is a key part of the indicator. When the price is below the cloud, the trend is down. When the price is above the cloud, the trend is up.
The above trend signals are strengthened if the cloud is moving in the same direction as the price. For example, during an uptrend, the top of the cloud is moving up, or during a downtrend, the bottom of the cloud is moving down.
This strategy combines the Ichimoku Cloud with the RSI indicator to better enter trades.
Long/Short orders are placed when three basic signals are triggered.
Long Position:
 
 Tenkan-Sen is above the Kijun-Sen
 Chikou-Span is above the close of 26 bars ago
 Close is above the Kumo Cloud
 RSI is greater less than 50
 
Short Position:
 
 Tenkan-Sen is below the Kijun-Sen
 Chikou-Span is below the close of 26 bars ago
 Close is below the Kumo Cloud
 RSI is greater than 50
 
The script is backtested from 1 June 2022 and provides good returns.
The strategy assumes each order is using 30% of the available coins to make the results more realistic and to simulate you only ran this strategy on 30% of your holdings. A trading fee of 0.1% is also taken into account and is aligned to the base fee applied on Binance.
This script also works well on SOL (45m timeframe), BNB (1h timeframe), and ETH (1h timeframe).
FunctionDynamicTimeWarpingLibrary   "FunctionDynamicTimeWarping" 
"In time series analysis, dynamic time warping (DTW) is an algorithm for 
measuring similarity between two temporal sequences, which may vary in 
speed. For instance, similarities in walking could be detected using DTW, 
even if one person was walking faster than the other, or if there were 
accelerations and decelerations during the course of an observation. 
DTW has been applied to temporal sequences of video, audio, and graphics 
data — indeed, any data that can be turned into a linear sequence can be 
analyzed with DTW. A well-known application has been automatic speech 
recognition, to cope with different speaking speeds. Other applications 
include speaker recognition and online signature recognition. 
It can also be used in partial shape matching applications." 
"Dynamic time warping is used in finance and econometrics to assess the 
quality of the prediction versus real-world data."
~~ wikipedia
reference:
en.wikipedia.org
towardsdatascience.com
github.com
 cost_matrix(a, b, w) 
  Dynamic Time Warping procedure.
  Parameters:
     a : array, data series.
     b : array, data series.
     w : int         , minimum window size.
  Returns: matrix optimum match matrix.
 traceback(M) 
  perform a backtrace on the cost matrix and retrieve optimal paths and cost between arrays.
  Parameters:
     M : matrix, cost matrix.
  Returns: tuple:
array aligned 1st array of indices.
array aligned 2nd array of indices.
float      final cost.
reference:
github.com
 report(a, b, w) 
  report ordered arrays, cost and cost matrix.
  Parameters:
     a : array, data series.
     b : array, data series.
     w : int        , minimum window size.
  Returns: string report.
3ngine Global BoilerplateABOUT THE BOILERPLATE 
This strategy is designed to bring consistency to your strategies. It includes a  macro EMA filter  for filtering out countertrend trades, 
an  ADX filter  to help filter out chop, a  session filter  to filter out trades outside of desired timeframe,  alert messages  setup for automation, 
 laddering in/out  of trades (up to 6 rungs),  trailing take profit , and  beautiful visuals  for each entry. There are comments throughout the 
strategy that provide further instructions on how to use the boilerplate strategy. This strategy uses `threengine_global_automation_library`
throughout and must be included at the top of the strategy using `import   as bot`. This allows you to use dot notation 
to access functions in the library - EX: `bot.orderCurrentlyExists(orderID)`.
 HOW TO USE THIS STRATEGY 
1. Add your inputs
There is a section dedicated for adding your own inputs near the top of the strategy, just above the boilerplate inputs
2. Add your calculations
If your strategy requires calculations, place them in the `Strategy Specific Calculations` section
3. Add your entry criteria
 
 Add your criteria to strategySpecificLongConditions (this gets combined with boilerplate conditions in longConditionsMet)
 Add your criteria to strategySpecificShortConditions (this gets combined with boilerplate conditions in shortConditionsMet)
 Set your desired entry price (calculated on every bar unless stored as a static variable) to longEntryPrice and shortEntryPrice. ( This will be the FIRST ladder if using laddering capabilities. If you pick 1 for "Ladder In Rungs" this will be the only entry. )
 
4. Plot anything you want to overlay on the chart in addition to the boilerplate plots and labels. Included in boilerplate: 
 
 Average entry price 
 Stop loss
 Trailing stop
 Profit target 
 Ladder rungs
COT + ema + aux tickerPurpose: Create a script for backtesting the idea that COT can steer weekly Bias on Forex Market. 
How does it works: the script use Commercials Delta Conctract, EMA of the selected ticker, EMA of 2 auxiliary tickers (e.g. correlated ticker) to generates buy and sell signals, it allows to include or not each of these.
If you use all the indicator, The buy or sell signals are generated following that rules:  
(Example for buy signals on GBPCAD) 
1) Commercials add net contract to GBP futures + remove net contract to CAD
2) EMA of GBPCAD is rising
3) EMA of 1st aux ticker is rising (or decline if select inv option)
4) EMA of 2nd aux ticker is rising (or decline if select inv option)
The scripts set the stop at low of the week for long orders and high of the week for shorts.
The exit strategy is to exit at first week of profit
How could you use it:  
1) Choose your FX Ticker e.g. GBPCAD and set 1W TimeFrame
2) Select ticker in the strategy setting, remember to select the currency in right order, if you want to study GBP CAD 1st currency is GBP and 2nd CAD
3) Choose if you want to use EMA (and its period of calculation) 
4) Choose if you want to use a aux ticker, the direction, and the relative ema period
What could be better; 
1) you can just buy on begin of the week.
2) the exit strategy isn't best you can do
3) No level of delta contract is consider, its generate a buy signial also for 1 contract in the right direction
For any question, suggestion of improvemet, ideas, insult:) write to me
It all started from a script i find here on tradingview that extract COT data. Don't remember the name of that guy but Thanks a lot. 
My English isn't perfect but i hope you can understand as well.
CHN BUY SELLCHN BUY SELL  is formed from two RSI indicators, those are  RSI 14 and RSI 7 . I use RSI 14 to determine the trend and RSI 7 to find entry points.
 + Long (BUY) Signal: 
- RSI 14 will give a "BUY" signal, then RSI 7 will give entry point to LONG when the candle turns yellow.
 + Short (SELL) Signal: 
- RSI 14 will give a "EXIT" signal, then RSI 7 will give entry point to SHORT when the candle turns purple.
 + About Take Profit and Stop Loss: 
- With Gold, I usually set Stop Loss and Take Profit at 50 pips
- With currency pairs, I usually keep my Stop Loss and Take Profit at 30 pips
- With crypto, I usually keep Stop Loss and Take Profit at 1.5%
Recommended to use in  time frame M15 and above .
This method can be  used to trade Forex, Gold and Crypto. 
My idea is formed on the view that when the price is moving strongly, the RSI 14 will tell us what the current trend is through a "BUY" or "EXIT" signal. When RSI 14 reaches the oversold area it will form a "BUY" signal and when it reaches the overbought area it will give an "EXIT" signal. I believe that when the price reaches the oversold or overbought area, the price momentum has also decreased and is about to reverse.
After receiving a signal from RSI 14, my job is to wait for an Entry signal from RSI 7. When RSI 7 reaches the overbought area, a yellow candle will appear and that's when we enter a LONG order. When the RSI 7 reaches the oversold area, a purple candle will appear and that's when we enter a SHORT order.
SST Table NewData Table for Update GTT Orders in Stocks....
Updated GTT Order details for SST , also added Relative Strength of Stock compared with NIFTY Index for 55 Days (3 Months) period.
RS line plotted on chart… taken reference of close price of day candle… just a bigger picture of actual RS indicator plotted on chart itself... RS line in red color means below zero line (negative) and green color means above zero line (positive).
Added code for checking RS value on chart for any previous day.
Steven Primo's bollinger bands strategyHi, this strategy is taken from a video made by Steven Primo. You can look it up on YouTube if you want to know about it.
It is a mean-reversion strategy based on the Bollinger Bands, in which we wait for 5 consecutive closes above the upper band, and for a short-term top. Once it happens, we place an entry order on this top, with a stop at the nearest bottom before the movement started, and use the difference from the stop and entry point to determine the target. For shorting, it's the same process, but for the downside. From my testing, only long orders were profitable, but you can configure whichever you want.
It works well for directional markets with a low level of noise, as you can see with the BTCUSD chart. One of its caveats is the short number of occurrences, and the long stop loss and target. You can enable a trailing stop, but from my testings, it just made the results worse.
I made some modifications, like removing the MA requirement, since the entry point was above it almost all the time, and I forced the BB to use a log version of the prices, so that discrepancies are eliminated. You'll also notice that you can't select an extension that is lower than 100, and that is intentional, since you're not supposed to enter a trade in which you can lose more than what you can earn.
I chose not to implement any kind of risk management, but I might do that in the future. You can leave your suggestions in the comments.
Fractal Break Imbalance / Fair Value Gap (FVG) / Liquidity VoidFractal Break Imbalance / Fair Value Gap (FVG) / Liquidity Void 
Order imbalances in either direction, either excess buy or sell orders, reduce liquidity. The market will seek to fill gaps sooner or later. The script marks an imbalance / FVG after a fractal break. It also marks any other imbalance. 
 Default Colours: 
Green - Imbalance after fractal break to the upside
Red - Imbalance after fractal break to the downside
Yellow - Other imbalances
 How To Use: 
Gaps can be used to determine possible entries and targets. Those familiar with liquidity raids, supply and demand, and ICT concepts may realise it's potential.
 Indicator in use: 
  
  
5 Minute EMA Cross StrategyThis simple Fast/Slow EMA cross strategy is designed to be used with Alertatron to place limit orders and use a trailing stop/take profit. 
Features:
 
 Indicators when the fast EMA crosses the slow EMA
 Trailing Stop/Take Profit
 Bar look back for placing limit order
 Macro EMA filter to only trade with the macro trend
Synthetic Price Action GeneratorNOTICE:
First thing you need to know, it "DOES NOT" reflect the price of the ticker you will load it on. THIS IS NOT AN INDICATOR FOR TRADING! It's a developer tool solely generating random values that look exactly like the fractals we observe every single day. This script's generated candles are as fake as the never ending garbage news cycles we are often force fed and expected to believe by using carefully scripted narratives peddled as hypnotic truth to psychologically and emotionally influence you to the point of control by coercion and subjugation. I wanted to make the script's synthetic nature very clear using that analogy, it's dynamically artificial. Do not accidentally become disillusioned by this scripts values, make trading decisions from it, and lastly don't become victim to predatory media magic ministry parrots with pretty, handsome smiles, compelling you to board their ferris wheel of fear. Now, on to the good stuff...
BACKSTORY:
Occasionally I find myself in situations where I have to build analyzers in Pine to actually build novel quantitative analytic indicators and tools worthy of future use. These analyzers certainly don't exist on this platform, but usually are required to engineer and tweak algorithms of the highest quality with the finest computational caliber. I have numerous other synthesizers to publish besides this one.
For many reasons, I needed a synthetic environment to utilize the analyzers I built in Pine, to even pursue building some exotic indicators and algorithms. Pine doesn't allow sourcing of tuples. Not to mention, I required numerous Pine advancements to make long held dreams into tangible realities. Many Pine upgrades have arrived and MANY, MANY more are in need of implementation for all. Now that I have this, intending to use it in the future often when in need, you can now use it too. I do anticipate some skilled Pine poets will employ this intended handy utility to design and/or improved indicators for trading.
 
ORIGIN:
This was inspired by the brilliance from the world renowned ALGOmist John F. Ehlers, but it's taken on a completely alien form from its original DNA. Browsing on the internet for something else, I came across an article with a small code snippet, and I remembered an old wish of mine. I have long known that by flipping back and forth on specific tickers and timeframes in my Watchlist is not the most efficient way to evaluate indicators in multiple theatres of price action. I realized, I always wanted to possess and use this sort of tool, so... I put it into Pine form, but now have decided to inject it with Pine Script steroids. The outcome is highly mutable candle formations in a reusable mutagenic package, observable above and masquerading as genuine looking price candles.
 
OVERVIEW:
I guess you could call it a price action synthesizer, but I entitled it "Synthetic Price Action Generator" for those who may be searching for such a thing. You may find this more useful on the All or 5Y charts initially to witness indication from beginning (barstate.isfirst === barindex==0) to end (last_bar_index), but you may also use keyboard shortcuts   +   +   to view the earliest plottable bars on any timeframe. I often use that keyboard shortcut to qualify an indicator through the entirety of it's runtime.
A lot can go wrong unexpectedly with indicator initialization, and you will never know it if you don't inspect it. Many recursively endowed Infinite Impulse Response (IIR) Filters can initialize with unintended results that minutely ring in slightly erroneous fashion for the entire runtime, beginning to end, causing deviations from "what should of been..." values with false signals. Looking closely at spg(), you will recognize that 3 EMAs are employed to manage and maintain randomness of CLOSE, HIGH, and LOW. In fact, any indicator's barindex==0 initialization can be inspected with the keyboard shortcuts above. If you see anything obviously strange in an authors indicator, please contact the developer if possible and respectfully notify them.
 
PURPOSE:
The primary intended application of this script, is to offer developers from advanced to even novice skill levels assistance with building next generation indicators. Mostly, it's purpose is for testing and troubleshooting indicators AND evaluating how they perform in a "manageable" randomized environment. Some times indicators flake out on rare but problematic price fluctuations, and this may help you with finding your issues/errata sooner than later. While the candles upon initial loading look pristine, by tweaking it to the minval/maxval parameters limits OR beyond with a few code modifications, you can generate unusual volatility, for instance... huge wicks. Limits of minval= and maxval= of are by default set to a comfort zone of operation. Massive wicks or candle bodies will undoubtedly affect your indication and often render them useless on tickers that exhibit that behavior, like WGMCF intraday currently.
Copy/paste boundaries are provided for relevant insertion into another script. Paste placement should happen at the very top of a script. Note that by overwriting the close, open, high, etc... values, your compiler will give you generous warnings of "variable shadowing" in abundance, but this is an expected part of applying it to your novel script, no worries. plotcandle() can be copied over too and enabled/disabled in Settings->Style. Always remember to fully remove this scripts' code and those assignments properly before actual trading use of your script occurs, AND specifically when publishing. The entirety of this provided code should never, never exist in a published indicator.
 
OTHER INTENTIONS:
Even though these are 100% synthetic generated price points, you will notice ALL of the fractal pseudo-patterns that commonly exist in the markets, are naturally occurring with this generator too. You can also swiftly immerse yourself in pattern recognition exercises with increased efficiency in real time by clicking any SPAG Setting in focus and then using the up/down arrow keys. I hope I explained potential uses adequately...
On a personal note, the existence of fractal symmetry often makes me wonder, do we truly live in a totality chaotic universe or is it ordered mathematically for some outcomes to a certain extent. I think both. My observations, it's a pre-deterministic reality completely influenced by infinitesimal amounts of sentient free will with unimaginable existing and emerging quantities. Some how an unknown mysterious mechanism governing the totality of universal physics and mathematics counts this 100.0% flawlessly and perpetually. Anyways, you can't change the past that long existed before your birth or even yesterday, but you can choose to dream, create, and forge the future into your desires and hopes. As always, shite always happens when your not looking for it. What you choose to do after stepping in it unintentionally... is totally up to you. :) Maybe this tool and tips provided will aid you in not stepping in an algo cachucha up to your ankles somehow.
SCRIPTING LESSONS PORTRAYED IN THIS SCRIPT:
Pine etiquette and code cleanliness
Overwrite capabilities of built-in Pine variables for testing indicators
Various techniques to organize Settings panel while providing ease of adjustment utility
Use of tooltip= to provide users adequate valuable information. Most people want to trade with indicators, not blindly make adjustments to them without any knowledge of their intended operation/effects
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. Have a profitable future everyone!
TFO + ATR Strategy with Trailing Stop LossThis strategy is an  experiment  to learn what happens when The Trend Flex Oscillator (by Dr. John Ehlers) is used in conjunction with a volatility indicator like ATR.  It was designed with cryptocurrency trading in mind.
 The way I coded this experiment makes it unsuitable for bear market conditions.  
 
When applied to a bull market, this trend-following strategy will open long positions when oversold price action appear to be reversing.  It will typically close a position within a few days unless it gets caught in a bear market, in which case it holds on for dear life.  I have tried to make back-testing very simple, but you should never trust it.  It's merely and interesting tool for adjusting the many parameters that I've made editable in the configuration window. Those values include the ATR and TFO parameters, as well as setting a trailing stop loss.  When closing a position, the strategy can optionally be told to ignore the trend analysis and only obey the trailing stop loss value. I've made an attempt to allow the user to define the minimum profit necessary to allow the strategy to close all all positions.  In my observations, the 2H candlestick charts seem to produce the best results, although the parameters of the strategy could theoretically be adjusted to suit other time periods.
 In summary... 
 
 This strategy has a bias for HODL (Holds on to Losses) meaning that it provides NO STOP LOSS protection! 
 Also note that the default behavior is designed for up to 15 open long orders, and executes one order to close them all at once.  
 Opening a long position is predicated on The Trend Flex Oscillator (TFO) rising after being oversold, and ATR above a certain volatility threshold.
 Closing a long is handled either by TFO showing overbought while above a certain ATR level, or the Trailing Stop Loss.  Pick one or both.
 If the strategy is allowed to sell before a Trailing Stop Loss is triggered, you can set a "must exceed %".  Do not mistake this for a stop loss.
 Short positions are not supported in this version.  Back-testing should NEVER be considered an accurate representation of actual trading results. 
 
// portions © allanster (date window code)
// portions © Dr. John Ehlers (Trend Flex Oscillator)
This code is provided for educational purposes only.   The results of this strategy should not be considered investment advice. 
The user of this script acknowledges that it can result in serious financial loss when used as a trading tool
MAX4 Ord. Volatility Market ScannerScan volatility of for NEW 15 coin listed on binance futures , print result in label ordered form higher or lower volatility Use it in combination with MAX2 Ord. Volatility Market and MAX1 Ord. Volatility Market Scanner to have all binance futures coin scan
zigzagplusThis is same as existing  zigzag  library with respect to functionality. But, there is a small update with respect to how arrays are used internally. This also leads to issues with backward compatibility. Hence I decided to make this as new library instead of updating the older one.
 Below are the major changes: 
 
  Earlier version uses array.unshift for adding new elements and array.pop for removing old elements. But, since array.unshift is considerably slower than alternative method array.push. Hence, this library makes use of array.push method to achieve performance.
  While array.push increases the performance significantly, there is also an issue with removing as we no longer will be able to remove the element using pop which is again faster than shift (which need to shit all the elements by index). Hence, have removed the logic of removing elements for zigzag pivots after certain limit. Will think further about it once I find better alternative of handling it.
  These implementation change also mean that zigzag pivots received by calling method will be ordered in reverse direction. Latest pivots will be stored with higher array index whereas older pivots are stored with lower array index. This is also the reason why backward compatibility is not achievable with this code change.
 
Library   "zigzagplus" 
Library dedicated to zigzags and related indicators
 zigzag(length, useAlternativeSource, source, oscillatorSource, directionBias)  zigzag: Calculates zigzag pivots and generates an array
  Parameters:
     length : : Zigzag Length
     useAlternativeSource : : If set uses the source for genrating zigzag. Default is false
     source : : Alternative source used only if useAlternativeSource is set to true. Default is close
     oscillatorSource : : Oscillator source for calculating divergence
     directionBias : : Direction bias for calculating divergence
  Returns: zigzagpivots        : Array containing zigzag pivots
zigzagpivotbars     : Array containing zigzag pivot bars
zigzagpivotdirs     : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios   : Array containing zigzag retracement ratios for each pivot
zigzagoscillators   : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias     : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence    :   Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
newPivot            : Returns true if new pivot created
doublePivot         : Returns true if two new pivots are created on same bar (Happens in case of candles with long wicks and shorter zigzag lengths)
 drawzigzag(length, , source, linecolor, linewidth, linestyle, oscillatorSource, directionBias, showHighLow, showRatios, showDivergence)  drawzigzag: Calculates and draws zigzag pivots
  Parameters:
     length : : Zigzag Length
     : useAlternativeSource: If set uses the source for genrating zigzag. Default is false
     source : : Alternative source used only if useAlternativeSource is set to true. Default is close
     linecolor : : zigzag line color
     linewidth : : zigzag line width
     linestyle : : zigzag line style
     oscillatorSource : : Oscillator source for calculating divergence
     directionBias : : Direction bias for calculating divergence
     showHighLow : : show highlow label
     showRatios : : show retracement ratios
     showDivergence : : Show divergence on label (Only works if divergence data is available - that is if we pass valid oscillatorSource and directionBias input)
  Returns: zigzagpivots        : Array containing zigzag pivots
zigzagpivotbars     : Array containing zigzag pivot bars
zigzagpivotdirs     : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios   : Array containing zigzag retracement ratios for each pivot
zigzagoscillators   : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias     : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence    :   Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzaglines         : Returns array of zigzag lines
zigzaglabels        : Returns array of zigzag labels
StringEvaluationLibrary   "StringEvaluation" 
Methods to handle evaluation of strings.
 is_comma(char)  Check if char is a comma ".".
	Parameters:
 	 char : string, 1 character string. 
	Returns: bool.
 is_op(char)  Check if char is a operator.
	Parameters:
 	 char : string, 1 character string. 
	Returns: bool.
 number(char)  convert a single char string into valid number.
	Parameters:
 	 char : string, 1 character string. 
	Returns: float.
 operator(op, left, right)  operation between left and right values.
	Parameters:
 	 op : string, operator string character.
	 left : float, left value of operation.
	 right : float, right value of operation. 
 operator_precedence(op)  level of precedence of operator.
	Parameters:
 	 op : string, operator 1 char string. 
	Returns: int.
 cleanup(_str)  Evaluate a string to clean up and retrieve only used chars
	Parameters:
 	 _str : string, arithmetic operations in a string. 
	Returns: string array, evaluated array.
 generate_rpn(tokens)  uses Shunting-Yard algorithm to generate a RPN (Reverse Polish notation)
array of strings from a array of strings containing arithmetic notation.
ex:.. ' '     -->     ' '
	Parameters:
 	 tokens : string array, array with arithmetic notation. 
	Returns: 
 parse_rpn()  evaluate a RPN (Reverse Polish notation) array of strings.
ex:.. 3 4 2 * 1 5 - 2 3 ^ ^ / +
| @param tokens string array, RPN ordered tokens, ex( ).
| @returns float, solution.
 eval()  evaluate a string with references to a array of arguments.
| @param tokens string, arithmetic operations with references to indices in arguments, ex:"0+1*0+2*2+3" arguments 
| @param arguments float array, arguments.
| @returns float, solution.
AMRS_LongOnly_PartTimerThis Script is created to back-test the data starting 01/01/2000 based on AMRS strategy.
AMRS is long only strategy. It is based on unique calculation around moving averages and 2 year high price.
There are few strategies for moving average crossovers but AMRS strategy is unique compared to other moving averages strategies as it has very specific below mentioned calculations evolving around moving average and stock price. 
AMRS strategy is unique one to generate buying signals when stock price creates new 2 year high and retraces back to 13 day EMA value.
AMRS strategy is unique one having specific calculation for entry signal and exit signal as mentioned below. This strategy gives back testing results to help build conviction on entry/exits if trades were taken in past as per the AMRS rules.
As per AMRS strategy this script generates green arrow on each time when new 2 year high is made and also generates long signal indicated by white arrow when stock price retraces back to 13 day EMA value and price is within 10% range from 2 year high.
This strategy will generate white arrow on the chart for each buy signal when stock price reaches 13 day EMA after first Long signal is generated. These subsequent buy signals can be used for pyramiding.
Entry Signal Logic : 1. Stock should be trading near 2 year high.
		             2. Stock price should be within 10% range from 2 year high
		             3. Stock price should be less than or equal to 13 day EMA and grater than equal to 21 day EMA	
This AMRS strategy also generates exit signal for already generated buy signal (open position).
Exit signal generated when stock price closes 5% below 21 day EMA or when stock price closes below 20% from most recent 2 year high price.
Exit Signal Logic : 1. Stock price closes 5% below 21 day EMA or stock price closes below 20% from most recent 2 year high price.
                           2. Since exit logic is based on closing price it is plotted on the chart next day.
                           3. So when exit signal is plotted on the chart, previous days stock price is either closed below 5% of 21 day EMA or corrected 20% from recent 2 year high.
Note : To Calculate last entry positions % return, by default all positions are getting closed on mentioned end date.
Script parameters :
start date as 01/01/2000 - Constructed from Start Year - 2000, Start Month - 1 Start Date - 1
End date (mostly current date) Constructed from Values in End Year, End Month, End Date.
Initial Capital - Defaulted to 100000
Order Size - 5% of Equity
Pyramiding - 3 orders
Commission - 0.2%
Slippage - 1 tick (Since this strategy exit is on close basis mostly there wont be any slippages)
BTC Candle Correlation Strategy This is a special strategy adapted for crypto market, which instead of using the current chart candles, we use inside calculation a candle from different charts.
For best usage I recommend a big timeframe like 1-4h+.
In this case we take the high, low, open and close candles from different brokers for BTC, and with it we form up the candle that we are going to use for the logic of entry.
At the same time we are going to create an upper and lower bands using a moving average and the difference between high and low.
So in a way to put it, if BTC triggers a sell or buy order, we input instead these orders on the current chart, like in this example with ETH.
Rules for entry
For long : if we have a crossover of the btc source value with the upper band .
For short: if we have a crossunder of the btc source vale with the lower band.
For exit, we do it when we receive a different signal than the initial one.
This strategy does not have any other risk management inside, so use it with caution.
If you have any other questions, let me know !
Weighted Harrell-Davis Quantile Estimator with AbsoluteDeviation
 QUANTILE  ESTIMATORS 
 Weighted Harrell-Davis Quantile Estimator with Absolute Deviation Fences. 
 
 DISCLAIMER: 
The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets.
The following indicator was made for NON LUCRATIVE ACTIVITIES and must remain as is, following TradingView's regulations. Use of indicator and their code are published for work and knowledge sharing.  All access granted over it, their use, copy or re-use should mention authorship(s) and origin(s).
 WARNING NOTICE! 
THE INCLUDED FUNCTION MUST BE CONSIDERED FOR TESTING. The models included in the indicator have been taken from open sources on the web and some of them has been modified by the author, problems could occur at diverse data sceneries, compiler version, or any other externality.
 Purpose: 
     Weighted Quantiles or <> are quite difficult to find on must systems, also it's non-weighted approach are rarely used to estimate the location parameter of price distribution WICH IS NOT NORMAL, all this in favour of it's non-robust counterpart, the Arithmetic rolling Mean or <> and it's weighted variants like the WMA, VWAP, etc.
   Also, a big drawback from this is that must statistics derived from Normal-Distribution parameter location (the Mean) definitely will not fit for an efficient, nor robust estimation for price distributions, so their moments like the standard deviation, kurtosis, skewness, etc. will not be the better tools to build derived algorithms or technical indicators among price/volume.
   In an effort searching better statistical tools for price distributions, I found the excellent work of  Andrey Akinshin  that took me to port  some of their Math research contributions for the compute benchmarking field , and bring it here at the  TradingView  ecosystem to take a shot at the price distribution crazy fields.   For a better detail of what the weighted Harrell-Davis Quantile Estimator can do, who better than drink directly from the source at References:
 References: 
 
 Weighted Quantile Estimators. 
 DoubleMAD outlier detector based on the Harrell-Davis quantile estimator. 
 Unbiased median absolute deviation based on the Harrell-Davis quantile estimator. 
 Quantile confidence intervals for weighted samples. 
 
 Licensing: 
This work is licensed under a  Attribution-NonCommercial-ShareAlike 4.0 International Copyright  (c) 2021 (CC BY-NC-SA 4.0)
 Copyright's & Mentions: 
 
 The  Gamma Functions  &  Beta Probability Density Functions  C# implementations by the Math.NET Numerics, part of the Math.NET Project.
 The  Regularized Incomplete (Left) Beta Function C# implementation  by the SAMTools, htslib project.
 The  Weighted Harrell-Davis Quantile estimator ; C# & R implementations by Andrey Akinshin.
 External PineScript code, methods, support & consultancy by @PineCoders staff with special mention for:
+   "ma sorter ('sort by array' example)- JD"  by @Duyck. 
+  Porting, mods, compilation and debugging for this script by  @XeL_Arjona  for the TradingView's  @PineCoders  community.
MAX3 Ord. Volatility Market ScannerScan volatility of for last 29 coin on binance futures, print result in label ordered form higher or lower volatility Use it in combination with MAX2 Ord. Volatility Market and MAX1 Ord. Volatility Market Scanner to have all binance futures coin scan






















