Berzerker IndexSome pairs have their own distinct behavior. That includes volatility, news reactiveness, trend x chop day discrepancy, and other qualities.
At first, I tried to measure this with the Choppiness Index, but it looks pretty much alike when you compare symbols like EURNZD and GBPCAD, but my testing shows some major behavioral differences between the two. Hence, I decided to build my own measurement which I later decided to call Berzerker Index.
• The calculation takes the previous value and adds 1, 3, 7, or 15 depending on how many standard deviations the price beats.
• Deviations use Jurik Moving Average as a central line. If there is no new penetration, the total value will not be increased.
• At the end of the value update, the result will decay whether it is changed or not. The readings decay significantly faster if the price is between the bands.
• The beginning of the calculation is the beginning of the chart. There isn't any period for the calculation.
As you can see, from the beginning of the year, the maximum readings on EURNZD are 49.8 and 73.6 for GBPCAD. This is what I wanted to achieve - find some way to clearly differentiate the pairs. Later, I went on EURUSD to confirm the results. EURUSD should be a calmer pair and it shows 33.5 which supports the theory.
The symbols with small bars and explosions on events and bank meetings will reach high values, whereas those that are more predictable with less extreme movements will be found below 45.
Lastly, you may identify long periods of continuous descend on the indicator as setting up for a large explosion. This is not the original idea but could work nevertheless.
Of course, I will further update this indicator if I get improvement ideas...
FAQ:
► Does this repaint?
• No.
► Where is the buy signal?
• There isn't one. The purpose is to study repeated behavioral patterns of different symbols, not to drink from the holy grail.
► Why is it called the 'Berzerker' Index?
• I don't know.
I used @everget's version of Jurik's Moving Average with his consent.
What do ya thing?
アベレージ・トゥルー・レンジ (ATR)
Wavy Tunnel + Trend ATR Buy Sell Signal by PaRnWavy Tunnel + Trend ATR Buy Sell Signal by PaRn
Originality by PaRn
First Combination of Wavy Tunnel + Trend ATR Buy Sell Signal by PaRn
"Buy Sell Signal" is base on Volatility Stop 20, Multiplier 2.5
"Trend Signal" is based on EMA crossover between EMA12(Close) and EMA26(Close)
Take Profit Line is EMA15(Default)
Wavy line Base on EMA34(high,close,low)
Tunnel line Base on EMA144(close),EMA169(close)
Green Candle Bar = "Uptrend"
Red Candle Bar = "Downtrend"
Buy when "Buy" Signal present
Follow Trend till the end of the trend : "Sell" Signal present
Buy More (Optional) = Green Arrow present on Uptrend
How to use Wavy Tunnel + Trend ATR Buy Sell Signal by PaRn
- Wavy Tunnel + Trend Signal can be used in any timeline from 5 Minutes to Weeks
- Price above both Wavy & Tunnel = "Uptrend"
- Green Candle Bar = Uptrend
- Buy when "Buy" Signal present
- Buy More (Optional) = Green Arrow present on Uptrend
- Hold your possition and Follow Trend till the end of the trend : "Sell" Signal present, It's time to sell all position
NOT RECOMMEND TO USE ON SIDEWAY MARKET
Strategy Template - V2This is an educational script created to demonstrate few basic building blocks of a trend based strategy and how to achieve different entry and exit types. My initial intention was to create a comprehensive strategy template which covers all the aspects of strategy. But, ended up creating fully fledged strategy based on trend following.
This is an enhancement on Strategy-Template But this script is comparitively more complex. Hence I decided to create new version instead of updating the existing one.
Lets dive deep.
SIMPLE COMPONENTS OF TREND FOLLOWING STRATEGY
TREND BIAS - This defines the direction of trend. Idea is not to trade against the trend direction. If the bias is bullish, look for long opportunities and if bias is bearish, look for short opportunities. Stay out of the market when the bias is neutral.
Often, trend bias is determined based on longer timeframe conditions. Example - 200 Moving Average, Higher timeframe moving averages, Higher timeframe high-lows etc. can be used for determining the trend bias.
In this script, I am using Weekly donchian channels combined with daily donchian channels to define trend bias.
Long Bias - 40 Day donchian channel sits completely in upper portion of 40 Week dochnial channel.
Short Bias - 40 Day donchian channel sits completely in lower portion of 40 Week donchian channel.
ENTRY CONDITION - Entry signals are generated only in the direction of bias. Hence, when in LongBias, we only get Long signals and when in short bias, we only get short signals.
In our case, when in Long Bias - if price hits 40 day high for the first time, this creates our long entry signal. Similarly when in Short Bias , price hitting 40 day low will create signal for going short. Since we do not take trades opposite to trend, no entry conditions are formed when price hits 40 day high in Short Bias or 40 day low in Long Bias.
EXIT CONDITION - Exit conditions are formed when we get signals of trend failure.
In our case, when in long trade, price hitting 40 day low creates exit signal. Similarly when in short trade price hitting 40 day high creates exit signal for short trade.
DIFFERENT TYPES OF ENTRY AND EXIT
In this script, I have tried to demonstrate different entry and exit types.
Entry types
Market - Enter immediately when entry signal is received. That is, in this case when price crossover over high in long bias and crosses under low in short bias
Stop - This method includes estimating at what level new highs are made and creating a stop buy order at that level. This way, we do not miss if the break out is stronger. But, susciptible to fail during fakeouts.
Limit - This method includes executing a limit order to buy at lower price or sell at higher price. In trend following methods, downside of limit order is when there is genuine breakout, these limit orders may not hit and during trend failures the limit orders are likely to hit and go straight to stop.
Stop-Limit - this is same as stop order but will also place a limit condition to avoid buying on overextended breakout or with lots of slippage.
Exit types
Market - whether to keep the existing trade running or whether to close it is determined after close of each bar and exit orders are executed manually upon receiving exit signal.
Stop - We place stop loss orders beforehand when there is a trade in place. This can help in avoiding big movements against trade within bar. But, this may also stop on false signals or fakeouts.
Take profit
Stop - No take profits are configured.
Target - 30% of the positions are closed when take profit levels are hit. Take profit levels are defined by risk reward.
USING THE CODE AS TEMPLATE
As mentioned earlier, I intended to create a fully fledged strategy template. But, ended up creating a fully fledged stratgy. However, you can take some part of this code and use it to start your own strategy. Will explain what all things can be adopted without worrying about the strategy implementation within
Strategy definition : This can be copied as is and just change the title of strategy. This defines some of the commonly used parameters of strategy which can help with close to realistic backtesting results for your coded strategy and comparison with buy and hold.
Generic Strategy Parameters : The parameter which defines controlling alllowed trade direction and trading window are present here. This again can be copied as is and variable inDateRange can be directly used in entry conditions.
Generic Methods : f_getMovingAverage and f_secureSecurity are handy and can be used as is. atr method provideded by pine gives you ATR based on RMA. If you want SMA or any other moving average based ATR, you can use the method f_getCustomAtr
Trade Statements : This section has all types of trading instructions which includes market/stop/limit/stop-limit type of entries and exits and take profit statements. You can adopt the type of entry you are interested in and change when condition to suit your strategy.
Trade conditions and levels : This section is required. But, cannot be copied. All the trade logic goes here which also sets parameters which are used in when of Trade Statements.
Hope this helps.
[KL] Relative Volume + ATR StrategyThis strategy will enter into long position when (a) current volume is above the average volume, and when (b) volatility of prices (based on ATR) is relatively low.
Backtested on hourly timeframes, win rates range between 35% to 50% on stocks with positive drifts (i.e. tendency to move upwards). Default setups are as follows:
- Average volume is computed using simple moving average (sma) of 14 periods. By default, 1.4x ratio seems to work well on most large cap stocks. If it's too high, then amount of potential points for entry will decrease. But if it's too low, then this indicator becomes meaningless.
- ATR (for determining volatility), look back period is 14 (following conventions). I have noticed that the profits could change drastically when changed to different values for each individually security. Feel free to experiment around with this parameter.
Other information: This strategy is based off of one of my previous scripts; a script called "Relatively Volume Strategy". The objective of this new script is to simplify the process of determining periods of low volatility. In this new script, we assume prices are consolidating when current ATR is within its moving average value by +/- one standard deviation.
Ticker SummaryTicker Summary provides at-a-glance summary information about a ticker near the current bar on the chart:
P/E ratio
Fwd P/E ratio
PEG ratio
Floating shares vs. total shares outstanding
% of trading volume that was short over the last 3 days
Average True Range (ATR) over last 14 days
There are a few less common items of information:
How many ATR multiples the ATR is extended over the last 10 bars. This gives an idea of how far the stock is currently extended.
"R-frequency", explained below.
An optional "ATR Reticule" is shown near the price. This is useful for traders that use ATR as a guideline for price targets and stop losses. On the left is the # of ATRs the stock is currently above the session open. On the right is the # of ATRs the stock is extended above the 10-bar moving average.
R-frequency: a measure of liquidity relevant to your own trading size. It is the frequency at which 1-R of your trading account is traded for a stock. Formula:
(1-R worth of shares) / (average dollar value traded per second), where:
"1-R worth of shares" is how many shares you would buy for a stop loss of -1 ATR, with max risk dollar value based on the Balance and Max Risk % indicator options.
"Average dollar value traded per second" is the 14-day average of (avg(high, low and close) * daily volume)
R-frequency of a second or less is very liquid. If the value is higher (for example, over 60 seconds) the stock is less liquid and you may have some trouble filling limit orders quickly.
NNFX ATRBefore I begin I want to mention:
1. This is an indicator specially made for NNFX traders who use the ATR rule of ATR1x for Take Profit and ATR1.5x for Stop Loss
2. It is a product of combining the in-built ATR and Dillon Grech's ATR ()
The indicator:
1. It can be used for a quick look using the lines to see instead of calculating whether price hit a TP or SL. However I have kept the Main ATR for those who want to record the ATR into the spreadsheet when back testing or forward testing
2. When placing a buy/long order, TP is blue and appears above price, SL is red and appears below price
3. When placing a sell/short order, TP is blue and appears below price, SL is red and appears above price
4. The Main ATR, which is yellow, is way below price because I didn't want the chart to be overwhelmed by a 5th line in the middle of 2 TPs and SLs aka make the chart look claustrophobic
ATR Start & Stop BotThis script is using Average True Range (ATR) and works very well on the Bitcoin 4 hour timeframe to determine when to stop and start your bots.
It has a very similar visual to the EMA RSI Indicator found here:
This 'ATR Start & Stop Bot' is better because it has less confusion during sideways market movement.
As an example - You are using 3commas and have a Composite bot setup with several alt coins, you can use this indicator with the ' Stop bot ' alert to disable your composite bot from taking trades at times when the market is on a trend that looks in the red.
Alternatively you can use the ' Start bot ' alert to turn your bot back on during the green uptrends.
Using this indicator with these alerts on the Bitcoin 4-Hour chart add a great layer of automation to your already existing bots.
Credits:
Original 'ATR Stops' indicator belong to the user failathon and that script is found here:
Also credits to Dradian for the alert additions.
Zigzag Candles SupertrendHere it is, as promised, supertrend based on Zigzag candles.
Earlier scripts on the Zigzag Candles expedition are here:
Zigzag-Candles
Zigzag-Candles-MA
Zigzag candles parameters Length and CandleSize remain as is. Along with this, we also add MALength and AtrMult to calculate ATR based on the new candles and to use it to derive supertrend.
UseZigzagCandles - selecting this will apply supertrend on zigzag candles and ignore the actual price candles completely.
UseClosePrices - Uses close price as base instead of high/low. Can be used in both modes of price candles and zigzag candles.
Multilevel ZigZag SupertrendVery much similar to :
I have slightly changed code to accommodate multiple zigzags. Also removed possibility of external source to keep it simple.
Indicator shows 2 Level zigzag based supertrends. Second zigzag used is multi level zigzag and hence, this acts as higher timeframe filter and can be considered as overall trend bias.
REMORA StrategyStrategy:
Finding entry using pullback or Buy On Dip method.
This indicator using EMA line and ATR strategy to find best entry.
EMA line consist of :
EMA 20, EMA 50 and EMA 90.
Entry signal when candle rebound on EMA line and rocket signal appeared.
Exit when "SL" signal appeared.
Av3Based on the ANNE EA v3 for MT4. For use on FOREX.
if ATR is greater than ATR average taken from last 5 candles, then market considered as trending, and so Open(0)>Close(1)=buy Open(0)Close(1)=sell Open(0)<Close(1)=buy.
If trending, then buy high & sell low, if consolidation then buy low sell high.
Exit is by trail and Take Profit.
PM me for edit or MT4 version info.
Dr.Om's SuperTrend IndicatorRiding along the Super Trend -
Super Trend Bullish candle (STBullCandle) is a candle where low is lower than supertrend and close is greater than super trend.
Conditions for going Long -
1. High of current candle should be higher than high of STBullCandle.
2. We can consider 1 or 2 candles after the STBullCandle for this condition.
3. If filterRsi is enabled, then we make an additional check of RSI being greater than the weighted moving average.
4. Should not be holding an existing long position
5. SuperTrend should be positive
Super Trend Bearish candle (STBearCandle) is a candle where high is higher than supertrend and close is lower than super trend.
Conditions for going Short -
1. Low of current candle should be lower than low of STBullCandle.
2. We can consider 1 or 2 candles after the STBearCandle for this condition.
3. If filterRsi is enabled, then we make an additional check of RSI being lower than the weighted moving average.
4. Should not be holding an existing short position
5. SuperTrend should be negative.
If holding long, EXIT LONG Position Criteria -
1. SL would be if close is lesser than the ST candle low
2. Direction of ST becomes Negative
3. If Reward to Risk ratio is given, then exit if target is achieved.
If holding short, EXIT SHORT Position Criteria -
1. SL would be if close is higher than the ST candle high
2. Direction of ST becomes +ve
3. If Reward to Risk ratio is given, then exit if target is achieved.
Average Zigzag Range (AZR)Here is an attempt calculate Average Zigzag Range (AZR). This can be used similar to ATR. Using AZR instead of ATR for trailing stop calculation may yield better outcome in trend trading.
Logic is simple.
Calculate zigzag based on ZigzagLength
Calculate distance between each zigzag pivots
Calculate simple moving average of last MALength pivots
Use DoubleMA option to further smooth AZR using a Secondary Moving Average
Averange Percentage RangeThis Indicator displays the two different Averange Percentage Range (APR) and the Percentage Range of the current bar.
If the long term APR is over the short term it indicates a lower volatility otherwise a higher.
You can set the calculation method, rising for (highest/lowest-1)*-100 or falling for (lowest/highest-1)*-100.
Strategy TemplateTrying to include few basic things which is needed for strategy which can be used as template.
Few important components
Strategy parameters
Few important parameters include - initial_capital, default_qty_type, default_qty_value, commission_type, pyramiding and commission_value. All my strategies will have similar settings with initial captial set to 20000 to 100000. 100% of equity per trade with no pyramiding (set to 1) and minimal commission.
margin_long and margin_short can be used for leveraged trading. But, since we are not using pyramiding, it will make no effect.
Trade Limiting parameters
Two types of limiting is available in the scripts
Limiting trading direction : this is done through method strategy.risk.allow_entry_in and input parameter tradeDirection
Limiting trades to particular time window : This is achieved through adding start time and end time parameters of type input.time and check whether time is within this window
Custom Methods
customized security method to get higher timeframe data
customized moving average method to get moving average of any type
Custom Parameters
Moving average Type option list which I use quite often. Any strategy where there is need to use moving average, I try to scan through different moving average types and lengths to see which one is more appropriate for the given strategy. Hence, keeping this parameter in template to make it readily available when I start with new strategy
waitForCloseBeforeExit - this is used if trailing stop need to activated as soon as price hits the stop or only on close price. This is again something I switch quite often based on strategy. Hence, keeping this as part of the template.
Entry and Exit statements for long and short
These statements from line (57 to 62) can remain as is even with new strategy. Only thing to be set are variables - buyCondition, sellCondition, closeBuyCondition and closeSellCondition
Last but not the least
In pinescript, a long and short position cannot coexist in a strategy at any point of time. Any short positions created will automatically stop long positions and vice versa. Hence, it is important make short and long trades mutually exclusive. In this example, I have used 200 weekly moving average as trend bias. No short positions are taken when price is trading above 200 weekly moving average low/close and no long positions are taken when price is less than 200 weekly moving average high/close. Any rule built on top of this (In this case a simple supertrend rules) ensures that there are no conflicting signals and hence avoids confusing trades on the stratgy.
Relative ATR by Alejandro PThis is an indicator that expands the usability of ATR into a strong and valuable volatility indicator.
With the Relative ATR you can quickly see when the current market volatility its extremely low, normal or extremely high in relation to the past.
This provides traders with a much more valuable insight as to the current market conditions than normal volatility indicators.
A trader can, for example, decide to filter its strategy to only periods where the ATR is in its lowest percentiles which tells him that the market is unusually "quiet" recently and there may be a big breakout about to happen.
Or a trader can use the filter to avoid getting whipsawed with their strategy by avoiding taking trades when the Relative ATR is at its highest percentiles.
ATR Mark Up/DownThis script looks for a period with increased volatility, as measured by ATR (Average True Range), then it looks for a high or a low in that area.
When price is above EMA (200 is default, can be changed), it looks for the highs and adds multiples of ATR to the high. Default values for multipliers are 3,9 and 27, meaning that the script will show 3xATR level above the high, 9xATR above the high and 27xATR above the high.
When price is below EMA it looks for the lows and subtracts multiples of ATR from the low.The script will show 3xATR level below the low, 9xATR below the low and 27xATR below the low.
Multipliers values can be changed as well, making it a versatile tool that shows potential levels of suppport/resistance based on the volatility.
Possible use cases:
Breakout trading, when price crosses a certain level, it may show potential profit targets for trades opened at a breakout.
Stoploss helper. Many traders use ATR for their stoplosses, 1 ATR below the swing low for long trades and 1 ATR above the swing high for short trades are common values used by many traders. In this case, the Lookback value comes handy, if we want to look maybe at a more recent value for swing high/low point.
The levels shown by this indicator are not guaranteed to be or not to be reached by price, these levels should be used in confluence with other indicators and looked at as a visual helper.
That's all, hope you enjoy it!
PS.
*It does not plot the ATR. I don't know how to do it and IF it can be done
** It does not plot the EMA. If necessary,it can be added in a future update
tr_volThis indicator shows the annualized volatility, computed using the ewma method. It also uses average true range (ATR) as the daily return, rather than the typical close-to-close percentage change. You can uncomment the "comparison" series to see how it compares to the standard deviation, daily log return method. The standard deviation method weights all periods equally and doesn't account for intra-day ranges, meaning it is less responsive to new information than the ewma method and doesn't weight large intra-day moves as heavily.
The long-run median is also displayed. This feature sometimes fails if there are too many bars.
ATR BacktesterATR backtester... input the desired number of bars backwards (I'd recommend 100 or so), and then it'll spit out in the columns on the right side of the screen how many times each ATR was hit. Helps to tell at a glance where bullish and bearish is for the stock. May not be insanely useful since you can just look at the chart, but feel free to use the code yourself for something.
ZigZag SupertrendBack to my favourite supertrend. But, this time on the basis of zigzag pivots.
This is similar to forming supertrend based on pivot high lows - but instead of using pivot poitns, we are using zigzag pivots here.
Zigzag is derived using the same method as this script:
But, have removed labels and display options of zigzag. Older lines are also immediately deleted so that it can work well in lower timeframes without any error. Number of zigzaglines to be kept in memory depends on the parameter History
WaitForConfirmation option when selected only considers the confirmed zigzaglines and will ignore present zigzag line which is forming. This is not going to make much difference as the present zigzag line will be always opposite to low or high it formed and hence will not affect the stop loss levels or reversals.
WaitForClose is for supertrend determination. When checked uses close prices. If unchecked uses highs and lows for supertrend direction update.
ATR parameters allow you to set an adjustment below pivot high lows. This is required because support and resistence are often zones rather than single point. Hence, adds bit more wiggle room for trend continuation and delays frequent reversals on pullbacks.
SD - Average True Range v5 - DoubleSD - Average True Range - Daily Weekly Monthly Yearly v5
It gives ATR intervals as 4 hours, daily, weekly, monthly and yearly. The expectation is to fill the ATR targets within the specified ranges. It can be used to determine target points on charts with a clear direction on the train.
Unlike the previous version, it is provided to use 2 different periods in the same indicator.
Note: Developed based on the source codes of the original SD ADR indicator.
ATR Value on ChartHi Friends & TradingView community.
Greetings to you.
Many traders use ATR to set Stop loss.
The built in ATR indicator plots the ATR values as a line. However, many traders do not want the ATR to be plotted on their charts, but are only interested in the ATR value as such.
This script does that - it just prints the latest ATR with your set Multiplier value on the chart. I have used the built-in ATR indicator and made necessary additions to the code.
I hope this script proves useful to traders.
Queries / feedback welcome.
All the best.
Kifier's MFI/STOCH Hidden Divergence/Trend BeaterMFI/STOCH Hidden Divergence/Trend Beater
General Idea:
My premise around this strategy was to make a general strategy for crypto that would help out with finding entry positions for when you’re bullish on a crypto and want to hold on for a while, and at the same time avoiding massive drops. Essentially a way to mix long term/ swing trading; I somewhat achieved my goal however it still requires a lot of logic tuning of the trend averages.
I’m a huge proponent of volume indicators and coupled with average closing price, I think this gives a really good idea of what is happening with the market. It gives an idea on the market and retail investor sentiment. This generally gives you logical entry positions (Although I don’t know how amazing that will work with all cryptos, there’s a fine line between a good strategy and one that just rides bubble market conditions, some would argue that’s still a success and others not)
How it works:
There are many components to the strategy that try to do different things:
First of all there are two types of entries, a MFI hidden divergence with a STOCH check, essentially it will only fire when a divergence is detected while STOCH is above 50%, however this might be changed in the future as due to the volatile nature of cryptos, the STOCH is not too effective. The second entry is a simple MFI/STOCH trend, if STOCH is above 50% and the trend is detected to be in a trending long, once a MFI crossover over the 50% line is detected an entry is placed, this is designed to get out profit where the divergence would otherwise be less accurate during strongly trending conditions.
-MFI is a great indicator, as a volume weighted momentum indicator I find it the most accurate of all, the STOCH however is a great indicator to get a general picture of simple market conditions and can filter out the emotional noise of retail investors.
-VWMA and an SMA (The bottom oscillator) gives an idea of the trend tacking into account of the volume, this serves as a more short term filter of the trend for filters.
-OBV checks are done between the OBV and an EMA of the OBV, to get the idea of a volume weighted long trend, which is important for crypto as there are massive rallies to go up due to retail greed, it’s great to jump onto it at the beginning, and get off before the stack of cards fall apart.
-ATR is used to detect when the market is relatively just ranging or moving sideways, which is where the hidden divergence entries are done, during predictable and profitable market conditions.
- Stop loss is based on the closest support of the entry, this is a nice medium of room to breath but also an actual stop loss.
Future plans and improvements:
Currently there’s a lot I want to improve, mostly the divergence detection and the overall sharpe ratio could be much better, but the current value of 0.5 gives me hope that the strategy is onto something. I also want to change TP from a percentage stop to something more dynamic but that might be too optimistic. The current plan is to paper trade test this either by manual or by a python bot, to see how it performs with some user input as well.