Portfolio Backtester Engine█  OVERVIEW 
Portfolio Backtester Engine (PBTE). This tool will allow you to backtest strategies across  multiple  securities at once. Allowing you to easier understand if your strategy is robust. If you are familiar with the  PineCoders backtesting engine , then you will find this indicator pleasant to work with as it is an adaptation based on that work. Much of the functionality has been kept the same, or enhanced, with some minor adjustments I made on the account of creating a more subjectively intuitive tool. 
 
█  HISTORY 
The original purpose of the backtesting engine (`BTE`) was to bridge the gap between  strategies  and  studies . Previously, strategies did not contain the ability to send alerts, but were necessary for backtesting. Studies on the other hand were necessary for sending alerts, but could not provide backtesting results . Often, traders would have to manage two separate Pine scripts to take advantage of each feature, this was less than ideal. 
The `BTE` published by PineCoders offered a solution to this issue by generating backtesting results under the context of a study(). This allowed traders to backtest their strategy and simultaneously generate alerts for automated trading, thus eliminating the need for a separate strategy() script (though, even converting the engine to a strategy was made simple by the PineCoders!).
Fast forward a couple years and PineScript evolved beyond these issues and  alerts  were introduced into strategies. The BTE was not quite as necessary anymore, but is still extremely useful as it contains extra features and data not found under the strategy() context. Below is an excerpt of features contained by the BTE:
"""
More than `40` built-in strategies,
Customizable components,
Coupling with your own external indicator,
Simple conversion from Study to Strategy modes,
Post-Exit analysis to search for alternate trade outcomes,
Use of the Data Window to show detailed bar by bar trade information and global statistics, including some not provided by TV backtesting,
Plotting of reminders and generation of alerts on in-trade events.
"""
Before I go any further, I want to be clear that the BTE is STILL a good tool and it is STILL very useful. The Portfolio Backtesting Engine I am introducing is only a tangental advancement and not to be confused as a replacement, this tool would not have been possible without the `BTE`. 
█  THE PROBLEM 
Most strategies built in Pine are limited by one thing. Data. Backtesting should be a rigorous process and researchers should examine the performance of their strategy across all market regimes; that includes, bullish and bearish markets, ranging markets, low volatility and high volatility.  Depending on your  TV subscription  The Pine Engine is limited to 5k-20k historical bars available for backtesting, which can often leave the strategy results wanting. As a general rule of thumb, strategies should be tested across a quantity of historical bars which will allow for at least 100 trades. In many cases, the lack of historical bars available for backtesting and frequency of the strategy signals produces less than 100 trades, rendering your strategy results inconclusive. 
█  THE SOLUTION 
In order to be confident that we have a robust strategy we must test it across all market regimes and we must have over 100 trades. To do this effectively, researchers can use the Portfolio Backtesting Engine (PBTE).
 
