INVITE-ONLY SCRIPT

TFi Pivot Reversal V3

Güncellendi
The Pivot Reversal Study uses pivot points to create a support and resistance level; based on this levels the script creates virtual stop-market orders to catch the trend if the price is crossing the pivot lines.
A "Pyramiding" input allows to configure up to 3 entries; the script enters an additional position if the price falls by a configurable percentage amount (long), the reverse to short orders.
A configurable profit-target and stop-loss is being used to exit an open position.
An optional Moving Average filter can be used to enable only long or short positions.

The script renders a status box at the last bar, which shows the current position status and result of the built-in trading simulation results.
It shows the following statistic values:
  • current position PnL - also background turns green if position is in profit and red if in loss
  • the percentage distance to the profit-target and stop-loss level
  • the overall number of wins and losses and the win/loss ratio
  • the overall profit and loss amount (assuming a quantity of 1)
  • the net-profit and profit-ratio

For the correct simulation of entry/exit prices, the script contains inputs for a percentage entry and exit slippage.

The study also creates configurable alerts, which follow the exact position of the entry/exit markers. The default alert messages contain trading instruction to execute orders via Alertatron; but the message content can be replaced if configuring the alert in the Tradingview environment.

The script was mainly backtested with crypto-coins, e.g. XBTUSD at 15min timeframe. But the script also works with any other type of security and timeframe.

How to access
This strategy is a "Invite Only" script. You can can subscribe or purchase the strategy; please use the link below or send me a message via Tradingview to obtain access to the strategy and study script.
For enabling the script in your Tradingview chart window, click on "Indicators" and select "Invite-Only Scripts".

Full list of alerts
  • 'Alertatron Exit' ... Exit all open positions.
  • 'Alertatron Enter Long' ... Enter long position, w/o stop-loss being used.
  • 'Alertatron Enter Short' ... Enter short position, w/o stop-loss being used.
  • 'Alertatron Enter Long SL' ... Enter long position, w/ stop-loss being used.
  • 'Alertatron Enter Short SL' ... Enter short position, w/ stop-loss being used.


Full list of parameters
  • "Pivot Left Bars" ... Number of bars on the left of the pivot point - used for pivot /peak detection.
  • "Pivot Right Bars" ... Number of bars on the right of the pivot point - used for pivot /peak detection.
  • "MA Filter Fast" ... Moving Average filter fast period.
  • "MA Filter Slow" ... Moving Average filter slow period.
  • "Profit Target Option" ... Configure the profit-target either as a fix percentage value or an ATR.
  • "Profit Target [%]" ... Fix percentage profit-target.
  • "Profit ATR Period" ... ATR profit-target period.
  • "Profit ATR Factor" ... ATR profit-target factor/multiplier.
  • "Stop Loss Option" ... Configure the stop-loss either as a fix percentage value or disable the stop-loss completely.
  • "Stop Loss [%]" ... Fix percentage stop-loss.
  • "Rebuy Loss [%]" ... Percentage loss of the initial position before script enter a nw position in the same direction.
  • "Pyramiding" ... Maximum number of positions.
  • "Show MA Plots" ... Show/hide Moving average plots.
  • "Slippage Entry [%]" ... Percentage slippage for entering a position.
  • "Slippage Exit [%]" ... Percentage slippage for exiting a position.
  • "Statistic Label" ... Defines the position of the statistic label relatively to the last bar in the chart.
  • "Backtest Start" ... Backtest start time; area outside this timeframe will be grayed out.
  • "Backtest Stop" ... Backtest stop time; area outside this timeframe will be grayed out.
  • "Backtest Mode" ... Closes the currently opened position if chart switches to last bar; please only enable if backtesting, otherwise it leads to unwanted alerts.

Sürüm Notları
V3.12 Changes
  • added option for label for dark color scheme
  • added trailing stop
  • added entry/exit and daily funding fees
  • complete overhaul of statistic label, added balance and ROI


OVERVIEW
The Tradingview Pivot Reversal Study script uses pivot points to create a support and resistance level; based on this levels the script tries to catch the trend if the price is crossing these pivot lines up- or downwards.
2 Moving Averages are used to filter for the overall trend, and only enter positions in direction of the current main-trend.
The “Pyramiding” input allows to configure up to 5 entries; all positions a closed at once if the profit-target or trailing-stop has been reached.

PROFIT-TARGET/TRAILING-STOP
The script is either using a percentage fix profit-target or based on an ATR profit-target, or a trailing-stop to exit a position.

STOP-LOSS
The script allows to configure a percentage stop-loss; alternatively the stop-loss can be disabled completely.

ALERTS
Every position entry and exit triggers a configurable alert, which can be used to automate the trading.
The script provides default alert-message setup to automate trading via Alertatron API. But the message content can be modified if setting up the alerts in the local Tradingview environment.
Full list of alerts:
  • ‘Alertatron Exit’ … Exit all open positions.
  • ‘Alertatron Enter Long’ … Enter long position, w/o stop-loss being used.
  • ‘Alertatron Enter Short’ … Enter short position, w/o stop-loss being used.
  • ‘Alertatron Enter Long SL’ … Enter long position, w/ stop-loss being used.
  • ‘Alertatron Enter Short SL’ … Enter short position, w/ stop-loss being used.
  • ‘Alertatron Enter Long TS’ … Enter long position, w/ trailing-stop being used.
  • ‘Alertatron Enter Short TS’ … Enter short position, w/ trailing-stop being used.


STATISTIC FUNCTIONS
The script has built-in statistics which allow to fully backtest the script.
It calculates the following statistic values and shows them in a statistic label at the last bar:
  • current position(s) PnL – also background turns green if position is in profit, red if in loss and blue if flat
  • current number of open positions and the average entry price
  • the percentage distance to the profit-target, trailing-stop and stop-loss level
  • the overall number of wins and losses and the win/loss ratio
  • the overall profit and loss amount (based on a configurable start budget and position size)
  • the net-profit and profit-ratio
  • the overall fees paid (based on configurable entry/exit/daily funding fee)
  • the balance and ROI

For the correct simulation of entry/exit prices, the script contains inputs for a percentage entry and exit slippage.

Use the link below to obtain access to this indicator.
Sürüm Notları
V3.12 Inputs
  • "Pivot: Left Bars" ... Number of bars on the left of the pivot points – used for pivot/peak detection.
  • "Pivot: Right Bars" ... Number of bars on the right of the pivot points – used for pivot/peak detection.
  • "Filter: MA Fast" ... Moving Average filter fast period.
  • "Filter: MA Slow" ... Moving Average filter slow period.
  • "Filter: Show Plot" ... Enable/disable MA plot visualization in the chart.
  • "Profit Target: Option" ... Configure the profit-target either as a fix percentage value (Fix), a trailing-stop (Trail) or ATR.
  • "Profit Target: Fix/Trail Activation [0..∞%]" ... Fix percentage profit-target or trailing-stop activation target.
  • "Profit Target: Trail Offset [0..100%]" ... Trailing-stop offset. It defines the percentage stop-loss distance from the trailing price peak.
  • "Profit Target: ATR Period [1..∞]" ... ATR profit-target period.
  • "Profit Target: ATR Factor [0..∞]" ... ATR profit-target factor/multiplier.
  • "Profit Target: Break-even Period [0..∞]" ... Period after profit-target is set to break-even price to close all open positions asap.
  • "Stop Loss: Option" ... Configure the stop-loss either as a fix percentage value (Fix) or disable the stop-loss completely (Off).
  • "Stop Loss: Fix [0..100%]" ... Fix percentage stop-loss.
  • "Start Balance [$]" ... Start balance used for performance calculations. Any value can be defined, even fractions, e.g. 0.2 BTC.
  • "Position Size [0..∞%]" ... Percentage size relative to the current balance of each individual position. The percentage value is not limited, which allows margin trading or leveraging of positions. Without leveraging and Pyramiding set to 5, the position size should be set to 20% to fully use the available balance.
  • "Pyramiding [1..5]" ... Maximum number of positions in the same trading direction. Minimum is 1, maximum is 5. Default is set to 3.
  • "Rebuy PnL [-100..100%]" ... Percentage gain/loss compared to the last position before entering a new position in the same direction. Default is set to 0. If 0, a new position will be entered everytime the entry trigger signals an entry until the maximum number of positions (defined via "Pyramiding") has been reached. If <0, the price relatively to the last entry has to go down (long) and up (short) by a percentage, before a new position will be entered. If >0, the price relatively to the last entry has to go up (long) and down (short) by a percentage, before a new position will be entered.
  • "Entry fee [-100..100%]" ... Percentage entry fee relative to the position value, which has to paid for every position entry (positive value => costs, negative value => credit).
  • "Exit Fee [-100..100%]" ... Percentage exit fee relative to the position value, which has to paid for every position exit (positive value => costs, negative value => credit).
  • "Daily Funding Fee [-100..100%]" ... Percentage funding fee relative to the position value, which has to paid daily (positive value => costs, negative value => credit). If holding a position only for 15mins only the share of the daily value will be applied - in case of 15min = daily value / 96.
  • "Slippage: Entry [0..100%]" ... Percentage slippage for entering a position.
  • "Slippage: Exit [0..100%]" ... Percentage slippage for exiting a position.
  • "Backtest: Start Time" ... Backtest start time; area outside this timeframe will be grayed out.
  • "Backtest: End Time" ... Backtest stop time; area outside this timeframe will be grayed out.
  • "Backtest: Close Last Bar" ... Closes the currently opened position if chart switches to last bar; please enable only if backtesting, otherwise it leads to unwanted alerts.
  • "Statistic Label Position/Theme" ... Defines the position of the statistic label relatively to the last bar in the chart.