By testing a strategy across a carefully selected portfolio of securities, researchers can now gather 5k-20k historical bars per security! Currently, the PTBE allows up to 5 securities, which amounts to 25k-100k historical bars. 
█  HOW TO USE 
 1 — Add the indicator to your chart. 
 • Confirm inputs.  These will be the most important initial values which you can change later by clicking the gear icon ⚙ and opening up the settings of the indicator. 
 2 — Select a portfolio. 
 • You will want to spend some time carefully selecting a portfolio of securities. 
   • Each security should be uncorrelated. 
   • The entire portfolio should contain a mix of different market regimes.
    You should understand that strategies generally take advantage of one particular type of market regime. (trending, ranging, low/high volatility)
   For example, the default RSI strategy is typically advantageous during ranging markets, whereas a typical moving average crossover strategy is advantageous in trending markets. 
   If you were to use the standard RSI strategy during a trending market, you might be selling when you should be buying. 
   Similarily, if you use an SMA crossover during a ranging market, you will find that the MA's may produce many false signals.
   Even if you build a strategy that is designed to be used only in a trending market, it is still best to select a portfolio of all market regimes 
   as you will be able to test how your strategy will perform when the market does something unexpected.  
 3 — Test a built-in strategy or add your own.  
   • Navigate to gear icon ⚙ (settings) of strategy.
   • Choose your options.
      • Select a  Main Entry Strat  and  Alternate Entry Strat . 
         • If you want to add your own strategy, you will need to modify the source code and follow the built-in example. 
         • You will only need to generate (buy 1 / sell -1/ neutral 0) signals. 
      • Select a  Filter , by default these are all off.
      • Select an  Entry Stop  - This will be your stop loss placed at the trade entry.
      • Select  Pyamiding  - This will allow you to stack positions. By default this is off.
      • Select  Hard Exits  - You can also think of these as Take Profits.
   • Let the strategy run and take note of the display tables results.
      •   Portfolio  - Shows each security. 
         • The strategy runs on each asset in your portfolio. 
         • The initial capital is equally distributed across each security. 
          So if you have 5 securities and a starting capital of 100,000$ then each security will run the strategy starting with 20,000$
            The total row will aggregate the results on a bar by bar basis showing the total results of your initial capital.
      •   Net Profit (NP)  - Shows profitability.
      •   Number of Trades (#T)  - Shows # of trades taken during backtesting period.
         • Typically will want to see this number greater than 100 on the "Total" row.
      •   Average Trade Length (ATL)  - Shows average # of days in a trade.
      •   Maximum Drawdown (MD ) - Max peak-to-valley equity drawdown during backtesting period. 
         • This number defines the minimum amount of capital required to trade the system. 
         • Typically, this shouldn’t be lower than 34% and we will want to allow for at least 50% beyond this number.
      •   Maximum Loss (ML)  - Shows largest loss experienced on a per-trade basis. 
         • Normally, don’t want to exceed more than 1-2 % of equity. 
      •   Maximum Drawdown Duration (MDD)  - The longest duration of a drawdown in equity prior to a new equity peak. 
         • This number is important to help us psychologically understand how long we can expect to wait for a new peak in account equity. 
      •   Maximum Consecutive Losses (MCL)  - The max consecutive losses endured throughout the backtesting period. 
         • Another important metric for trader psychology, this will help you understand how many losses you should be prepared to handle.
      •   Profit to Maximum Drawdown (P:MD)  - A ratio for the average profit to the maximum drawdown. 
         • The higher the ratio is, the better. Large profits and small losses contribute to a good PMD.  
         • This metric allows us to examine the profit with respect to risk.
      •   Profit Loss Ratio (P:L)  - Average profit over the average loss. 
         • Typically this number should be higher in trend following systems. 
         • Mean reversion systems show lower values, but compensate with a better win %.
      •   Percent Winners (% W) - The percentage of winning trades. 
         • Trend systems will usually have lower win percentages, since statistically the market is only trending roughly 30% of the time. 
         • Mean reversion systems typically should have a high % W.
      •   Time Percentage (Time %)  - The amount of time that the system has an open position. 
         • The more time you are in the market, the more you are exposed to market risk, not to mention you could be using that money for something else right? 
      •   Return on Investment (ROI)  - Your Net Profit over your initial investment, represented as a percentage. 
         • You want this number to be positive and high.
      •   Open Profit (OP)  - If the strategy has any open positions, the floating value will be represented here.
      •   Trading Days (TD)  - An important metric showing how many days the strategy was active. 
         • This is good to know and will be valuable in understanding how long you will need to run this strategy in order to achieve results.
█  FEATURES 
These are additional features that extend the original `BTE` features.
- Portfolio backtesting.
- Color coded performance results.
- Circuit Breakers that will stop trading.
- Position reversals on exit. (Simulating the function of always in the market. Similar to strategy.entry functionality)
- Whipsaw Filter
- Moving Average Filter
- Minimum Change Filter
- % Gain Equity Exit
- Popular strategies, (MACD, MA cross, supertrend)
Below are features that were excluded from the original `BTE`
- 2 stage in-trade stops with kick-in rules (This was a subjective decision to remove. I found it to be complex and thwarted my use of the `BTE` for some time.)
- Simple conversion from Study to Strategy modes. (Not possible with multiple securities)
- Coupling with your own external indicator (Not really practical to use with multiple securities, but could be used if signals were generated based on some indicator which was not based on the current chart)
- Use of the Data Window to show detailed bar by bar trade information and global statistics.
- Post Exit Analysis.
- Plotting of reminders and generation of alerts on in-trade events.
- Alerts (These may be added in the future by request when I find the time.)
█  THANKS  
The whole  PineCoders  team for all their shared knowledge and original publication of the BTE and Richard Weismann for his ideas on building robust strategies.
═════════════════════════════════════════════════════════════════════════
Cerca negli script per "supertrend"
Hopper Trigger - Free Cryptohopper WidgetWelcome to our Tradingview cryptohopper trigger widget.
We designed this script to give Cryptohopper users the possibility to set up an alarm when btc is trending down. Cause of the BTCs behavior as the supertrend coin for the market it is better to turn your hopper off or be extremly careful when BTC is trending down. We implemented to types of alarms, because atm its not possible to automate using them to deactivate your hopper. On Alarm setup could be used to send signals every minute to trigger a push notification on your App or to trigger your Alexa. The other type of alarm only sends one single signal for normal purposes.
We recommend using this indicator in the 30 minute or 1 hour timeframe and to deactivate your hopper and deleting all positions when a alarm is signaling. The risk of a larger drop is very high in this marketphase. Never take an drop again using this approach. Little drawdown in bearish or ranging times but high reward in bullish times. 
Smartgrow-Trading is a community project with the aim of developing the best and most successful trading strategies and sharing them with the community.
The basic idea of this script is to calculate how far an coin is away from its ATH , to gave warning signals for deactivating coins after they reached there ATH . So it could also be used for other coins and pairs.
If there are questions, write them into the comments or contact us directly over the direct message or social media. Happy Trading! 
All Time High Warning - Free Cryptohopper WidgetWelcome to our Tradingview coin prediction filter.
We designed this script to give Cryptohopper users the possibility to set up an alarm when btc is close to All Time High. Cause of the BTCs behavior as the supertrend coin for the market it is better to turn your hopper off or be extremly careful when BTC is close to ATH.
We recommend deactivating the hopper and deleting all positions. The risk of a larger drop is very high in this marketphase.
Smartgrow-Trading is a community project with the aim of developing the best and most successful trading strategies and sharing them with the community.
The basic idea of this script is to calculate how far an coin is away from its ATH, to gave warning signals for deactivating coins after they reached there ATH. So it could also be used for other coins and pairs.
If there are questions, write them into the comments or contact us directly over the direct message or social media. Happy Trading! 
RedK_Larry William's TrendI'm not the author of this indicator or the concept behind it
i found this code - written for another platform - while researching "Larry William's Trend" - while i also couldn't find that specific keyword in the TV public library. So thought to bring this in.
Also unfortunately there was no coder details to give credit to with the code i found. it seems this may somehow be related to the famous SuperTrend - but i have no idea how they are connected. i simply ported this to Pine in my own way.
will be happy if this is useful to some traders who use these types of trend indicators. if you do find it useful, pls leave a comment here - or feel free to take this code and modify it in any further way for your specific need.
we continue to learn and explore new tools everyday. good luck!
 
4H Crypto RoycerThis indicator includes simple moving averages (21,50,200) and exponential moving averages (10,144) and has the ability to show this data on the chart with the approval of the user.
The indicator, which controls the intersections with the formulas it contains, can display the Golden Cross and Death Cross warnings to the user on the chart.
It draws a band on the chart with the support area calculations and in these band calculations; blends simple moving and exponential moving averages and smooths them by 1.5%.
It is used as a signal trigger in band overruns by replacing the lower and upper bands by calculation.
While one of our signal triggers is this band, our other variable is 50 simple moving averages.
Inspired by Kıvanç Özbilgiç's Supertrend indicator, the formula was updated using MA50 and 15% Stop-Loss instead of using atr multiplier.
Our chart has been tested in crypto currencies on 4 hour candles, so "4H" has been added to the beginning of the name.
We recommend using the indicator, buy / sell signals and the support band on the 4-hour charts.
Bollinger Oscillator Extreme + ADXSHORT DESCRIPTION  
This study is an improved, flexible, fully-customizable version of the one proposed by Steve Karnish of Cedar Creek Trading, who aimed to create an oscillator based on Bollinger Bands , with the goal of spotting divergencies that occurs outside the bands yet providing valuable entries on the crossings trough a smoothed signal. 
 IMPROVINGS  
Made a Zero Line normalization, where 0 is essentially the BBs basis MA, whereas +100 -100 represents those classic 2 Stdev; 
Added two levels of interest based on golden ratio working with the two above to get such an Overbought/Oversold Area. Those levels slightly move apart from a 1.5 Stev. 
Made possible to set EMA as basis average instead John’s classic SMA ; 
While I kept the original “CCT Oscillator” as a reliable divergence-hunter, I get from it the “Smoothed Oscillator” with a triple average smoothing. You can only play with the first smoothing step by “Oscillator Smoothing” while following are fixed. 
Despite little differences occurs, you can consider the Smoothed Oscillator itself as the Signal on the original CCT Oscillator. 
Derived the “Signal” that works on the Smoothed Oscillator. You can play with different smoothing length. 
Add a customizable ADX which helps weighting trend strength, weakness, choppiness . (mirrored on the Zero Line for aesthetics only) 
Add a “BB Width” representation so as you can stay in touch with BB volatility , squeezes, and so on. It is a non-analitic data (not 100 normalized). Use “BBW Multiplier” to match visual reading. 
 HOW TO USE (NOT TO USE)  
The indicator works well when strong directional moves occurs and even better in a sideways market (wide trading range). So there are three main evaluable application:
During an Up-trend, spotting negative divergencies on CCT Oscillator in the Oversold Area (better above +100) tell us that a correction or a reversal will probably occur. It’s time to consider a stop profit or look for a good re-entry after the pull-back. 
During a Down-trend, spotting positive divergencies on CCT Oscillator in the Overbought Area (better below -100) tell us that a correction or a reversal will probably occur. It’s time to consider a stop profit or look for a good re-entry after the pull-back. 
In a Sideway Market, look for both positive and negative divergencies on CCT Oscillator in the Oversold/Overbought Areas, trading in the range, better with the confirmation from such a Stochastic and a Volume based indicator. 
 >>> If you're not a pro you would better left counter-trend and mean-reversal setups to “trading titans”. <<<  
“OK! And what about signals!?” you tell. :D There are many ways to get signals from crossings and it’s up to you to find what work better to you needs. You can start testing the original Steve Karnish method, using the “CCT Oscillator”/“Smoothed Oscillator” crossings (a 9 period smoothing on a 20 period BB could be a reasonable begining). 
Whipsaws makes it difficult? Give a try to “Smoothed Oscillator”/“Signal” crossings. Observe how the price act when “Smoothed Oscillator” penetrate Overbought Area from above or Oversold Area from below after a divergence took place. 
Test a lot BB Length-Signal Smoothing combos. 
Test with EMA instead using John’s SMA . 
 Never forget the divergencies’ reliability is time-correlated yet timeframe-correlated too (the longer the better!).  
Never forget that the Zero Line (as the basis of BBs) tends to act as resistance/support. 
I do the best I can to realize such a flexible tool. Now is up to you to find what better suit your needs. 
 MEDTRONIC Daily  
 MORE SUGGESTIONS  
This script won’t be an out of the box stategy as no other indicator by itself, tough if you tell it could become a piece of the puzzle. 
So that his is basically a price-based indicator you would better consider to pair it with a volume-based or an absolute-momentum based one . 
Most important is you first focus on the market in order to detect strong uptrend/downtrend or sideways, better using a supertrend, moving averages (or whatever works better for you) paired with a momentum indicator . 
As literatures explains Bollinger Bands (such many others indicators) do their best in ranging markets, yet this version could be as useful when a strong directional move takes place. 
THIS WORK TAKES HOURS OF RESEARCH, DEVELOPMENT, TESTING… 
 SHARING IS INTENDED FOR EDUCATIONAL PURPOSE ONLY. NOT FOR PROFESSIONAL USE.  
 WILL APPRECIATE ANY FEEDBACK, QUESTION, SUGGESTION! (*) 
(*)  Please don’t ask me for “magic settings” which do not exist at all, nor for “kaleidoscopic effects” cause I’m a big fan of such a minimalistic yet professional layouts. 
 FOLLOWUP TO CHECK UPDATES!
Smart Money Flow v.2.0 BY Stock_InshotsThis Indicator is made by combination of indicators as follows 
1) Super Trend - Period 15,2.5 
Signal Filtered on the closing basis of SMA High 20 for strength
2) Simple Moving Average - period 50 
In which Purple indicates Uptrend
Orange Indicates down trend
3) Bill William's Fractal -  This indicator indicates important candle for formation of swing of High or low with Triangle shape at the bottom & top on the chart .
After Signal one can wait for fractal candle formation also for Big risk reward Ration 
Buy Setup : After signal Try to place long order near Sma50 
Sell Setup : After signal Try to place Short order near Sma50 
If missed wait for next Signal , Don't Run behind Price 
Keep Trailing Your Stop loss with ATR Values
Note : Nothing is 100% , You may customize this indicator according to your values .
Best to use with other momentum / strength indicator before taking positions
Like RSI / Support & Resistance Levels  
For Targets use BB% levels / Pivot Points / Fibonacci levels / Nearest Demand & Supply Zone
Thanks to the Trading view as i used open Source Codes in combination of this indicator. it helped a lot .
Feedback will be welcomed . 
Refer Image 
SuperBi just put this combo of some older scripts
so it has a volume indicator based on VPT can be control by length 
supertrend with factor to control sensitivity 
for each TF you need to find best settings for best results 
i hope you like this version 
in future if i have time i will try to put better scripts  
NIKI MS CRYPTOThis indicator is created specifically for BTCUSDTPERP, BTCBUSD, and BTCUSDT cryptocurrency pairs. It is not profitable in other cryptocurrency pairs. It only works on the 5-minute chart with a candle pattern. This indicator is just based on multi-timeframe Supertrend analysis. This indicator is more suitable for scalping. The target is 0.45% and the stop loss is 0.4%, which can be adjusted from the indicator settings. The yellow candle on the chart represents the entry and the blue candle represents the exit. All signals should be considered only after the candle is closed.
This indicator comes with Algo trading settings. By setting an alarm you can do robot trading in Binance.
Contact us using the links provided below to get access to this indicator.
VCCB Stocks - Volume Coloured Candle BarsVCCB Volume Coloured Candle Bars (for Stocks, Indices, ETF, Commodities)
This indicator colour-codes the candlesticks to help traders easily identify if price action is supported by STRONG BULLISH -or- BEARISH VOLUME.
.
.
DARK GREEN CANDLE when prices MOVE UP & VOLUME is MORE than 150% of its 21 day average --- indicates price action is supported by a VERY STRONG BULLISH VOLUME.
TIP: I will look out for this DARK GREEN CANDLE to identify entries for trading price breakout with high volume)
OLIVE GREEN CANDLE when prices MOVE UP & VOLUME is BETWEEN 100% AND 150% of its 21 day average ---- indicates volume is STRONG BULLISH.
LIGHT GREEN CANDLE when prices MOVE UP & VOLUME is EQUAL to or MORE than 50% but LESS than 100% of its 21 day average ---- indicates volume is neither strong or weak.
YELLOW CANDLE when prices MOVE UP but VOLUME is LESS than 50% of its 21 day average ---- indicates volume is weak and does not support the bullish price action.
.
.
DARK RED CANDLE when prices MOVE DOWN & VOLUME is MORE than 150% of its 21 day average --- indicates price action is supported by a VERY STRONG BEARISH VOLUME.
TIP: I will look out for this DARK RED CANDLE to identify entry setups for trading price breakdown with high volume.
RED CANDLE when prices MOVE DOWN & VOLUME is BETWEEN 100% AND 150% of its 21 day average ---- indicates volume is STRONG BEARISH.
PINK CANDLE when prices MOVE DOWN & VOLUME is EQUAL to or MORE than 50% but LESS than 100% of its 21 day average ---- indicates volume is neither strong or weak.
ORANGE CANDLE when prices MOVE DOWN but VOLUME is LESS than 50% of its 21 day average ---- indicates volume is weak and does not support the bearish price action.
.
.
I recommend using this indicator in conjuction with Supertrend Indicator (that provides dynamic levels of support and resistance) to help you identify potential entry/exit points.
Super Trend Triple - With Buy/Sell/Close and trailing S/L AlertsSuper Trend Triple by © PaulJC 
Having 3 super trend indicators is a fairly well-known strategy, taking an order when all 3 lines confirm the trend
while above/below the 200ema (optional)
!!!!!  Do your own backtesting on symbols you trade before trying with real funds  !!!!!
That said, this works well on most time frames when trailing the stop up the trend line...
You need to see which is the best line to follow based on the symbol you are trading and select this in the options if you want alerts when it moves!
 Alerts for: (Set alerts to 'Once Per Bar Close' to avoid early entry.) 
 
 Buy Signal
 Sell Signal
 Order Signal (Both Buy or Sell)
 Change in Stop
 Change in stop with stop prices (Select "Any alert() function call")
 Close Position
 
 Options/Inputs: 
 
 Show/Hide Trend Lines
 Show/Hide Background Colors
 Show/Hide Entry Background
 Show/Hide Close Background
 Show/Hide Entry / Close Arrows
 Show/Hide Entry / Close Labels
 Show/Hide 200EMA
 Turn On/Off EMA200 Filter
 Choose which Trend Line to follow for SL alerts
 Turn off all alerts
 