Sürüm Notları
V3.15
  • small fix in exit balance calculation (pnlBalance needs to be cached before iterating through positions)
  • added MA filter options
  • bug fix in rebuy handling;
  • separated into Alertatron and Alpaca version


The new MA filter option allows to disable the Moving Average completely. If set to "Level#1" the fast MA has to be above the slow MA to enter a long position (reverse for short). If set to "Level#2", the condition for "Level#1" has to be tru, plus the pro=ice has to be above the slow MA for entering a long position (reverse for short).
Sürüm Notları
V3.17

  • draw label at last bar or end of backtest time
  • added Maximum Drawdown (MDD) statistics
  • added "Fix-Short-Only" SL option
  • changed naming for Alertatron alerts
  • small fix in trailing-stop exit handling; exit of confirmed bar if trailing-stop was crossed-below by low and it was a "red" bar
  • removed "Break-even Period" - not helpful

Sürüm Notları
V3.17.1
  • fixed label update - was not updated all the time
Sürüm Notları
V3.19
  • added group tags, added tooltips
  • added TVs 'alert' option - alert message does not need to be modified, and only one alert has to created in TV environment
  • added TradeFab's alert syntax as an option for trading stocks via Alpaca-Markets
  • added LinearRegression, SuperTrend filter options
  • fixed MDD calculation
  • small bug fix in filter "MA#2": was comparing low/high with maSlow, which is not correct, as it is repainting - use open instead
alertatronalertsbacktestingbitmexCryptocurrencypivotPivot PointsscalpingSimple Moving Average (SMA)Support and Resistance

Yalnızca davetli komut dosyası

Bu komut dosyasına erişim, yazar tarafından yetkilendirilen kullanıcılarla sınırlıdır ve genellikle ödeme gerektirir. Sık kullanılanlarınıza ekleyebilirsiniz, ancak bunu yalnızca izin talep edip yazarından bu izni aldıktan sonra kullanabileceksiniz. Daha fazla bilgi için TradeFab ile iletişime geçin veya yazarın aşağıdaki talimatlarını izleyin.

TradingView, yazarına %100 güvenmediğiniz ve komut dosyasının nasıl çalıştığını anlamadığınız sürece bir komut dosyası için ödeme yapmanızı ve onu kullanmanızı önermez. Çoğu durumda, Topluluk Komut Dosyaları bölümümüzde ücretsiz olarak iyi bir açık kaynak alternatifi bulabilirsiniz.

Yazarın talimatları

Please contact me via Tradingview, if you are interested in the script.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?

Uyarı: Erişim talebinde bulunmadan önce lütfen okuyun.

Thanks Frank, TradeFab LLC

For purchasing/subscribing scripts: tradefab.org/

Find us @
github.com/TradeFab
twitter.com/TradeFab
tradingview.com/u/TradeFab/
Aynı zamanda::

Feragatname