Any ideas for improvements or changes, let me know :)
RR 1 
 Software signal with Pivots/Previous day high/Previous day low combined with RR2 for better results.
Follow Line Trend SignalThis Script is a Trend Following system built over the concepts of normalising ATR over Bollinger Bands and Pivot points high low,
This Script  Can be used over AnyTimeframe 
and Can be treated as a stable alternative to Supertrend
Script has provisions for  BUY and SELL Alerts 
Enjoy!
Buy The Retrace studyA trend-following strategy entering pullbacks
Simple but efficient
The components of the script:
-MTF ATR based Trend
-Fib based cloud to help determine the trend
-Oscillator which is based on the current close relative to the close-only high-low range over a given period of time
The signal frequency can be changed on:
                  - Period - Length of the period to look for - i.e 25 means, the last 25 candles
                  - Bullline - signals created if oscillator above this level
                  - Bearline - signals created if oscillator below this level
I'd recommend taking the first few signals once the trend has changed.
Alerts are available as:
                 - First long / short signal
                 - Long / short signal
                 - Take profit long / short signal
                 - HTF trend change any direction
                 - HTF trend change up / down
Does not repaint - however, wait for a candle to close before entering a signal.
PVA Range High & LowFINALLY LEFT. the RANGE DAILY at the top RDH and the RANGE DAILY at the bottom RDL, is a PVSRA indicator used to calculate the daily ATR (Average True Range), with the help of my friend @ferhro, I was the one that managed to get closer to the original indicator for the metatrader 4.
Let's the features.
This indicator works as a support and natural resistance of the price, as it has a similarity with the pz supertrend, only on the daily chart.
Range daily High is the gray color and Range daily Low is the red color.
To extract the greatest potential from this indicator, I recommend using forex.
The indicator will be open source for suggestions for improvements.















