[Support and Resistance with Trend Lines] with Backtest (TSO) with Backtest (TSO)
===========================================================================
===========================================================================
This indicator serves as a comprehensive full-cycle trading system, providing alerts at each stage of the trade, from opening to closure. The algorithm uses most recent and historical S&R (Support and Resistance) levels with most recent and historical Trend Lines, generating signals for trades when Breaks/Bounces occur (Trade Open Signal triggers can be configured via very customizable indicator Input "Signal Trigger Matrix" settings). With signal for trade open, TP (Take Profit and SL (Stop Loss) levels are calculated as well and marked on the chart including alerts for each action of the trade. The indicator offers a variety of automated approaches for TP (Take-Profit) and SL (Stop-Loss) settings. These include static current/historical S&R (Support and Resistance) levels or S&R/Trend Lines dynamic breaks for TP (Take-Profit) and various SL (Stop-Loss) approaches, including ATR Trailing SL, opposite S&R (Support and Resistance) levels SL, opposite Trend Lines SL and more. This diverse set of tools ensure flexibility in tailoring TP (Take-Profit) and SL (Stop-Loss) parameters to different market conditions, contributing to a more adaptive and robust trading system. Additionally, a series of signal analysis tools, including market sentiment, candle bar analysis, divergence, and volume, enhance the precision of trading signals.
* Works with popular timeframes: 1M, 3M, 5M, 15M, 30M, 45M, 1H.
* Works well with Futures and Indices, can be used to trade Stocks, Crypto and FOREX.
* Includes LIVE alert/labels Breakouts and Bounces signal trigger feature, which can be used for scalping (NOTE: This approach cannot be backtested).
* Every action of the trade is calculated on a confirmed closed candle bar state (barstate.isconfirmed), so the indicator will never repaint.
==============================================================
Indicator examples:
---------------------------------------------------------------------------
Strategy Config: SRTL_MES_15M3Y_EODoff_ALL
Here is a nice example of MES (Micro E-Mini S&P 500 Index Futures) configuration, which uses S&R (Support and Resistance) breakouts as signal trigger with Elliot Wave confirmation and previous S&R historical levels for TP (Take-Profit).
---------------------------------------------------------------------------
An example of an intraday Tesla trade. Also the green arrows will be displayed IMMEDIATELY when Breakout/Reverse Bounce occurs (same an Alert will be triggered immediately).
===========================================================================
Trading open/close/TP/SL labels, plots and colors explanations:
---------------------------------------------------------------------------
>>> S&R (Support and Resistance) levels/lines: orange - support, blue - resistance (can be hidden).
>>> Trend Lines: yellow - support, green - resistance (can be hidden).
>>> Blue labels show resistance breakouts and bounces, light-blue - bullish, dark-blue - bearish
>>> Yellow labels show resistance breakouts and bounces, light-yellow - bullish, dark-yellow - bearish
>>> Green/Red arrows on top/bottom of candle bar will show LIVE breakouts (if turned on)
>>>>> LONG open: green "house" looking arrow below candle bar.
>>>>> SHORT open: red "house" looking arrow above candle bar.
>>>>> LONG/SHORT take-profit target: green/red circles (multi-profit > TP2/3/4/5 smaller circles).
>>>>> LONG/SHORT stop-loss target: green/red + crosses.
>>>>> LONG/SHORT take-profit hits: green/red diamonds.
>>>>> LONG/SHORT stop-loss hits: green/red X-crosses.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (profitable trade): green/red squares.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (loss trade): green/red PLUS(+)-crosses.
===========================================================================
STATS TABLE ///////////////////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Trading STATS table on the chart showing current trade direction, Last TP (Take-Profit) Taken, Current Trade PL (profit/loss in price difference from trade open to the very current state).
---------------------------------------------------------------------------
CUSTOM TRADING DATE RANGE /////////////////////////////////////////////////
---------------------------------------------------------------------------
>>>>> This feature can be used to manually set indicator trading range from and to a specific date and time. NOTE: This is not intended for a very long date range backtesting, utilize TradingView Strategy Tester for that.
* Use TradingView “Strategy Tester” to see Backtesting results
NOTE: If Strategy Tester does not show any results with Date Ranged fully unchecked, there may be an issue where a script opens a trade, but there is not enough TradingView power to set the Take-Profit and Stop-Loss and somehow an open trade gets stuck and never closes, so there are “no trades present”. In such case - manually check “Start”/“End” dates or use “Deep Backtesting” feature!
---------------------------------------------------------------------------
INTRADAY ACTIVE TRADING SESSION CONFIGURATION /////////////////////////////
---------------------------------------------------------------------------
>>> Regional Active Trading Session Hours Schedule: If selected - trades will only open during regional active trading session, if 'OFF', there will be no trading schedule and trades will open 24/7.
>>> EOD(End of Day) Close - On/Off: Close the trade if it's still open at the end of active trading session (on the very last candle bar). NOTE: If no region is selected at 'Regional Active Trading Session Schedule' - there will be no EOD(End of Day) Close and trades will run overnight until either SL(Stop-Loss) or TP(Take-Profit) is hit!
>>>>> EOD(End of Day) Close - 1 candle bar before last: This is specifically for stocks as while usually indices can be closed 15minutes after the market closes, for stocks - the last candle bar closes at the same time with the market active trading session, which if closed - trades can't be closed until next day/session! Enable this setting for the trade to close/alert 1 candle bar before the last one, so there is still time to close the trade at the Broker (NOTE: depending on the timeframe, 1 candle bar can be: 15sec, 30sec, 1min, 3min, 5min, 15min, 30min, 45min, 1h).
---------------------------------------------------------------------------
SIGNAL TRIGGER MATRIX ////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Trading Engine: This setting turns on TradingView Strategy trading engine for backtesting.
>>> Market Session Only: With this setting turned on, all signal trigger Breaks/Bounces will be hidden during Pre/Post market time.
>>> Plot S&R Levels/Lines: Plot S&R (Support and Resistance) on chart. Note: historical levels/lines will only be plotted if hit (Break/Bounce).
>>> Plot Trend Lines Levels/Lines: Plot Trend Lines levels/lines on chart. Note: historical levels/lines will only be plotted if hit (Break/Bounce).
>>> Use S&R Current Levels | Use S&R Historical Levels | Use Trend Lines Current Levels | Use Trend Lines Historical Levels |: Choose which levels should be used for Breaks/Bounces to be captured on. If all triggers are turned on/checked - whatever happens 1st wins the trigger.
>>> Breaks | Bounces: 'Breaks': Turn on Breaks through levels/lines signal trigger. | 'Bounces': Turn on Bounces off levels/lines signal trigger.
>>> Signal: Regular | Signal: S&R Combo | Signal: TL Combo | Signal: S&R + TL Combo | Signal: Repeat Action |: Trade open signal trigger execution approach MATRIX (If 1 or more turned on at the same time - whatever comes first will be the trade signal trigger). 'Regular': A single Break/Bounce must occur on a closed bar for signal trigger. 'S&R Combo': A combination of 2 Current + Historical S&R (Support and Resistance) Break/Bounce must happen in the same direction on same bar for signal trigger. 'TL Combo': A combination of 2 Current + Historical Trend Lines Break/Bounce must happen in the same direction on same bar for signal trigger. 'S&R + TL Combo': a combination of ANY S&R and Trend Line Break/Bounce must happen in the same direction on same bar for signal trigger. 'Repeat Action': Initial and then confirmation (2nd/3rd/etc. consecutive occurence) Break/Bounce must occur on same level/line for signal trigger.
>>> Historical - Look Back (# of days): How far back (in # of days) will historical S&R/Trend Lines will be used for Trade Open signals/TP/SL/etc.
>>> Historical - Look Back Invalidation (# of days): IF THERE IS TOO MUCH HISTORICAL LEVELS/LINES ON CHART - LOWER THIS SETTING + MAKE SURE IT'S SMALLER THAN 'Historical - Look Back (# of days)'. With big Look back period (5+ days) - it can become very messy with too many historical levels/lines. To clear oldest historical levels/lines - set Look Back Invalidation # of days to less than Historical Look Back # of days. (After X # of Look Back Invalidation days - older levels/lines will become invalidated and no longer used for opening trades/TP (Take-Profit)/SL (Stop-Loss), while newer levels/lines will still be discovered.
>>> S&R/Trend Lines - Support/Resistance combined into 1 entity: Every level or a line becomes simply a level or a line, regardless if it originally was a support or resistance. By default, depending on the level/line originally being support or resistance - the signal direction will be such as: Resistance is broken > LONG / bounced > SHORT; Support is broken > SHORT / bounced > LONG; with this setting on, either level or line can be both broken or bounced off in ANY direction, trade open direction will depend on current market sentiment only.
---------------------------------------------------------------------------
S&R CONFIGURATION ////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> S&R Search - Left Bars (current): This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with below - Right Bars).
>>> S&R Search - Right Bars (current): This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with above - Left Bars).
>>> S&R Search - Custom Resolution (current): This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> S&R Search - Left Bars (historical): This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with below - Right Bars).
>>> S&R Search - Right Bars (historical): This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with above - Left Bars).
>>> S&R Search - Custom Resolution (historical): This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> S&R - Historical S&R Levels - Extend to the right: Extend all S&R lines to the right.
>>> S&R (Current/Historical) - Live Breakout/Bounce - ALERT/SHOW: NOTE: Alert wlil trigger immediately at price Breaking thru or Bouncing off level/line and an arrow above /below the bar will show the direction of breakout/bounce. If on that same live bar - price comes back causing the Breakout/Bounce become no longer valid - the arrow will disappear as the condition of the Break/Bounce will no longer be valid.
---------------------------------------------------------------------------
TREND LINES CONFIGURATION ////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Show: Trend Line development (where it 'did not exist' yet): It takes 2 pivots to develop a trend line, pivot is established at least 3 candle bars later from where the pivot is. With this setting turned on - it will plot dashed lines where trend lines originated connecting the 1st and 2nd pivot point up to where the trend line became established (where in reality you would now be able to draw a certain trend line). Established already generated trend line are plotted with a solid line.
>>> Trend Lines - Line Slope Confirmation: LONG breakout will only be shown if trend line is goind downslope \. SHORT breakout will only be shown if trend line is goind upslope /.
>>> Trend Lines - Search - Left Bars (current): This setting is for calculating optimal Trend Lines.
>>> Trend Lines - Search - Right Bars (current): This setting is for calculating optimal Trend Lines.
>>> Trend Lines - Custom Resolution (current): This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> Trend Lines - Search - Left Bars (historical): This setting is for calculating optimal Trend Lines.
>>> Trend Lines - Search - Right Bars (historical): This setting is for calculating optimal Trend Lines.
>>> Trend Lines - Custom Resolution (historical): This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> Trend Lines - Historical Trend Lines - Extend to the right: Extend all Trend Lines to the right.
>>> Trend Lines (Current/Historical) - Live Breakout/Bounce - ALERT/SHOW: NOTE: Alert will trigger immediately at price Breaking thru or Bouncing off level/line and an arrow above /below the bar will show the direction of breakout/bounce. If on that same live bar - price comes back causing the Breakout/Bounce become no longer valid - the arrow will disappear as the condition of the Break/Bounce will no longer be valid.
---------------------------------------------------------------------------
TAKE-PROFIT/STOP-LOSS CONFIGURATION ///////////////////////////////////////
---------------------------------------------------------------------------
>>> TP (Take-Profit) System: 'S&R Static Current/Historical': TP (Take-Profit) is calculated using current/historical S&R (Support & Resistance) levels at trade open and remains static. 'S&R/Trend Lines Dynamic Breaks': TP (Take-Profit) is fully dynamic and will be trigger at price above trade open price and with Breakout occurence (S&R or Trend Line current/historical breakout).
>>> TP (Take-Profit) # of targets: It is wise to divide the trade into several profit targets. With this setting - up to 5 TP (Take-Profit) targets can be approached. The trade will be equally divided up by the selected # of TP (Take-Profit) targets.
>>> SL (Stop-Loss) System: 'ATR-Trailing-SL': SL (Stop-Loss) is trail-following the ATR (Average True Range) line, NOTE: If at signal trigger, ATR will be against the trade direction - trade open signal will be skipped; 'S&R-Static-SL': SL (Stop-Loss) is set at trade open per optimal most recent S&R level and remains there until trade closes; 'TrendLines-Static-SL': SL (Stop-Loss) is set at trade open per optimal most recent trend line and remains there until trade closes; 'TrendLines-Dynamic-SL': SL (Stop-Loss) will be set per current opposite trend line and follow it until trade is open.; 'Oppos-Sig-Trd-in-Loss': SL (Stop-Loss) will trigger at opposite signal with trade currently at loss.
>>> SL (Stop-Loss) - On/Off: Without SL (Stop-Loss), unless EOD (End of Day) Close is turned on - there will be no SL (Stop-Loss) at all!
---------------------------------------------------------------------------
MARKET SENTIMENT CONFIRMATION ///////////////////////////////////////
---------------------------------------------------------------------------
>>> Market Sentiment: Signal is confirmed per Market Sentiment direction. If Market Sentiment is turned off - whatever signal comes 1st will be the trade open trigger.
---------------------------------------------------------------------------
SIGNAL ANALYSIS AND CLEANUP ///////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Signal Cleanup - Bar Color: Include Bar Color (bullish/bearish) confirmation, LONG signal will only be opened if signal bar is green/bullish, SHORT if red/bearish.
>>> Signal Cleanup - Bar Directional Structure: Skip opposite bar structure types signals (For example: bearish green hammer).
>>> Signal Cleanup - Bar Doji Skip: Skip doji (indecisive) candles signals.
>>> Signal Cleanup - EWO (Elliott Wave Oscillator): Include EWO (Elliott Wave Oscillator), LONG will only be opened if EWO is bullish / SHORT if EWO is bearish.
>>> Signal Cleanup - VWAP (Volume-Weighted Average Price): Include VWAP (Volume-Weighted Average Price), LONG will only be opened if price is above VWAP / SHORT if price is below VWAP.
>>> Signal Cleanup - MA (Moving Average) Confirmation: Include MA (Moving Average), LONG will only be opened if MA is bullish / SHORT if MA is bearish.
>>> Signal Cleanup - ATR (Average True Range): Include ATR (Average True Range) confirmation, LONG will only be opened if ATR is bullish / SHORT if ATR is bearish.
>>> Signal Cleanup - Divergence(RSI + MACD): Include Divergence (RSI + MACD ) confirmation, LONG will only be opened if Divergence is bullish / SHORT if Divergence is bearish.
>>> Signal Cleanup - Volume % Strength: Include Volume strength/percentage confirmation, LONG/SHORT will only be opened with strong Volume matching the signal direction | By default, strong Volume percentage is set to 150% and weak to 50%.
>>> Signal Cleanup - Volume Above Average: Include Volume Above Moving Average (Volume closing bar closes above volume moving average) confirmation, LONG/SHORT will only be opened with Volume above average - Volume closed bar color must match the closed price color (bullish/bearish direction) + Volume bar must be closed above volume MA line).
---------------------------------------------------------------------------
===========================================================================
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
TP System - VERY IMPORTANT INFO!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" - amount by which current trade/position needs to be reduced/partially closed/sold.
-------------------------------------------------------------------------------------------------------------------
TP System: Dynamic
"TP PERCENTAGE" - will always be the same amount (trade/position size divided by the # of take-profit(TP) targets) and percentage to be closed will always be of the ORIGINAL trade/position.
-------------------------------------------------------------------------------------------------------------------
TP System: Static
"TP PERCENTAGE" - will always be the same amount IF take-profit(TP) targets are hit 1-by-1 (TP1 > TP2 > TP3 > TP4 > TP5), otherwise it will vary and unless it is a 1st take-profit(TP1), the REMAINING trade/position size will always be smaller than original and therefore the percentage to be closed will always be of the REMAINING trade/position and NOT the original one!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" CheatSheet (these are the only percentages you may see)
-----------------------------------------------------------------------
TP PERCENTAGE---Close/Sell Amount-------------Example (trade size: 50 stocks)
20%-------------trade size * 0.2--------------50 * 0.2 = 10 stocks
25%-------------trade size * 0.25-------------50 * 0.25 = 12.5(~13) stocks
34%-------------trade size * 0.34-------------50 * 0.34 = 17 stocks
40%-------------trade size * 0.4--------------50 * 0.4 = 20 stocks
50%-------------trade size * 0.5--------------50 * 0.5 = 25 stocks
60%-------------trade size * 0.6--------------50 * 0.6 = 30 stocks
66%-------------trade size * 0.66-------------50 * 0.66 = 33 stocks
75%-------------trade size * 0.75-------------50 * 0.75 = 37.5(~38) stocks
80%-------------trade size * 0.8--------------50 * 0.8 = 40 stocks
100%------------trade size--------------------50 = 50 stocks
-----------------------------------------------------------------------
If for any reason a portion of the current/remaining trade closed at such occurrence was slightly wrong, it is not an issue. Such occurrences are rare and with slight difference in partial TP closed is not significant to overall performance of our algorithms.
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
===========================================================================
Alert Settings (you don’t have to touch this section unless you will be using TradingView alerts through a Webhook to use with trading bot)
---------------------------------------------------------------------------
Here is how a LONG OPEN alert looks like.
NOTE: Each label , , etc. is customizable, you can change the text of it within indicator Input settings.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: OPEN
ENTRY: 20000
TP1: 20500
TP2: 21000
TP3: 21500
TP4: 22500
TP5: 23500
SL: 19000
Leverage: 0
---------------------------------------------------------------------------
Here is how a TP1 alert will look with 5 TPs breakdown of the trade.
NOTE1: Next to TP1 taken it will show at which price it was triggered.
NOTE2: Next to "TP Percentage" it shows how much of the CURRENT/ACTIVE/REMAINING trade needs to be closed.
NOTE2: If TP2/3/4/5 comes before TP1 - the alert will tell you exactly how many percent of the trade needs to be closed!
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: TP1
TP1: 20500
TP Percentage: 20%
---------------------------------------------------------------------------
Here is how an alert will look for LONG - STOP-LOSS.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
ENTRY: 20000
LONG: SL
SL: 19000
---------------------------------------------------------------------------
Here is how an alert will look for LONG - EOD (End of Day) In Profit close.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: EOD-Close (profit)
ENTRY: 20000
EOD-Close: 21900
===========================================================================
Adding Alerts in TradngView
---------------------------------------------------------------------------
-Add indicator to chart and make sure the correct strategy is configured (check Backtesting results)
-Right-click anywhere on the TradingView chart
-Click on Add alert
-Condition: Select this indicator by it’s name
-Immediately below, change it to "alert() function calls only", as other wise there will be 2 alerts for every alert!
-Expiration: Open-ended (that may require higher tier TradingView account, otherwise the alert will need to be occasionally re-triggered)
-Alert name: Whatever you desire
-Hit “Create”
-Note: If you change ANY Settings within the indicator – you must DELETE the current alert and create a new one per steps above, otherwise it will continue triggering alerts per old Settings!
===========================================================================
Good Luck! (NOTE: Trading is very risky, past performance is not necessarily indicative of future results, so please trade responsibly!)
---------------------------------------------------------------------------
NOTE: There seems to be a strange glitch when strategy is running live, it will show "double-take" take-profits labels on the chart. This is not affecting the script logic and backtesting results, if you simply change the timeframe real quick to something else then back - it will no longer show the duplicate orders... this must be some sort of a glitch as every alert was thoroughly tested to make sure everything is working!
Trailingstop
[Opening Range Breakout] S&R Strategy with Backtest (TSO) S&R Strategy with Backtest (TSO)
===========================================================================
===========================================================================
This indicator serves as a comprehensive full-cycle trading system, providing alerts at each stage of the trade, from opening to closure. The algorithm initiates by calculating the Opening/Pre-Market Price Range, waiting for a breakout to generate signals, and establishing TP (Take Profit and SL (Stop Loss) levels. The Opening/Pre-Market range, known for its robust support and resistance levels, is a key element. To filter out false breakouts and capture valid ones, the indicator incorporates a Smart Breakout feature, requiring confirmation through an initial breakout, a confirmation bounce, and a subsequent confirmation breakout. The indicator offers a variety of automated approaches for TP (Take-Profit) and SL (Stop-Loss) settings. These include leveraging opening range levels, both the most recent and historical S&R (Support and Resistance) levels, and an ATR (Average True Range) trailing stop-loss. This diverse set of tools ensure flexibility in tailoring TP (Take-Profit) and SL (Stop-Loss) parameters to different market conditions, contributing to a more adaptive and robust trading system. Additionally, a series of signal analysis tools, including candle bar analysis, divergence, and volume, enhance the precision of trading signals.
* Works with popular timeframes: 1M, 3M, 5M, 15M, 30M, 45M, 1H.
* Works best with Indices, Stocks, and Commodities, since there is pre-market price movement, which is used to obtain support and resistance price range.
* Every action of the trade is calculated on a confirmed closed candle bar state (barstate.isconfirmed), so the indicator will never repaint.
==============================================================
Indicator visual examples with various instruments:
---------------------------------------------------------------------------
Strategy Config: ORB_AAPL(NASDAQ)_15M
Example of Signal Cleanup confirmations via SMA and ATR. Take-Profit is calculated per optimal S&R (resistance) most recent levels.
---------------------------------------------------------------------------
Strategy Config: ORB_AMD(NASDAQ)_5M
Example of optimal S&R (resistance) level from previous day for Take-Profit 1 target, which gets hit.
---------------------------------------------------------------------------
Strategy Config: ORB_META(NASDAQ)_5M
Example of dynamic SL (Stop-Loss), which reduces the risk by moving to the new support level, which is at the same time is below the current price. Also Signal Cleanup confirmations via SMA, ATR and VWAP
---------------------------------------------------------------------------
Strategy Config: ORB_MSFT(NASDAQ)_15M
Example of automated ATR Trail Stop-Loss activation at no optimal S&R (support) feature.
---------------------------------------------------------------------------
Strategy Config: ORB_NFLX(NASDAQ)_3M
Example of a skipped LONG trade due to no optimal S&R (support) for Stop-Loss (can be seen per chart that it would be a loss trade). On another side, a SHORT SMA Confirmed trade hits all 3 profit targets.
---------------------------------------------------------------------------
Strategy Config: ORB_NVDA(NASDAQ)_15M
Example of no optimal support for SHORT Take-Profit targets, with ATR Trail Stop-Loss.
---------------------------------------------------------------------------
Strategy Config: ORB_SPY(AMEX)_15M
Example of several signal confirmations at the same time (SMA, VWAP, EWO) and S&R-TP-Entry-SL SL (Stop-Loss) system, which at trade open sets SL (Stop-Loss) per optimal S&R (since this is a LONG trade - support) and then moves to Entry at first take-profit.
===========================================================================
Trading open/close/TP/SL labels, plots and colors explanations:
---------------------------------------------------------------------------
>>> Opening/Pre-Market range: White dashed lines show opening range/pre-market levels with dotted white line extend along the Trading Schedule (if Trading Schedule is turned off - it will extend until next day).
>>> Smart Breakout: 1) Initial Breakout: "init_Brekout" | 2) Confirmation Bounce: "conf_Bounce" | 3) Confirmation Breakout: "conf_Breakout" (additional lables on chart can be hidden with only Confirmation Breakout shown).
>>> Additional S&R (Support and Resistance) lines: yellow - support, blue - resistance (can be hidden).
>>>>> LONG open: green "house" looking arrow below candle bar.
>>>>> SHORT open: red "house" looking arrow above candle bar.
>>>>> LONG/SHORT take-profit target: green/red circles (multi-profit > TP2/3/4/5 smaller circles).
>>>>> LONG/SHORT stop-loss target: green/red + crosses.
>>>>> LONG/SHORT take-profit hits: green/red diamonds.
>>>>> LONG/SHORT stop-loss hits: green/red X-crosses.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (profitable trade): green/red squares.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (loss trade): green/red PLUS(+)-crosses.
===========================================================================
STATS TABLE ///////////////////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Trading STATS table on the chart showing current trade direction, Last TP (Take-Profit) Taken, Current Trade PL (profit/loss in price difference from trade open to the very current state).
---------------------------------------------------------------------------
CUSTOM TRADING DATE RANGE /////////////////////////////////////////////////
---------------------------------------------------------------------------
>>>>> This feature can be used to manually set indicator trading range from and to a specific date and time. NOTE: This is not intended for a very long date range backtesting, utilize TradingView Strategy Tester for that.
* Use TradingView “Strategy Tester” to see Backtesting results
NOTE: If Strategy Tester does not show any results with Date Ranged fully unchecked, there may be an issue where a script opens a trade, but there is not enough TradingView power to set the Take-Profit and Stop-Loss and somehow an open trade gets stuck and never closes, so there are “no trades present”. In such case - manually check “Start”/“End” dates or use “Deep Backtesting” feature!
---------------------------------------------------------------------------
INTRADAY/TRADING SCHEDULE | ET (EASTERN TIMEZONE) ////////////////////////
---------------------------------------------------------------------------
>>> Trading Schedule - On/Off: This is where an Intraday Session or any custom session can be turned on and then scheduled.
>>>>> Trading Schedule - Time: Trade open Signals/Alerts time zone Hours. | NOTE: US Market Active Hours: 09:30 - 16:00 ET / Power Hour: 15:00 - 16:00 ET)
>>> Trading Schedule - EOD(End of Day) Close - On/Off: Close trade if still open by certain hour (set below).
>>>>> Trading Schedule - EOD(End of Day) Close - Hour (ET): US trading session closes at 4PM ET > 16:00.
Here is when the trade will close with EOD(End of Day) Close/Trading Cut Off Hour set to 16, which is end of US trading session:
1/3/5min > will close at 15:55pm ET
15min > will close at 15:45pm ET
30min > will close at 15:30pm ET
45min > will close at 15:45pm ET
60min > will close at 16:00pm ET
Here is when the trade will close with EOD(End of Day) Close/Trading Cut Off Hour set to 15, which is 1 hour before the end of US trading session (right before power hour starts):
1/3/5min > will close at 14:55pm ET
15min > will close at 14:45pm ET
30min > will close at 14:30pm ET
45min > will close at 14:45pm ET
60min > will close at 15:00pm ET
---------------------------------------------------------------------------
TRADE SIGNAL CONFIGURATION ////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Opening Range - Time Period (ET): Opening/Pre-Market Range time, which by default is set to US Session Pre-Market Range, can be customized to any time range as there are different market hours around the world and this setting can be customized to any time. Pre-Market Time/Price Range Hours(ET) | Pre-Market EU/Asia Hours: 4:00-9:30 ET | Pre-Market US (NY) Hours: 7:00-9:30 ET | Post-Market US Hours: 16:00-19:00 ET | First US Market Hour: 9:30-10:30 ET | Power Hour: 15:00-16:00)
>>> Opening Range - Levels Structure: determines how the price range is calculated, based on the highest/lowest price zones or based on the candle body bar.
>>> Opening Range - Breakout System: "Simple": bar close price has to simply break the opening range level | "Smart": After initial breakout (which is basically 'Simple' Breakout), a price come back is expected to the opening range level, a bounce, then a confirmation breakout with price closing ahead of the initial breakout.
>>>>> Opening Range - Smart Breakout: # of bars until Initial Breakout becomes invalid
>>>>> Opening Range - Smart Breakout: Bounce Settings, "Cross-Return" - LONG: Price has to cross down the initial breakout S&R, but never close below it; SHORT: Price has to cross up the initial breakout S&R, but then close above it; ||| "Cross-Close-Return" - LONG: At least 1 candle has to close below initial breakout S&R; SHORT: At least 1 candle has to close above initial breakout S&R.
>>>>> Alerts - Opening Range - Smart Breakout: Confirmation Bounce Alert. Trigger an alert at confirmation bounce. This is for live trading (especially scalping) Smart Breakout approach - to get ready to open the trade in the correct direction.
---------------------------------------------------------------------------
TAKE-PROFIT/STOP-LOSS CONFIGURATION ///////////////////////////////////////
---------------------------------------------------------------------------
>>> TP (Take-Profit) and SL (Stop-Loss): S&R Search - Left Bars: This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with below - Right Bars) for S&R (Support and Resistance) TP (Take-Profit) levels calculations. NOTE: if at any point - there will be no available S&R (Support & Resistance) found for SL (Stop-Loss, 'S&R-Dynamic-SL' or 'S&R-Static-SL' setting, since both settings search for optimal SL (Stop-Loss) at trade open) or TP (Take-Profit, at any setting, since at trade open, an optimal TP (Take-Profit) level is searched) > SL (Stop-Loss) will automatically switch to trailing ATR-Trailing-SL and the trade will continue to run until it either hits ATR-Trailing-SL (Stop-Loss) or closes at EOD (End of Day).
>>> TP (Take-Profit) and SL (Stop-Loss): S&R Search - Right Bars: This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with above - Left Bars) for S&R (Support and Resistance) TP (Take-Profit) levels calculations. NOTE: if at any point - there will be no available S&R (Support & Resistance) found for SL (Stop-Loss, 'S&R-Dynamic-SL' or 'S&R-Static-SL' setting, since both settings search for optimal SL (Stop-Loss) at trade open) or TP (Take-Profit, at any setting, since at trade open, an optimal TP (Take-Profit) level is searched) > SL (Stop-Loss) will automatically switch to trailing ATR-Trailing-SL and the trade will continue to run until it either hits ATR-Trailing-SL (Stop-Loss) or closes at EOD (End of Day).
>>> TP (Take-Profit) and SL (Stop-Loss): S&R Search - Custom Resolution: This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> TP (Take-Profit) and SL (Stop-Loss): # of Bars (5000 max) to search back for optimal Support and Resistance levels: This is how many candles will be searched backwards for previous S&Rs (Support and Resistance) to find the optimal levels for TP (Take-Profit) and SL (Stop-Loss). NOTE: If SL (Stop-Loss) System is set to 'ATR-Trailing-SL' - this setting is only relevant for searching TP (Take-Profit) levels.
>>> TP (Take-Profit) and SL (Stop-Loss): At Trade Open - No S&R (Support and Resistance) found behavior: 'Skip Trade': If at trade open there are no S&R (Support and Resistance) levels for TP1 (Take-Profit 1) or SL (Stop-Loss) - trade is skipped. 'Open/ATR-Trailing-SL': If at trade open there are no S&R (Support and Resistance) levels for TP1 (Take-Profit 1) or SL (Stop-Loss), the trade will still be open with SL (Stop-Loss) set to 'ATR-Trailing-SL'.
>>> TP (Take-Profit) System: Pre-Market-Range-TP: All TP (Take-Profit) targets are calculated at trade open using the distance between Support and Resistance per Opening Pre-market Range and then divided by TP (Take-Profit) Divider, which can be set below; S&R-Current-Optimal-TP1: TP1 (Take-Profit) level is set per currently available S&R (Support & Resistance), if none available - historical S&R (Support & Resistance) levels will be searched, remaining TP (Take-Profit) targets (if selected, up to 5 # of TPs) are searched through most recent closest historical S&R (Support & Resistance) levels; S&R-Historic-Optimal-TP1: TP1 (Take-Profit) level is set per historically most recent closest available S&R (Support & Resistance) to the Entry price, remaining TP (Take-Profit) targets (if selected, up to 5 # of TPs) are searched through historical S&R (Support & Resistance) levels as well.
>>> TP (Take-Profit, Pre-Market-Range-TP) Divider #: This is for 'Pre-Market-Range-TP' setting only, where TP (Take-Profit) level is the distance between top/bottom levels of the opening range. It can be reduced by the divider #. (1 - full distance; 2 - 1/2 distance; 3 - 1/3 distance; etc.
>>> TP (Take-Profit) # of targets: It is wise to divide the trade into several profit targets. With this setting - up to 5 TP (Take-Profit) targets can be approached. The trade will be equally divided up by the selected # of TP (Take-Profit) targets.
>>> TP (Take-Profit) target(s) Consumed: Signal Bar consuming Take-Profits - trade signal bar is big enough to 'consume'/close ahead of the first TP setting > the signal can either be skipped, or all Take-Profit targets pushed ahead by average bar size).
>>> TP (Take-Profit) Offset - On/Off: This is a feature where TP (Take-Profit) target will be considered taken even if the price never crosses the target(s), but comes close enough (based on the offset amount). Set the offset amount below.
>>>>> TP (Take-Profit) Offset - Amount: Some Examples: (for SPY 0.1 would be $0.10 offset - if TP1 is $400 and price hits $399.90 > TP1 considered taken/signal shown/alert) | NOTE: For EURUSD, it is very different and if wrong will show TP1 immediately at trade open, typical good offset for EURUSD is: 0.0005 | Similar for BTCUSD, for example: 10 - $10 offset, if TP is $15,000 > $14,990.
>>> SL (Stop-Loss) System: 'Pre-Market-Range-SL': SL (Stop-Loss) is set to the opposite market range level from trade direction; 'S&R-Static-SL': SL (Stop-Loss) is set at trade open per optimal most recent S&R level and remains there until trade closes; 'S&R-Dynamic-SL': SL (Stop-Loss) is set at a trade open per optimal S&R (Support and Resistance) level from the most recent AND historical S&Rs (Support and Resistance), with every bar closed it will check if there are new S&Rs (Support and Resistance) levels, if these levels appear closer to the current price then current level - it will move SL (Stop-Loss) to that level, therefore reducing the risk; 'ATR-Trailing-SL': SL (Stop-Loss) is trail-following the ATR (Average True Range) line, NOTE: If at signal trigger, ATR will be against the trade direction - trade open signal will be skipped; 'S&R-TP-Entry-SL': SL (Stop-Loss) initially is set per S&R, then moves to Entry price at the very first TP (Take-Profit) hit and remains there until trade closes; 'S&R-TP-Trail-SL': SL (Stop-Loss) initially is set per S&R, then moves to Entry at TP1 (Take-Profit 1) hit, then keeps trailing per previously taken profit targets (TP2 taken, SL moves to TP1 | TP3 taken, SL moves to TP2 | TP4 taken, SL moves to TP3). NOTE: 'ATR-Trailing-SL' will not switch automatically if 'S&R-Dynamic-SL', S&R-TP-Entry-SL', 'S&R-TP-Trail-SL' system is selected, as already the most optimal SL (Stop-Loss) level is calculated - it will switch automatically only with 'S&R-Static-SL' system.
>>> SL (Stop-Loss) - On/Off: Without SL (Stop-Loss), unless EOD (End of Day) Close is turned on - there will be no SL (Stop-Loss) at all!
---------------------------------------------------------------------------
SIGNAL ANALYSIS AND CLEANUP ///////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Signal Cleanup - Bar Color: Include Bar Color (bullish/bearish) confirmation, LONG signal will only be opened if signal bar is green/bullish, SHORT if red/bearish.
>>> Signal Cleanup - Bar Directional Structure: Skip opposite bar structure types signals (For example: bearish green hammer).
>>> Signal Cleanup - Bar Doji Skip: Skip doji (indecisive) candles signals.
>>> Signal Cleanup - EWO (Elliott Wave Oscillator): Include EWO (Elliott Wave Oscillator), LONG will only be opened if EWO is bullish / SHORT if EWO is bearish.
>>> Signal Cleanup - VWAP (Volume-Weighted Average Price): Include VWAP (Volume-Weighted Average Price), LONG will only be opened if price is above VWAP / SHORT if price is below VWAP.
>>> Signal Cleanup - MA (Moving Average) Confirmation: Include MA (Moving Average), LONG will only be opened if MA is bullish / SHORT if MA is bearish.
>>> Signal Cleanup - ATR (Average True Range): Include ATR (Average True Range) confirmation, LONG will only be opened if ATR is bullish / SHORT if ATR is bearish.
>>> Signal Cleanup - Divergence(RSI + MACD): Include Divergence (RSI + MACD ) confirmation, LONG will only be opened if Divergence is bullish / SHORT if Divergence is bearish.
>>> Signal Cleanup - Volume % Strength: Include Volume strength/percentage confirmation, LONG/SHORT will only be opened with strong Volume matching the signal direction | By default, strong Volume percentage is set to 150% and weak to 50%.
>>> Signal Cleanup - Volume Above Average: Include Volume Above Moving Average (Volume closing bar closes above volume moving average) confirmation, LONG/SHORT will only be opened with Volume above average - Volume closed bar color must match the closed price color (bullish/bearish direction) + Volume bar must be closed above volume MA line).
---------------------------------------------------------------------------
===========================================================================
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
TP System - VERY IMPORTANT INFO!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" - amount by which current trade/position needs to be reduced/partially closed/sold.
-------------------------------------------------------------------------------------------------------------------
TP System: Dynamic
"TP PERCENTAGE" - will always be the same amount (trade/position size divided by the # of take-profit(TP) targets) and percentage to be closed will always be of the ORIGINAL trade/position.
-------------------------------------------------------------------------------------------------------------------
TP System: Static
"TP PERCENTAGE" - will always be the same amount IF take-profit(TP) targets are hit 1-by-1 (TP1 > TP2 > TP3 > TP4 > TP5), otherwise it will vary and unless it is a 1st take-profit(TP1), the REMAINING trade/position size will always be smaller than original and therefore the percentage to be closed will always be of the REMAINING trade/position and NOT the original one!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" CheatSheet (these are the only percentages you may see)
-----------------------------------------------------------------------
TP PERCENTAGE---Close/Sell Amount-------------Example (trade size: 50 stocks)
20%-------------trade size * 0.2--------------50 * 0.2 = 10 stocks
25%-------------trade size * 0.25-------------50 * 0.25 = 12.5(~13) stocks
34%-------------trade size * 0.34-------------50 * 0.34 = 17 stocks
40%-------------trade size * 0.4--------------50 * 0.4 = 20 stocks
50%-------------trade size * 0.5--------------50 * 0.5 = 25 stocks
60%-------------trade size * 0.6--------------50 * 0.6 = 30 stocks
66%-------------trade size * 0.66-------------50 * 0.66 = 33 stocks
75%-------------trade size * 0.75-------------50 * 0.75 = 37.5(~38) stocks
80%-------------trade size * 0.8--------------50 * 0.8 = 40 stocks
100%------------trade size--------------------50 = 50 stocks
-----------------------------------------------------------------------
If for any reason a portion of the current/remaining trade closed at such occurrence was slightly wrong, it is not an issue. Such occurrences are rare and with slight difference in partial TP closed is not significant to overall performance of our algorithms.
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
===========================================================================
Alert Settings (you don’t have to touch this section unless you will be using TradingView alerts through a Webhook to use with trading bot)
---------------------------------------------------------------------------
Here is how a LONG OPEN alert looks like.
NOTE: Each label , , etc. is customizable, you can change the text of it within indicator Input settings.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: OPEN
ENTRY: 20000
TP1: 20500
TP2: 21000
TP3: 21500
TP4: 22500
TP5: 23500
SL: 19000
Leverage: 0
---------------------------------------------------------------------------
Here is how a TP1 alert will look with 5 TPs breakdown of the trade.
NOTE1: Next to TP1 taken it will show at which price it was triggered.
NOTE2: Next to "TP Percentage" it shows how much of the CURRENT/ACTIVE/REMAINING trade needs to be closed.
NOTE2: If TP2/3/4/5 comes before TP1 - the alert will tell you exactly how many percent of the trade needs to be closed!
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: TP1
TP1: 20500
TP Percentage: 20%
---------------------------------------------------------------------------
Here is how an alert will look for LONG - STOP-LOSS.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
ENTRY: 20000
LONG: SL
SL: 19000
---------------------------------------------------------------------------
Here is how an alert will look for LONG - EOD (End of Day) In Profit close.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: EOD-Close (profit)
ENTRY: 20000
EOD-Close: 21900
===========================================================================
Adding Alerts in TradngView
---------------------------------------------------------------------------
-Add indicator to chart and make sure the correct strategy is configured (check Backtesting results)
-Right-click anywhere on the TradingView chart
-Click on Add alert
-Condition: Select this indicator by it’s name
-Immediately below, change it to "alert() function calls only", as other wise there will be 2 alerts for every alert!
-Expiration: Open-ended (that may require higher tier TradingView account, otherwise the alert will need to be occasionally re-triggered)
-Alert name: Whatever you desire
-Hit “Create”
-Note: If you change ANY Settings within the indicator – you must DELETE the current alert and create a new one per steps above, otherwise it will continue triggering alerts per old Settings!
===========================================================================
If you have any questions or issues with the indicator, please message me directly via TradingView.
---------------------------------------------------------------------------
Good Luck! (NOTE: Trading is very risky, past performance is not necessarily indicative of future results, so please trade responsibly!)
---------------------------------------------------------------------------
NOTE: There seems to be a strange glitch when strategy is running live, it will show "double-take" take-profits labels on the chart. This is not affecting the script logic and backtesting results, if you simply change the timeframe real quick to something else then back - it will no longer show the duplicate orders... this must be some sort of a glitch as every alert was thoroughly tested to make sure everything is working!
[Round Numbers] Signal Clean Up Analysis with Backtest (TSO)Round Numbers NEW GEN indicator!
===========================================================================
===========================================================================
This is a full-cycle trading system indicator - it will show and alert each step of the trade from open to close. The algorithm here uses Round Numbers for generating signals, TP (Take Profit) and SL (Stop Loss) levels. Round numbers play big role in trading and can easily become strong support and resistance levels where price can bounce and go the opposite way or go through with a very nice run afterwards.
In addition there is a chained (NOTE: You can select several or ALL of the features, this is not limited to either one) signal cleanup and analysis approach with scheduling and alerting capabilities. Works with most popular timeframes: 1M, 3M, 5M, 15M, 30M, 1H, 4H, D.
NOTE: Every action of the trade is calculated on a confirmed closed candle bar state (barstate.isconfirmed), so the indicator will never repaint!
NOTE: At position open - there will be calculated Take-Profit and Stop-Loss targets, however each target is considered hit, when candle bar closes breaking that target, so Take-Profit and Stop-Loss when hit will slightly differ then what you see at trade/position open.
===========================================================================
===========================================================================
Round Numbers up|down unit setting and overall explanation
---------------------------------------------------------------------------
Round Number up|down unit: is the distance between round numbers on the chart. Since these round number levels are also used by the algorithm to open/close trades, it is important to set this setting to a logical number, which will correspond to an average price movement of the instrument.
Here are some examples for a few popular instruments on what will the default 1 round number unit correspond to and what would be suggested:
BTCUSD > $1 (this won't work for Bitcoin, try at least $100 - 100units)
SPY: > $1 (one of the best settings for SPY or QQQ, 50cents shows good results as well - 0.5units)
FOREX (all major pairs): > 10PIPs (that may be a bit small, unless scalping, try 50PIPs - 5units)
===========================================================================
===========================================================================
Explanation of all the Features | Strategy Configuration Guide | Indicator Settings | Signal Cleanup Analysis
---------------------------------------------------------------------------
>>> Customizable Backtesting for a specific date range, results via TradingView strategy, which includes “Deep Backtesting” for largest amounts of data on trading results.
>>> Trading Schedule with customizable trading daily time range, automatic closing/alert trades before Power Hour or right before market closes or leave it open until next day.
>>> 3 Trading Systems.
>>> Static/Dynamic/Trailing Take-Profit and Stop-Loss setups (HIGHLIGHT: Stop-Loss will be moved to Entry after TP1 is taken or a smart trailing Stop-Loss can be used with Stop-Loss dynamically following the trade to minimize risk).
>>> Single or Multiple profit targets (up to 5).
>>> Take-Profit customizable offset feature (set your Take-Profit targets slightly before everyone is expecting it!).
>>> Candle bar signal analysis (matching candle color, skip opposite structured and/or doji candle uncertain signals).
>>> Additional analysis of VWAP/EMA/ATR/EWO (Elliot Wave Oscillator)/Divergence MACD+RSI/Volume signal confirmation (clean up your chart with indicator showing only the best potential signals!).
>>> Advanced Alerts setup, which can be potentially setup with a trading bot over TradingView Webhook (NOTE: This will require advanced programming knowledge).
===========================================================================
Labels, plots, colors explanations:
---------------------------------------------------------------------------
>>>>> LONG open: green "house" looking arrow below candle bar.
>>>>> SHORT open: red "house" looking arrow above candle bar.
>>>>> LONG/SHORT take-profit target: green/red circles (multi-profit > TP2/3/4/5 smaller circles).
>>>>> LONG/SHORT stop-loss target: green/red + crosses.
>>>>> LONG/SHORT take-profit hits: green/red diamonds.
>>>>> LONG/SHORT stop-loss hits: green/red X-crosses.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (profitable trade): green/red squares.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (loss trade): green/red PLUS(+)-crosses.
===========================================================================
Date Range and Trading Schedule Settings
---------------------------------------------------------------------------
>>>>> Date Range: Select your start and/or end dates (uncheck “End” for indicator to show results up to the very moment and to use for LIVE trading) for backtesting results, if not using backtesting – uncheck “Start”/“End” to turn it off.
>>>>> Use TradingView “Strategy Tester” to see backtesting results
NOTE: If Strategy Tester does not show any results with Date Ranged fully unchecked, there may be an issue where a script opens a trade, but there is not enough TradingView power to set the Take-Profit and Stop-Loss and somehow an open trade gets stuck and never closes, so there are “no trades present”. In such case you will need to manually check “Start”/“End” dates or use “Depp Backtesting” feature!
>>>>> Trading Schedule: This is where you can setup Intraday Session or any custom session schedule you wish. Turn it ON. Select trading hours. Select EOD (End of Day) setting (NOTE: If it will be OFF, the indicator will assume you are holding your position open until next day!). Please note the EOD trade closure times with the 2 different Intraday close settings when turned on:
At Market Close:
1/3/5min > will close at 15:55pm ET
15min > will close at 15:45pm ET
30min > will close at 15:30pm ET
45min > will close at 15:45pm ET
60min > will close at 15:00pm ET
Before Power Hour:
1/3/5min > will close at 15:00pm ET
15min > will close at 15:00pm ET
30min > will close at 15:00pm ET
45min > will close at 15:00pm ET
60min > will close at 15:00pm ET
>>> Trading Systems: 1) "Open Until Closed by TP or SL": the signal will only open a trade if no trades are currently open/trunning, a trade can only be closed by Take Profit, Stop Loss or End of Day close (if turned on) | 2) "Open Until Closed by TP or SL + OCA": Same as 1), but if there is an opposite signal to the trade which is currently open > it will immediately be closed with new trade open or End of Day close (if turned on) | 3) "OCA (no TP or SL)": There are is Take Profit or Stop Loss, only an opposite signal will close current trade and open an opposite one or End of Day close (if turned on).
>>> Turn On/Off: Current Position SL + Opposite Position Open Signal on the same closing candle bar (If current trade hits Stop-Loss and at that same closing candle bar there is a signal for an opposite direction trade > indicator will close current position as Stop-Loss and immediately open an opposite position). NOTE: With this option turned on, there will be more trades, but not necessarily better results, since after Stop-Loss is hit, it may make sense to wait a little before opening an opposite trade, even if it matches the condition at the same time when Stop-Loss is hit, but sometimes it shows great results, so this setting/feature is included. NOTE: This setting only will work/make sense with TP and SL style/behavior both be set to "Fully Closed Candle"!
>>> Turn On/Off: Turn On/Off: Current Position REGULAR SL | Only the SL + Opposite Position Open will trigger if turned on, IF NOT - THERE WILL BE NO STOP-LOSS AT ALL!!! NOTE: It is very dangerous to trade without Stop-Loss!
>>>>> Signal Candle Bar consuming Take-Profits - position/trade signal candle bar is big enough to "consume"/close ahead the first TP setting > the signal can either be skipped, or all Take-Profit areas pushed ahead using smart formula)
>>>>> MULTIPROFIT | TP (Take-Profit) System: 1) Static – Once the trade is open, all Take-Profit target(s) are immediately calculated and set for the trade > once the target(s) is hit > trade will be partially closed (if candle bar closes beyond several Take-Profit targets > trade will be reduced accordingly to the amount of how many Take-Profit targets were hit) ||| 2) Dynamic – Once the trade is open, only the 1st Take-Profit target is calculated, once the 1st Take-Profit is hit > next Take-Profit distance is calculated based on the distance from trade Entry to where 1st Take-Profit was taken, once 2nd Take-Profit is taken > 3rd Take-Profit is calculated per same logic, these are good for price momentum as with price speeding up – profits increase as well!
>>>>> MULTIPROFIT: SL (stop loss) System | Static: SL is set at position open and remains such; Dynamic: Once ANY TP is taken > SL will be moved to Entry; Trailing: SL will be moved along the position (smart trailing stop-loss), at TP1 taken > SL moves to Entry, at TP2 taken > SL moves to TP1, at TP3 taken > SL moves to TP2 and so on.
>>>>> # of TPs (number of take profit targets): Just like it is named, this is where you select the number of Take-Profit targets for your trading system (NOTE: If "OCA (no TP or SL)" Trading System is selected, this setting won’t do anything, since there are no TP or SLs for that system).
>>>>> TP(s) offset: This is a special feature for all Take-Profit targets, where you can turn on a customizable offset, so that if the price is almost hitting the Take-Profit target, but never actually touches it > you will capture it. This is good to use with HHLL (Highest High Lowest Low), which is pretty much a Support/Resistance as often the price will nearly touch these strong areas and turn around…
===========================================================================
Dynamic/Static/Trailing Take-Profit and Stop-Loss visual examples:
---------------------------------------------------------------------------
1) Fully Static Take-Profit and Stop-Loss
This one is a fully static setup for both Take-Profit and Stop-Loss, you can also observe how trade is closed right before the Power Hour (trade can be closed right before Power Hour or right before Market Closes or left overnight as desired).
2) Static/Dynamic, Static Take-Profit and Dynamic Stop-Loss
You can see a static Take-Profit set at position open, while Stop-Loss moves to Entry once TP1 target is taken.
3) Static/Trailing, Static Take-Profit and Trailing Stop-Loss
In here with each Take-Profit taken, Stop-Loss moves along the trade to previous Take-Profit level, you can notice how stop-loss literally follows the trade and reduces the potential loss.
4) Dynamic/Trailing, Dynamic Take-Profit and Trailing Stop-Loss
See how Take-Profit distances increase with price momentum. Just like in previous example - Trailing Stop-Loss is following the trade and reducing the riks.
===========================================================================
Signal Analysis and Cleanup Settings
---------------------------------------------------------------------------
>>>>> Candle Analysis | Candle Color signal confirmation: If closed candle bar color does not match the signal direction > no trade will be open.
>>>>> Candle Analysis | Skip opposite candle signals: If closed candle bar color will match the signal direction, but candle structure will be opposite (for example: bearish green hammer, long high stick on top of a small green square) > no trade will be open.
>>>>> Candle Analysis | Skip doji candle signals: If closed candle bar will be the uncertain doji > no trade will be open.
>>>>> Divergence/Oscillator Analysis | EWO (Elliot Wave Oscillator) signal confirmation: LONG will only be open if at signal, EWO is green or will be at bullish slope (you can select which setting you desire), SHORT if EWO is red or will be at bearish slope.
>>>>> Divergence/Oscillator Analysis | VWAP signal confirmation: LONG will only be open if at signal, the price will be above VWAP, SHORT if below.
>>>>> Divergence/Oscillator Analysis | Moving Average signal confirmation: LONG will only be open if at signal, the price will be above selected Moving Average, SHORT if below.
>>>>> Divergence/Oscillator Analysis | ATR signal confirmation: LONG will only be open if at signal, the price will be above ATR, SHORT if below.
>>>>> Divergence/Oscillator Analysis | RSI + MACD signal confirmation: LONG will only be open if at signal, RSI + MACD will be bullish, SHORT if RSI + MACD will be bearish.
>>>>> Volume signal confirmation: LONG/SHORT will only be opened with strong Volume matching the signal direction, by default, strong Volume percentage is set to 150% and weak to 50%, but you can change it as you desire.
===========================================================================
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
TP System - VERY IMPORTANT INFO!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" - amount by which current trade/position needs to be reduced/partially closed/sold.
-------------------------------------------------------------------------------------------------------------------
TP System: Dynamic
"TP PERCENTAGE" - will always be the same amount (trade/position size divided by the # of take-profit(TP) targets) and percentage to be closed will always be of the ORIGINAL trade/position.
-------------------------------------------------------------------------------------------------------------------
TP System: Static
"TP PERCENTAGE" - will always be the same amount IF take-profit(TP) targets are hit 1-by-1 (TP1 > TP2 > TP3 > TP4 > TP5), otherwise it will vary and unless it is a 1st take-profit(TP1), the REMAINING trade/position size will always be smaller than original and therefore the percentage to be closed will always be of the REMAINING trade/position and NOT the original one!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" CheatSheet (these are the only percentages you may see)
-----------------------------------------------------------------------
TP PERCENTAGE---Close/Sell Amount-------------Example (trade size: 50 stocks)
20%-------------trade size * 0.2--------------50 * 0.2 = 10 stocks
25%-------------trade size * 0.25-------------50 * 0.25 = 12.5(~13) stocks
34%-------------trade size * 0.34-------------50 * 0.34 = 17 stocks
40%-------------trade size * 0.4--------------50 * 0.4 = 20 stocks
50%-------------trade size * 0.5--------------50 * 0.5 = 25 stocks
60%-------------trade size * 0.6--------------50 * 0.6 = 30 stocks
66%-------------trade size * 0.66-------------50 * 0.66 = 33 stocks
75%-------------trade size * 0.75-------------50 * 0.75 = 37.5(~38) stocks
80%-------------trade size * 0.8--------------50 * 0.8 = 40 stocks
100%------------trade size--------------------50 = 50 stocks
-----------------------------------------------------------------------
If for any reason a portion of the current/remaining trade closed at such occurrence was slightly wrong, it is not an issue. Such occurrences are rare and with slight difference in partial TP closed is not significant to overall performance of our algorithms.
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
Alert Settings (you don’t have to touch this section unless you will be using TradingView alerts through a Webhook to use with trading bot)
---------------------------------------------------------------------------
Here is how a LONG OPEN alert looks like.
NOTE: Each label , , etc. is customizable, you can change the text of it within indicator Input settings.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: OPEN
ENTRY: 20000
TP1: 20500
TP2: 21000
TP3: 21500
TP4: 22500
TP5: 23500
SL: 19000
Leverage: 0
---------------------------------------------------------------------------
Here is how a TP1 alert will look with 5 TPs breakdown of the trade.
NOTE1: Next to TP1 taken it will show at which price it was triggered.
NOTE2: Next to "TP Percentage" it shows how much of the CURRENT/ACTIVE/REMAINING trade needs to be closed.
NOTE2: If TP2/3/4/5 comes before TP1 - the alert will tell you exactly how many percent of the trade needs to be closed!
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: TP1
TP1: 20500
TP Percentage: 20%
---------------------------------------------------------------------------
Here is how an alert will look for LONG - STOP-LOSS.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
ENTRY: 20000
LONG: SL
SL: 19000
---------------------------------------------------------------------------
Here is how an alert will look for LONG - EOD (End of Day) In Profit close.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: EOD-Close (profit)
ENTRY: 20000
EOD-Close: 21900
===========================================================================
Adding Alerts in TradngView
---------------------------------------------------------------------------
-Add indicator to chart and make sure the correct strategy is configured (check Backtesting results)
-Right-click anywhere on the TradingView chart
-Click on Add alert
-Condition: Select this indicator by it’s name
-Immediately below, change it to "alert() function calls only", as other wise there will be 2 alerts for every alert!
-Expiration: Open-ended (that may require higher tier TradingView account, otherwise the alert will need to be occasionally re-triggered)
-Alert name: Whatever you desire
-Hit “Create”
-Note: If you change ANY Settings within the indicator – you must DELETE the current alert and create a new one per steps above, otherwise it will continue triggering alerts per old Settings!
===========================================================================
If you have any questions or issues with the indicator, please message me directly via TradingView.
---------------------------------------------------------------------------
Good Luck! (NOTE: Trading is very risky, past performance is not necessarily indicative of future results, so please trade responsibly!)
---------------------------------------------------------------------------
NOTE: There seems to be a strange glitch when strategy is running live, it will show "double-take" take-profits labels on the chart. This is not affecting the script logic and backtesting results, if you simply change the timeframe real quick to something else then back - it will no longer show the duplicate orders... this must be some sort of a glitch as every alert was thoroughly tested to make sure everything is working!
Bonsai BX (Backtester)In today's trading landscape, traders need precision and deep analytical tools to navigate the sea of strategies. The Bonsai Backtester is one such tool, meticulously designed to evaluate multiple trading strategies in an integrated manner.
═════════════════════════════════════════════════════════════════════════
🌳 Bonsai BX 🌳 Universal Strategy Testing
📘 Overview
A product of collaboration with the Bonsai community, this backtester is both a reflection of collective insights and a means to provide traders with data-driven insights on TradingView.
📌 Current Backtest
• Dataset: BTCUSD daily candles from Coinbase, starting from March 2015.
• Source Signals: The Bonsai indicator signals are employed for both long and short entries. These are directly visible on the publication chart.
• Trading Assumptions:
• Initial Capital: $1,000
• Maximum Position Size: 10% of equity per trade
• Stop Loss: 10% per position
• Commission: 0.1%
• Slippage: 100 ticks (1.00)
🛠 Key Features
The Bonsai BX is equipped with a range of features aimed at providing traders with a more comprehensive analysis environment:
Features on Chart
• External Indicator Adaptability: Easily incorporate signals from both built-in and custom TradingView indicators.
• Snapshot Table: Delivers on-the-spot insights into crucial strategy performance metrics, including equity, open profit, position size, and entry price. While these details are available in TradingView's 'Performance Summary' panel, we've integrated them directly onto the chart for a more streamlined and accessible viewing experience.
• Trade Labels: Visualize profit metrics for individual trades directly on the chart, allowing for a more immediate grasp of trade outcomes.
• Long & Short Behaviors: Modify long behaviors to either open new long positions while closing short ones, or simply to close short positions. Conversely, for short behaviors, opt to either initiate new short positions while closing any active long ones or simply close long positions.
• Multiple Signals Integration: The tool can currently handle up to three different external signals for long and short trades.
• Condition-based Initiation: Define whether longs and shorts are triggered when 'All Conditions Met' or just 'Any Single Condition Met'. This flexibility allows for a more nuanced trading approach. For example, if you're using a trade signal alongside the RSI, you can specify that a long position should only open when the trade signal is active and the RSI is below 30 at the same time. This lets you combine multiple signals or conditions for more precise trade initiation.
• TP & SL Customization:
• Single TP: Set a specific Take Profit percentage.
• SL: Define a Stop Loss percentage and choose between a standard or trailing stop.
• Trail From: Specify the starting point of the trailing stop, be it the breakeven point or a certain percentage.
• Interface Theme: Users can select between light and dark themes for their interface.
Performance and Trailing
🎛 Using Bonsai BX
1. Add it to your TradingView chart.
2. Adjust script parameters and settings. Integrate external indicator signals as needed.
3. Activate the backtester to refine trading strategies.
Backtester Settings Menu
🪝 Webhook (Beta)
The Webhook functionality, now in beta, augments the Bonsai BX utility. This feature offers a more intuitive method for users to direct webhooks to trading bots, exchanges, and brokers. It simplifies the process by eliminating the need to adjust JSON structures or other payload formats, making alert automation more accessible.
📜 Feedback & Community
The feedback from the Bonsai community has been instrumental in the tool's development and will continue to shape its evolution. As part of our commitment to adaptive, smart trading, this script will continually be updated to meet the ever-changing requirements of traders.
❗️ Disclaimer
Backtesting tools, including the Bonsai BX , simulate trading strategies based on historical data. The following key points should be kept in mind:
1. Past Performance is Not Predictive: While backtesting can offer insights, it's essential to understand that past performance does not guarantee or predict future results. Historical data might not account for future market changes or unforeseen events.
2. External Influences: Market outcomes can be significantly influenced by various external factors like geopolitical events, economic announcements, and sudden shifts in market sentiment. Such factors are often not considered in backtesting simulations.
3. Market Dynamics: Elements like market volatility, liquidity constraints, and slippage can drastically alter expected outcomes. These dynamics might not always be accurately represented in backtest simulations.
4. Limitations of Simulated Trades: Backtesting operates under the assumption that historical trends and patterns will replicate. However, market conditions evolve, and what worked in the past might not necessarily be viable in the future.
5. Informed Decisions: Always base your trading decisions on a mix of comprehensive research, current market analysis, and risk assessment. Relying solely on backtested results can lead to misconstrued perceptions and potential pitfalls.
Trading involves risks, and it's crucial to be fully informed and cautious before making any investment decisions. Always consider seeking advice from financial experts or professionals when in doubt.
Long-Only Opening Range Breakout (ORB) with Pivot PointsIntraday Trading Strategy: Long-Only Opening Range Breakout (ORB) with Pivot Points
Background:
Opening Range Breakout (ORB) is a popular long-only trading strategy that capitalizes on the early morning volatility in financial markets. It's based on the idea that the initial price movements during the first few minutes or hours of the trading day can set the tone for the rest of the session. The strategy involves identifying a price range within which the asset trades during the opening period and then taking long positions when the price breaks out to the upside of this range.
Pivot Points are a widely used technical indicator in trading. They represent potential support and resistance levels based on the previous day's price action. Pivot points are calculated using the previous day's high, low, and close prices and can help traders identify key price levels for making trading decisions.
How to Use the Script:
Initialization: This script is written in Pine Script, a domain-specific language for trading strategies on the TradingView platform. To use this script, you need to have access to TradingView.
Apply the Script: You can do this by adding it to your favorites, then selecting the script in the indicators list under favorites or by searching for it by name under community scripts.
Customize Settings: The script allows you to customize various settings through the TradingView interface. These settings include:
Opening Session: You can set the time frame for the opening session.
Max Trades per Day: Specify the maximum number of long trades allowed per trading day.
Initial Stop Loss Type: Choose between using a percentage-based stop loss or the previous candles low for stop loss calculations.
Stop Loss Percentage: If you select the percentage-based stop loss, specify the percentage of the entry price for the stop loss.
Backtesting Start and End Time: Set the time frame for backtesting the strategy.
Strategy Signals:
The script will display pivot points in blue (R1, R2, R3, R4, R5) and half-pivot points in gray (R0.5, R1.5, R2.5, R3.5, R4.5) on your chart.
The green line represents the opening range.
The script generates long (buy) signals based on specific conditions:
---The open price is below the opening range high (h).
---The current high price is above the opening range high.
---Pivot point R1 is above the opening range high.
---It's a long-only strategy designed to capture upside breakouts.
---It also respects the maximum number of long trades per day.
The script manages long positions, calculates stop losses, and adjusts long positions according to the defined rules.
Trailing Stop Mechanism
The script incorporates a dynamic trailing stop mechanism designed to protect and maximize profits for long positions. Here's how it works:
1. Initialization:
The script allows you to choose between two types of initial stop loss:
---Percentage-based: This option sets the initial stop loss as a percentage of the entry price.
---Previous day's low: This option sets the initial stop loss at the previous day's low.
2. Setting the Initial Stop Loss (`sl_long0`):
The initial stop loss (`sl_long0`) is calculated based on the chosen method:
---If "Percentage" is selected, it calculates the stop loss as a percentage of the entry price.
---If "Previous Low" is selected, it sets the stop loss at the previous day's low.
3. Dynamic Trailing Stop (`trail_long`):
The script then monitors price movements and uses a dynamic trailing stop mechanism (`trail_long`) to adjust the stop loss level for long positions.
If the current high price rises above certain pivot point levels, the trailing stop is adjusted upwards to lock in profits.
The trailing stop levels are calculated based on pivot points (`r1`, `r2`, `r3`, etc.) and half-pivot points (`r0.5`, `r1.5`, `r2.5`, etc.).
The script checks if the high price surpasses these levels and, if so, updates the trailing stop accordingly.
This dynamic trailing stop allows traders to secure profits while giving the position room to potentially capture additional gains.
4. Final Stop Loss (`sl_long`):
The script calculates the final stop loss level (`sl_long`) based on the following logic:
---If no position is open (`pos == 0`), the stop loss is set to zero, indicating there is no active stop loss.
---If a position is open (`pos == 1`), the script calculates the maximum of the initial stop loss (`sl_long0`) and the dynamic trailing stop (`trail_long`).
---This ensures that the stop loss is always set to the more conservative of the two values to protect profits.
5. Plotting the Stop Loss:
The script plots the stop loss level on the chart using the `plot` function.
It will only display the stop loss level if there is an open position (`pos == 1`) and it's not a new trading day (`not newday`).
The stop loss level is shown in red on the chart.
By combining an initial stop loss with a dynamic trailing stop based on pivot points and half-pivot points, the script aims to provide a comprehensive risk management mechanism for long positions. This allows traders to lock in profits as the price moves in their favor while maintaining a safeguard against adverse price movements.
End of Day (EOD) Exit:
The script includes an "End of Day" (EOD) exit mechanism to automatically close any open positions at the end of the trading day. This feature is designed to manage and control positions when the trading day comes to a close. Here's how it works:
1. Initialization:
At the beginning of each trading day, the script identifies a new trading day using the `is_newbar('D')` condition.
When a new trading day begins, the `newday` variable becomes `true`, indicating the start of a new trading session.
2. Plotting the "End of Day" Signal:
The script includes a plot on the chart to visually represent the "End of Day" signal. This is done using the `plot` function.
The plot is labeled "DayEnd" and is displayed as a comment on the chart. It signifies the EOD point.
3. EOD Exit Condition:
When the script detects that a new trading day has started (`newday == true`), it triggers the EOD exit condition.
At this point, the script proceeds to close all open positions that may have been active during the trading day.
4. Closing Open Positions:
The `strategy.close_all` function is used to close all open positions when the EOD exit condition is met.
This function ensures that any remaining long positions are exited, regardless of their current profit or loss.
The function also includes an `alert_message`, which can be customized to send an alert or notification when positions are closed at EOD.
Purpose of EOD Exit
The "End of Day" exit mechanism serves several essential purposes in the trading strategy:
Risk Management: It helps manage risk by ensuring that positions are not left open overnight when markets can experience increased volatility.
Capital Preservation: Closing positions at EOD can help preserve trading capital by avoiding potential adverse overnight price movements.
Rule-Based Exit: The EOD exit is rule-based and automatic, ensuring that it is consistently applied without emotions or manual intervention.
Scalability: It allows the strategy to be applied to various markets and timeframes where EOD exits may be appropriate.
By incorporating an EOD exit mechanism, the script provides a comprehensive approach to managing positions, taking profits, and minimizing risk as each trading day concludes. This can be especially important in volatile markets like cryptocurrencies, where overnight price swings can be significant.
Backtesting: The script includes a backtesting feature that allows you to test the strategy's performance over historical data. Set the start and end times for backtesting to see how the long-only strategy would have performed in the past.
Trade Execution: If you choose to use this script for live trading, make sure you understand the risks involved. It's essential to set up proper risk management, including position sizing and stop loss orders.
Monitoring: Monitor the long-only strategy's performance over time and be prepared to make adjustments as market conditions change.
Disclaimer: Trading carries a risk of capital loss. This script is provided for educational purposes and as a starting point for your own long-only strategy development. Always do your own research and consider seeking advice from a qualified financial professional before making trading decisions.
[Camarilla Pivots] Signal Clean Up Analysis with Backtest (TSO)Camarilla Pivots NEW GEN Indicator!
This is a full-cycle trading system indicator, which uses Camarilla Pivots for generating signals using a custom developed algorithm, TP (Take Profit) and SL (Stop Loss) levels. There are 3 SOURCES for signals (each can be used separately or in combination or all 3 can be used at the same time, each signal SOURCE is using Camarilla Pivots levels to open optimal trade direction) with chained (NOTE: There are many potential profitable setups available, by combining clean up features availabe in the indicator settings!) signal cleanup and analysis approach with scheduling and alerting capabilities. Works best with shorter timeframes: 1M, 5M, 15M, 1H.
NOTE: Every calculation is done on a confirmed closed candle bar state, so the indicator will never repaint!
NOTE: At position open - there will be calculated Take-Profit and Stop-Loss targets, however each target is considered hit, when candle bar closes breaking that target, so Take-Profit and Stop-Loss when hit will slightly differ then what you see at position open!
===========================================================================
Explanation of all the Features | Configuration Guide | Indicator Settings | Signal Cleanup Analysis
---------------------------------------------------------------------------
>>> Customizable Backtesting for a specific date range, results via TradingView strategy, which includes “Deep Backtesting” for largest amounts of data on trading results.
>>> Trading Schedule with customizable trading daily time range, automatic closing/alert trades before Power Hour or right before market closes or leave it open until next day.
>>> 3 Trading Systems.
>>> Multiple Signal SOURCEs for opening trades, either SOURCE can be used or both at the same time!
>>> Static/Dynamic Stop-Loss setups (HIGHLIGHT: Stop-Loss will be moved to Entry after TP1 is taken, which minimizes risk).
>>> Single or Multiple profit targets (up to 5).
>>> Take-Profit customizable offset feature (set your Take-Profit targets slightly before everyone is expecting it!).
>>> Candle bar signal analysis (matching candle color, skip opposite structured and/or doji candle uncertain signals).
>>> Additional analysis of VWAP/EMA/ATR/EWO (Elliot Wave Oscillator)/Divergence MACD+RSI/Volume signal confirmation (clean up your chart with indicator showing only the best potential signals!).
>>> Advanced Alerts setup, which can be potentially setup with a trading bot over TradingView Webhook (NOTE: This will require advanced programming knowledge).
===========================================================================
Labels, plots, colors explanations:
---------------------------------------------------------------------------
>>>>> LONG open: green "house" looking arrow below candle bar.
>>>>> SHORT open: red "house" looking arrow above candle bar.
>>>>> LONG/SHORT take-profit target: green/red circles (multi-profit > TP2/3/4/5 smaller circles).
>>>>> LONG/SHORT stop-loss target: green/red + crosses.
>>>>> LONG/SHORT take-profit hits: green/red diamonds.
>>>>> LONG/SHORT stop-loss hits: green/red X-crosses.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (profitable trade): green/red squares.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (loss trade): green/red PLUS(+)-crosses.
===========================================================================
Date Range and Trading Schedule Settings
---------------------------------------------------------------------------
>>>>> Date Range: Select your start and/or end dates (uncheck “End” for indicator to show results up to the very moment and to use for LIVE trading) for backtesting results, if not using backtesting – uncheck “Start”/“End” to turn it off.
>>>>> Use TradingView “Strategy Tester” to see backtesting results
NOTE: If Strategy Tester does not show any results with Date Ranged fully unchecked, there may be an issue where a script opens a trade, but there is not enough TradingView power to set the Take-Profit and Stop-Loss and somehow an open trade gets stuck and never closes, so there are “no trades present”. In such case you will need to manually check “Start”/“End” dates or use “Depp Backtesting” feature!
>>>>> Trading Schedule: This is where you can setup Intraday Session or any custom session schedule you wish. Turn it ON. Select trading hours. Select EOD (End of Day) setting (NOTE: If it will be OFF, the indicator will assume you are holding your position open until next day!). Please note the EOD trade closure times with the 2 different Intraday close settings when turned on:
At Market Close:
1/3/5min > will close at 15:55pm ET
15min > will close at 15:45pm ET
30min > will close at 15:30pm ET
45min > will close at 15:45pm ET
60min > will close at 15:00pm ET
Before Power Hour:
1/3/5min > will close at 15:00pm ET
15min > will close at 15:00pm ET
30min > will close at 15:00pm ET
45min > will close at 15:00pm ET
60min > will close at 15:00pm ET
>>> Trading Systems: 1) "Open Until Closed by TP or SL": the signal will only open a trade if no trades are currently open/trunning, a trade can only be closed by Take Profit, Stop Loss or End of Day close (if turned on) | 2) "Open Until Closed by TP or SL + OCA": Same as 1), but if there is an opposite signal to the trade which is currently open > it will immediately be closed with new trade open or End of Day close (if turned on) | 3) "OCA (no TP or SL)": There are is Take Profit or Stop Loss, only an opposite signal will close current trade and open an opposite one or End of Day close (if turned on).
>>> Position Open sources:
>>>>> Position Open - SOURCE1 | LONG: S3, SL: S4, TP1: R3, TP2: R4, TP3: R5, TP4/5: Smart Formula | SHORT: R3, SL: R4, TP1: S3, TP2: S4, TP3: S5, TP4/5: Smart Formula
>>>>> Position Open - SOURCE2 | LONG: R4, SL: R3, TP1: R5, TP2/3/4/5: Smart Formula | SHORT: S4, SL: S3, TP1: S5, TP2/3/4/5: Smart Formula
>>>>> Position Open - SOURCE3 | LONG: R5, SL: R4, TP1/2/3/4/5: Smart Formula | SHORT: S5, SL: S4, TP1/2/3/4/5: Smart Formula
>>> Turn On/Off: Current Position SL + Opposite Position Open Signal on the same closing candle bar (If current trade hits Stop-Loss and at that same closing candle bar there is a signal for an opposite direction trade > indicator will close current position as Stop-Loss and immediately open an opposite position). NOTE: With this option turned on, there will be more trades, but not necessarily better results, since after Stop-Loss is hit, it may make sense to wait a little before opening an opposite trade, even if it matches the condition at the same time when Stop-Loss is hit, but sometimes it shows great results, so this setting/feature is included.
>>> Turn On/Off: Turn On/Off: Current Position REGULAR SL | Only the SL + Opposite Position Open will trigger if turned on, IF NOT - THERE WILL BE NO STOP-LOSS AT ALL!!! NOTE: It is very dangerous to trade without Stop-Loss!
>>>>> Signal Candle Bar consuming Take-Profits - position/trade signal candle bar is big enought to "consume"/close ahead the first TP setting > the signal can either be skipped, or all Take-Profit areas pushed ahead using smart formula)
>>>>> MULTIPROFIT | TP (Take-Profit) System: Once the trade is open, all Take-Profit target(s) are immediately calculated and set for the trade > once the target(s) is hit > trade will be partially closed (if candle bar closes beyond several Take-Profit targets > trade will be reduced accordingly to the amount of how many Take-Profit targets were hit)
>>>>> MULTIPROFIT | SL (Stop-Loss) System: 1) Static – Once the trade is open, Stop-Loss is calculated and set for the remaining of the trade ||| 2) Dynamic – At trade open, Stop-Loss is calculated and set the same way, however once 1st Take-Profit is taken > Stop-Loss is moved to Entry, reducing the risk.
>>>>> # of TPs (number of take profit targets): Just like it is named, this is where you select the number of Take-Profit targets for your trading system (NOTE: If "OCA (no TP or SL)" Trading System is selected, this setting won’t do anything, since there are no TP or SLs for that system).
>>>>> TP(s) offset: This is a special feature for all Take-Profit targets, where you can turn on a customizable offset, so that if the price is almost hitting the Take-Profit target, but never actually touches it > you will capture it. This is good to use with HHLL (Highest High Lowest Low), which is pretty much a Support/Resistance as often the price will nearly touch these strong areas and turn around…
===========================================================================
Signal Analysis and Cleanup Settings
---------------------------------------------------------------------------
>>>>> Candle Analysis | Candle Color signal confirmation: If closed candle bar color does not match the signal direction > no trade will be open.
>>>>> Candle Analysis | Skip opposite candle signals: If closed candle bar color will match the signal direction, but candle structure will be opposite (for example: bearish green hammer, long high stick on top of a small green square) > no trade will be open.
>>>>> Candle Analysis | Skip doji candle signals: If closed candle bar will be the uncertain doji > no trade will be open.
>>>>> Divergence/Oscillator Analysis | EWO (Elliot Wave Oscillator) signal confirmation: LONG will only be open if at signal, EWO is green or will be at bullish slope (you can select which setting you desire), SHORT if EWO is red or will be at bearish slope.
>>>>> Divergence/Oscillator Analysis | VWAP signal confirmation: LONG will only be open if at signal, the price will be above VWAP, SHORT if below.
>>>>> Divergence/Oscillator Analysis | Moving Average signal confirmation: LONG will only be open if at signal, the price will be above selected Moving Average, SHORT if below.
>>>>> Divergence/Oscillator Analysis | ATR signal confirmation: LONG will only be open if at signal, the price will be above ATR, SHORT if below.
>>>>> Divergence/Oscillator Analysis | RSI + MACD signal confirmation: LONG will only be open if at signal, RSI + MACD will be bullish, SHORT if RSI + MACD will be bearish.
>>>>> Volume signal confirmation: LONG/SHORT will only be opened with strong Volume matching the signal direction, by default, strong Volume percentage is set to 150% and weak to 50%, but you can change it as you desire.
===========================================================================
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
TP System - VERY IMPORTANT INFO!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" - amount by which current trade/position needs to be reduced/partially closed/sold.
-------------------------------------------------------------------------------------------------------------------
TP System: Dynamic
"TP PERCENTAGE" - will always be the same amount (trade/position size divided by the # of take-profit(TP) targets) and percentage to be closed will always be of the ORIGINAL trade/position.
-------------------------------------------------------------------------------------------------------------------
TP System: Static
"TP PERCENTAGE" - will always be the same amount IF take-profit(TP) targets are hit 1-by-1 (TP1 > TP2 > TP3 > TP4 > TP5), otherwise it will vary and unless it is a 1st take-profit(TP1), the REMAINING trade/position size will always be smaller than original and therefore the percentage to be closed will always be of the REMAINING trade/position and NOT the original one!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" CheatSheet (these are the only percentages you may see)
-----------------------------------------------------------------------
TP PERCENTAGE---Close/Sell Amount-------------Example (trade size: 50 stocks)
20%-------------trade size * 0.2--------------50 * 0.2 = 10 stocks
25%-------------trade size * 0.25-------------50 * 0.25 = 12.5(~13) stocks
34%-------------trade size * 0.34-------------50 * 0.34 = 17 stocks
40%-------------trade size * 0.4--------------50 * 0.4 = 20 stocks
50%-------------trade size * 0.5--------------50 * 0.5 = 25 stocks
60%-------------trade size * 0.6--------------50 * 0.6 = 30 stocks
66%-------------trade size * 0.66-------------50 * 0.66 = 33 stocks
75%-------------trade size * 0.75-------------50 * 0.75 = 37.5(~38) stocks
80%-------------trade size * 0.8--------------50 * 0.8 = 40 stocks
100%------------trade size--------------------50 = 50 stocks
-----------------------------------------------------------------------
If for any reason a portion of the current/remaining trade closed at such occurrence was slightly wrong, it is not an issue. Such occurrences are rare and with slight difference in partial TP closed is not significant to overall performance of our algorithms.
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
Alert Settings (you don’t have to touch this section unless you will be using TradingView alerts through a Webhook to use with trading bot)
---------------------------------------------------------------------------
Here is how a LONG OPEN alert looks like.
NOTE: Each label , , etc. is customizable, you can change the text of it within indicator Input settings.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: OPEN
ENTRY: 20000
TP1: 20500
TP2: 21000
TP3: 21500
TP4: 22500
TP5: 23500
SL: 19000
Leverage: 0
---------------------------------------------------------------------------
Here is how a TP1 alert will look with 5 TPs breakdown of the trade.
NOTE1: Next to TP1 taken it will show at which price it was triggered.
NOTE2: Next to "TP Percentage" it shows how much of the CURRENT/ACTIVE/REMAINING trade needs to be closed.
NOTE2: If TP2/3/4/5 comes before TP1 - the alert will tell you exactly how many percent of the trade needs to be closed!
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: TP1
TP1: 20500
TP Percentage: 20%
---------------------------------------------------------------------------
Here is how an alert will look for LONG - STOP-LOSS.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
ENTRY: 20000
LONG: SL
SL: 19000
---------------------------------------------------------------------------
Here is how an alert will look for LONG - EOD (End of Day) In Profit close.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: EOD-Close (profit)
ENTRY: 20000
EOD-Close: 21900
===========================================================================
Adding Alerts in TradngView
---------------------------------------------------------------------------
-Add indicator to chart and make sure it is configured (check back-testing results)
-Right-click anywhere on the TradingView chart
-Click on Add alert
-Condition: Select this indicator by it’s name
-Alert name: Whatever you want
-Hit “Create”
-Note: If you change ANY Settings within the indicator – you must DELETE the current alert and create a new one per steps above, otherwise it will continue triggering alerts per old Settings!
===========================================================================
If you have any questions or issues with the indicator, please message me directly via TradingView.
---------------------------------------------------------------------------
Good Luck! (NOTE: Trading is very risky, past performance is not necessarily indicative of future results, so please trade responsibly!)
---------------------------------------------------------------------------
NOTE: There seems to be a strange glitch when strategy is running live, it will show "double-take" take-profits labels on the chart. This is not affecting the script logic and backtesting results, if you will remove/re-add the script afterwards, it will no longer show the duplicate orders... this must be some sort of a glitch as every alert was thoroughly tested to make sure everything is working!
[Volume Profile] Signal Clean Up Analysis with Backtest (TSO) This is a full-cycle trading system indicator, which uses Volume Profile for generating signals using a custom developed algorithm, TP (Take Profit) and SL (Stop Loss) levels. There are 2 SOURCES for signals (each can be used separately or both can be used at the same time, each signal SOURCE is using Volume Profile levels to open optimal trade direction) with chained (NOTE: You can select several or ALL of the features, this is not limited to either one) signal cleanup and analysis approach with scheduling and alerting capabilities. Works with most popular timeframes: 1M, 5M, 15M, 1H, 4H, D, great for intraday trading!
NOTE: Every calculation is done on a confirmed closed candle bar state, so the indicator will never repaint!
===========================================================================
Explanation of all the Features | Configuration Guide | Indicator Settings | Signal Cleanup Analysis
---------------------------------------------------------------------------
>>> Customizable Backtesting for a specific date range, results via TradingView strategy, which includes “Deep Backtesting” for largest amounts of data on trading results.
>>> Trading Schedule with customizable trading daily time range, automatic closing/alert trades before Power Hour or right before market closes or leave it open until next day.
>>> 3 Trading Systems.
>>> Multiple Signal SOURCEs for opening trades, either SOURCE can be used or both at the same time!
>>> Static/Dynamic Stop-Loss setups (HIGHLIGHT: Stop-Loss will be moved to Entry after TP1 is taken, which minimizes risk).
>>> Single or Multiple profit targets (up to 3).
>>> Take-Profit customizable offset feature (set your Take-Profit targets slightly before everyone is expecting it!).
>>> Candle bar signal analysis (matching candle color, skip opposite structured and/or doji candle uncertain signals).
>>> Additional analysis of VWAP/EMA/ATR/EWO (Elliot Wave Oscillator)/Divergence MACD+RSI/Volume signal confirmation (clean up your chart with indicator showing only the best potential signals!).
>>> Advanced Alerts setup, which can be potentially setup with a trading bot over TradingView Webhook (NOTE: This will require advanced programming knowledge).
===========================================================================
Labels, plots, colors explanations:
---------------------------------------------------------------------------
>>>>> Signal SOURCE(s): Green/Red arrows, which will be shown unconditionally, outside of trade engine and can be hidden if desired.
>>>>> LONG open: green "house" looking arrow below candle bar.
>>>>> SHORT open: red "house" looking arrow above candle bar.
>>>>> LONG/SHORT take-profit target: green/red circles (multi-profit > TP2/3/4/5 smaller circles).
>>>>> LONG/SHORT take-profit hits: green/red diamonds.
>>>>> LONG/SHORT stop-loss target: green/red + crosses.
>>>>> LONG/SHORT stop-loss hits: green/red X-crosses.
>>>>> LONG/SHORT EOD close (profitable trade): green/red squares.
>>>>> LONG/SHORT EOD close (loss trade): green/red PLUS(+)-crosses.
===========================================================================
Date Range and Trading Schedule Settings
---------------------------------------------------------------------------
>>>>> Date Range: Select your start and/or end dates (uncheck “End” for indicator to show results up to the very moment and to use for LIVE trading) for backtesting results, if not using backtesting – uncheck “Start”/“End” to turn it off.
>>>>> Use TradingView “Strategy Tester” to see backtesting results
NOTE: If Strategy Tester does not show any results with Date Ranged fully unchecked, there may be an issue where a script opens a trade, but there is not enough TradingView power to set the Take-Profit and Stop-Loss and somehow an open trade gets stuck and never closes, so there are “no trades present”. In such case you will need to manually check “Start”/“End” dates or use “Depp Backtesting” feature!
>>>>> Trading Schedule: This is where you can setup Intraday Session or any custom session schedule you wish. Turn it ON. Select trading hours. Select EOD (End of Day) setting (NOTE: If it will be OFF, the indicator will assume you are holding your position open until next day!).
>>> Trading Systems: 1) "Open Until Closed by TP or SL": the signal will only open a trade if no trades are currently open/trunning, a trade can only be closed by Take Profit, Stop Loss or End of Day close (if turned on) | 2) "Open Until Closed by TP or SL + OCA": Same as 1), but if there is an opposite signal to the trade which is currently open > it will immediately be closed with new trade open or End of Day close (if turned on) | 3) "OCA (no TP or SL)": There are is Take Profit or Stop Loss, only an opposite signal will close current trade and open an opposite one or End of Day close (if turned on)
>>>>> MULTIPROFIT | TP (Take-Profit) System: Once the trade is open, all Take-Profit target(s) are immediately calculated and set for the trade > once the target(s) is hit > trade will be partially closed (if candle bar closes beyond several Take-Profit targets > trade will be reduced accordingly to the amount of how many Take-Profit targets were hit)
>>>>> MULTIPROFIT | SL (Stop-Loss) System: 1) Static – Once the trade is open, Stop-Loss is calculated and set for the remaining of the trade ||| 2) Dynamic – At trade open, Stop-Loss is calculated and set the same way, however once 1st Take-Profit is taken > Stop-Loss is moved to Entry, reducing the risk.
>>>>> # of TPs (number of take profit targets): Just like it is named, this is where you select the number of Take-Profit targets for your trading system (NOTE: If "OCA (no TP or SL)" Trading System is selected, this setting won’t do anything, since there are no TP or SLs for that system).
>>>>> TP(s) offset: This is a special feature for all Take-Profit targets, where you can turn on a customizable offset, so that if the price is almost hitting the Take-Profit target, but never actually touches it > you will capture it. This is good to use with HHLL (Highest High Lowest Low), which is pretty much a Support/Resistance as often the price will nearly touch these strong areas and turn around…
===========================================================================
Take-Profit and Stop-Loss visual example:
---------------------------------------------------------------------------
1) A simply nice intraday trading day for SPY (S&P500 ETF TRUST) with a single Take-Profit target on each trade.
See how Take-Profit distances increase with price momentum and how Stop-Loss is following the trade reducing the risk!
2) Same intraday trading day for SPY (S&P500 ETF TRUST) with 3 Take-Profit targets with static Stop-Loss.
3) Same intraday trading day for SPY (S&P500 ETF TRUST) with 3 Take-Profit targets with dynamic Stop-Loss.
You can see how Stop-Loss was moved once TP1 is taken!
===========================================================================
Trade Analysis and Cleanup Settings
---------------------------------------------------------------------------
>>>>> Candle Analysis | Candle Color signal confirmation: If closed candle bar color does not match the signal direction > no trade will be open.
>>>>> Candle Analysis | Skip opposite candle signals: If closed candle bar color will match the signal direction, but candle structure will be opposite (for example: bearish green hammer, long high stick on top of a small green square) > no trade will be open.
>>>>> Candle Analysis | Skip doji candle signals: If closed candle bar will be the uncertain doji > no trade will be open.
>>>>> Divergence/Oscillator Analysis | EWO (Elliot Wave Oscillator) signal confirmation: LONG will only be open if at signal, EWO is green or will be at bullish slope (you can select which setting you desire), SHORT if EWO is red or will be at bearish slope.
>>>>> Divergence/Oscillator Analysis | VWAP signal confirmation: LONG will only be open if at signal, the price will be above VWAP, SHORT if below.
>>>>> Divergence/Oscillator Analysis | Moving Average signal confirmation: LONG will only be open if at signal, the price will be above selected Moving Average, SHORT if below.
>>>>> Divergence/Oscillator Analysis | ATR signal confirmation: LONG will only be open if at signal, the price will be above ATR, SHORT if below.
>>>>> Divergence/Oscillator Analysis | RSI + MACD signal confirmation: LONG will only be open if at signal, RSI + MACD will be bullish, SHORT if RSI + MACD will be bearish.
>>>>> Volume signal confirmation: LONG/SHORT will only be open if closing candle volume is 150% above average Volume based on the Volume Length.
===========================================================================
Alert Settings (you don’t have to touch this section unless you will be using TradingView alerts through a Webhook to use with trading bot)
---------------------------------------------------------------------------
Here is how a LONG OPEN alert looks like (each label is customizable + I can add up more items/labels if needed):
COIN: BTCUSD
TIMEFRAME: 15M
LONG: OPEN
ENTRY: 20000
TP1: 20500
TP2: 21000
TP3: 21500
SL: 19000
Leverage: 0
===========================================================================
Adding Alerts in TradngView
---------------------------------------------------------------------------
-Right-click anywhere on the TradingView chart
-Click on Add alert
-Condition: Select this indicator by it’s name
-Alert name: Whatever you want
-Hit “Create”
-Note: If you change ANY Settings within the indicator – you must DELETE the current alert and create a new one per steps above, otherwise it will continue triggering alerts per old Settings!
===========================================================================
If you have any questions or issues with the indicator, please message me directly via TradingView.
---------------------------------------------------------------------------
Good Luck! (NOTE: Trading is very risky, past performance is not necessarily indicative of future results, so please trade responsibly!)
METRIC-TREND-TRADERThis script is a Fully Automated trading script meant to be used with "Oanda" broker and the plug-ins for algorithmic trading automation.( FOREX ONLY)
This script is meant to capture "TREND FOLLOWING " for intraday charts (1hour) preferably and will hold for days / weeks .trading on forex markets.
(The combination of indicators includes a short high and low price channel and a longer term high and low price channel)
This script is original in description as being automated to try and capture dynamic trending markets with both long and short fractal price channels. although trend trading is not an original concept. trend trading with this dynamic indicator allows the user visualize both short term and longer term price action at the same time, helping to make better trading decisions. the channels are designed to buy breakouts in the direction of the longer term trend while trailing stop a built-in stop loss that allows normal market movement while attempting to lock in flexible profits.
The concept of this indicator is be able to quickly visualize trends by high lighting the large green areas beneath price "when trending long" which is the difference between the (user defined) short term lows and the (user defined) Long period price lows.
For "down trending" markets a large red area above price will be displayed and this is the difference between the (user defined) short term highs and the (user defined) long term highs.
This strategy uses a lower than reward profile to jump in direction of market moves for continuation,
(1 risk to 4 reward)
in the likelihood the instrument will continue (example) 200 pips before it reverts 50 pips in the counter direction.
This strategy should only be used in markets that you believe are "TRENDING" at the time of trading otherwise you risk trend trading a range market.
This script uses a (user defined period) of short term high and low price ( green/red color) and (user defined period) Long Term high and low price (green/red) chosen in the indicator settings menu.
The default parameters are 10 with a (minimum of 1 and maximum of 10000) for the short term channel and 50 with a (minimum of 1 and maximum of 10000) for the long term price channel , the default parameters = roughly 2 days "long term" and 10 hours "short term" of price action on the (1 hour) chart.
Strategy entries and exits , for Long trades the trade will be entered if the short term high crosses above the Long Term high and the Short term low is not equal to the Long term low . the trade will exit if profit or stop loss are hit or if the Short term low crosses under the long term low.
For Short trades the trade will enter short if , the short term low crosses under the long term low and the short term high is not equal to the long term high. the trade will exit if profit or stop loss are hit or the short term high crosses over the long term high
"The default parameters should be kept unless you fully understand the complete strategy"
There are two very important inputs to be selected at the user setting menu "Long Only " and "Short Only" if you are looking to place long trades only select "Long Only" or for short trades select " Short Only" it is not recommended to keep both selected as it will trade both sides!
When the trade is entered a red , a blue and green horizontal dotted line will appear on the chart.
the blue line is the strategy entry price , the red line is the stop loss price , and the green line is the take profit price . the colors will invert if the trade is long or short.
(Setting alerts should be done in the indicator settings menu, and the parameters you chose will determine the stop loss/target and the amount of "units = (position size)" you wish to trade for the (forex only) markets. using "alert() function calls only" is the only alert that should be used with this strategy.
(note : when "alert() function calls only" is set two messages will be sent, one closing any open position in the opposite direction and one placing the new order regardless if you are currently in a trade or not)
Trade targets , stoploss and trade position size are a user defined variables entered in the indicator settings menu. (target pips minimum 0 and a maximum of 1000)(stop pips minimum of 0 and maximum of 1000)
Back test date range is included in the script for back testing different data periods.
the back ground will be colored a transparent navy blue if the period you are looking trading is with in the date range( note: to place live trades the end date will need to be in the future)
this is also adjustable in the settings menu
The avoid spread filter is a user defined time in which the spread is typically higher than average, applying this filter avoids trades in the specified time. When this filter is applied there will be a transparent red back ground color in the specified time.
Back test default setting are equivocal to OANDA:USDJPY
at the time of this publication placing trades with the "Oanda" broker are as follows , USD units = 2000 equal 2000 USD position size . "Oanda" current leverage is 20 to 1 for this particular pair and commission is paid in spread (1.4) pips = 0.19 USD per trade , Margin required for the trade is 100.0 USD , Position sizing = 10% of a 1000 USD account.
OANDA:USDJPY
HTF star - trailingDescription:
The HTF - Stars (Highertimeframe Stars) Strategy Script is designed to explore the behavior of a strategy using multiple timeframes. This experimental script focuses on identifying star candle patterns on a chosen higher timeframe and capturing subsequent price movements on a lower timeframe. By leveraging the power of star candle patterns forming on a higher timeframe, this strategy aims to capture potential trading opportunities on a shorter timeframe.
Key Features:
Multiple Timeframe Analysis: The strategy script allows you to be on a lower timeframe while searching for star candle patterns on a higher timeframe using the security function. This approach enables you to take advantage of higher timeframe insights and potentially capture favorable price movements on a shorter timeframe.
Star Candle Pattern Detection: The script identifies star candle patterns on the chosen higher timeframe. After the candle closes, a buy or sell order is executed on the lower timeframe, signaling a potential trading opportunity based on the detected pattern.
Trailing Stop: The strategy utilizes a trailing stop feature to manage trades. The trailing stop is set at a specified ATR (Average True Range) distance above or below the candle closes. This mechanism allows you to capture potential profits if the price moves in the anticipated direction and then reverses.
Mean Reversion Potential: During backtesting, it was observed that shorting stars above the 360 MA (Moving Average) and taking long positions on stars below the 360 MA yielded the most profitable results in the current market conditions. This suggests that star candle patterns in this context may serve as potential mean reversion signals. However, user inputs allow for customization, enabling you to experiment with different trading approaches when a star candle is detected.
Backtesting Feature: The script includes a backtesting feature that uses a percentage of equity, with 1% of equity set as the default. It displays a table presenting various statistics about the strategy's performance, providing valuable insights into its historical results.
Adjustable User Inputs: The script offers multiple adjustable settings, each accompanied by tooltips explaining their functionality. This flexibility allows you to fine-tune the strategy according to your preferences and experiment with different parameters to optimize its performance.
Disclaimer:
The HTF - Stars Strategy Script is provided for experimental and educational purposes only. Trading in the financial markets involves risk, and you should only trade with funds that you can afford to lose. The information presented in this script does not constitute financial advice or investment recommendations. Always conduct your own research and due diligence before making any investment decisions. The creator of this script shall not be held responsible for any losses or damages incurred from the use of this script. Historical performance is not indicative of future results.
Please note that past performance is not necessarily indicative of future results. Trading the markets involves risk, and there is no guarantee that the strategy described will be profitable for you. It is important to thoroughly test the strategy, adapt it to your trading style, and use proper risk management techniques.
[SMA Cross + HHLL] Signal Clean Up Analysis with Backtest (TSO) This is a DEMO indicator with a simple 2 SMAs cross for signals + HHLL for TP/SL. It mainly demonstrates chained (NOTE: You can select several or ALL of the features, this is not limited to either one) signal cleanup and analysis approach with scheduling and alerting capabilities. Works with most popular timeframes: 1M, 5M, 15M, 1H, 4H, D.
===========================================================================
Here are some pre-set examples with nice Backtesting results (try em out!):
---------------------------------------------------------------------------
>>> Indexes – SPY (INTRADAY SETUP ): Timeframe: 5M | Trading Schedule: ON, 10:00-15:45 ET, EOD: At Market Close | Trading System: Open Until Closed by TP or SL | MULTIPROFIT: TP (take profit) System: Dynamic | MULTIPROFIT: SL (stop loss) System (This is only for “Dynamic” TP System ONLY!!!): Dynamic | # of TPs: 5 | Skip opposite candle types in signals, which are opposite to direction of candle color (for example: bearish green hammer) | Everything else: Default
>>> Bitcoin – BTCUSD (24/7 SETUP): Timeframe: 1H | Trading Schedule: OFF, End of Day (EOD): OFF | Trading System: Open Until Closed by TP or SL | MULTIPROFIT: TP (take profit) System: Dynamic | MULTIPROFIT: SL (stop loss) System (This is only for “Dynamic” TP System ONLY!!!): Dynamic | # of TPs: 3 | TP(s) Offset: on, TP(s) offset amount: 50 | ATR confirmation | Everything else: Default
===========================================================================
Explanation of all the Features | Configuration Guide | Indicator Settings
---------------------------------------------------------------------------
---------------------------------------------------------------------------
Signal cleanup analysis:
---------------------------------------------------------------------------
>>> Customizable Backtesting for a specific date range, results via TradingView strategy, which includes “Deep Backtesting” for largest amounts of data on trading results.
>>> Trading Schedule with customizable trading daily time range, automatic closing/alert trades before Power Hour or right before market closes or leave it open until next day.
>>> 3 Trading Systems.
>>> Static/Dynamic Take-Profit setups (HILIGHT: momentum catch dynamic Take-Profit approach).
>>> Static/Dynamic Stop-Loss setups (HIGHLIGHT: smart trailing Stop-Loss which minimizes risk).
>>> Single or Multiple profit targets (up to 5).
>>> Take-Profit customizable offset feature (set your Take-Profit targets slightly before everyone is expecting it!).
>>> Candle bar signal analysis (skip opposite structured and/or doji candle uncertain signals).
>>> Additional analysis of VWAP/EMA/ATR/EWO (Elliot Wave Oscillator)/Divergence MACD+RSI signal confirmation (clean up your chart with indicator showing only the best potential signals!).
>>> Advanced Alerts setup, which can be potentially setup with a trading bot over TradingView Webhook (NOTE: This will require advanced programming knowledge).
>>> Customize your signal SOURCE and your Take-Profit/Stop-Loss SOURCES as you desire.
===========================================================================
Labels, plots, colors explanations:
---------------------------------------------------------------------------
>>>>> Signal SOURCE: SMA crossings (green and red BIG circles) .
>>>>> Take-profit/Stop-loss SOURCE: HHLL (Highest High Lowest Low) .
>>>>> LONG open: green arrow below candle bar.
>>>>> SHORT open: red arrow above candle bar.
>>>>> LONG/SHORT take-profit target: green/red circles (multi-profit > TP2/3/4/5 smaller circles).
>>>>> LONG/SHORT take-profit hits: green/red diamonds.
>>>>> LONG/SHORT stop-loss target: green/red + crosses.
>>>>> LONG/SHORT stop-loss hits: green/red X-crosses.
>>>>> LONG/SHORT EOD close (profitable trade): green/red squares.
>>>>> LONG/SHORT EOD close (loss trade): green/red PLUS(+)-crosses.
===========================================================================
Date Range and Trading Schedule Settings
---------------------------------------------------------------------------
>>>>> Date Range: Select your start and/or end dates (uncheck “End” for indicator to show results up to the very moment and to use for LIVE trading) for backtesting results, if not using backtesting – uncheck “Start”/“End” to turn it off.
---------------------------------------------------------------------------
>>>>> Use TradingView “Strategy Tester” to see backtesting results
---------------------------------------------------------------------------
NOTE: If Strategy Tester does not show any results with Date Ranged fully unchecked, there may be an issue where a script opens a trade, but there is not enough TradingView power to set the Take-Profit and Stop-Loss and somehow an open trade gets stuck and never closes, so there are “no trades present”. In such case you will need to manually check “Start”/“End” dates or use “Depp Backtesting” feature!
---------------------------------------------------------------------------
>>>>> Trading Schedule: This is where you can setup Intraday Session or any custom session schedule you wish. Turn it ON. Select trading hours. Select EOD (End of Day) setting (NOTE: If it will be OFF, the indicator will assume you are holding your position open until next day!).
>>>>> Trading System: 1) Open Until Closed by TP or SL – once the trade is open, it can only be closed by Take-Profit, Stop-Loss or at EOD (if turned on) ||| 2) OCA – Opposite Trade will Open Closing Current Trade – Same as 1), except that when and if an OPPOSITE signal is received > indicator will close current trade immediately (profit or loss) and open a new one(NOTE: This will only happen with an OPPOSITE direction trade!) ||| 3) Open Until Opposite Signal or EOD (if turned on) – This approach is the simplest one, there are no Take-Profits or Stop-Losses, the trade is open until an OPPOSITE signal is received or until EOD (if turned on).
Take-Profit, Stop-Loss and Multi-Profit Settings
>>>>> MULTIPROFIT | TP (Take-Profit) System: 1) Static – Once the trade is open, all Take-Profit target(s) are immediately calculated and set for the trade > once the target(s) is hit > trade will be partially closed (if candle bar closes beyond several Take-Profit targets > trade will be reduced accordingly to the amount of how many Take-Profit targets were hit) ||| 2) Dynamic – Once the trade is open, only the 1st Take-Profit target is calculated, once the 1st Take-Profit is hit > next Take-Profit distance is calculated based on the distance from trade Entry to where 1st Take-Profit was taken, once 2nd Take-Profit is taken > 3rd Take-Profit is calculated per same logic, these are good for price momentum as with price speeding up – profits increase as well!
NOTE: Below 2 settings, each correspond to only 1 setting of the TP (Take-Profit) System, please pay attention to the above TP system setting before changing SL settings!
>>>>> MULTIPROFIT | SL (Stop-Loss) System : 1) Static – Once the trade is open, Stop-Loss is calculated and set for the remaining of the trade ||| 2) Dynamic – At trade open, Stop-Loss is calculated and set the same way, however once 1st Take-Profit is taken > Stop-Loss is moved to Entry, reducing the risk.
>>>>> MULTIPROFIT | SL (Stop-Loss) System : 1) Static - Once the trade is open, Stop-Loss is calculated and set for the remaining of the trade ||| 2) Dynamic – At trade open, Stop-Loss is calculated and set the same way, however with each Take-Profit taken, Stop-Loss will be moved to previous Take-Profit (TP1 taken > SL:Entry | TP2 taken > SL:TP1 | TP3 taken > SL:TP2 | TP4 taken > SL:TP3 | TP5 taken > trade closed), this is basically a smart Stop-Loss trailing system!
>>>>> # of TPs (number of take profit targets): Just like it is named, this is where you select the number of Take-Profit targets for your trading system (NOTE: If “3) Open Until Opposite Signal or EOD (if turned on)” Trading System is selected, this setting won’t do anything, since there are no TP or SLs for that system).
>>>>> TP(s) offset: This is a special feature for all Take-Profit targets, where you can turn on a customizable offset, so that if the price is almost hitting the Take-Profit target, but never actually touches it > you will capture it. This is good to use with HHLL (Highest High Lowest Low), which is pretty much a Support/Resistance as often the price will nearly touch these strong areas and turn around…
---------------------------------------------------------------------------
Dynamic/Static Take-Profit and Stop-Loss visual examples:
1) Fully Dynamic Take-Profit and Stop-Loss setup for BTCUSD
See how Take-Profit distances increase with price momentum and how Stop-Loss is following the trade reducing the risk!
2) Static/Dynamic, Static Take-Profit and Dynamic Stop-Loss setup for SPY (S&P500 ETF TRUST)
You can see a static Take-Profit set at position open, while Stop-Loss is semi-dynamic adjusting to Entry once TP1 target is taken!
3) Fully Static Take-Profit and Stop-Loss setup for SPY (S&P500 ETF TRUST)
This one is a fully static setup for both Take-Profit and Stop-Loss, you can also observe how trade is closed right before the Power Hour (trade can be closed right before Power Hour or right before Market Closes or left overnight as you desire).
---------------------------------------------------------------------------
Trade Analysis and Cleanup Settings
>>>>> Candle Analysis | Candle Color signal confirmation: If closed candle bar color does not match the signal direction > no trade will be open.
>>>>> Candle Analysis | Skip opposite candle signals: If closed candle bar color will match the signal direction, but candle structure will be opposite (for example: bearish green hammer, long high stick on top of a small green square) > no trade will be open.
>>>>> Candle Analysis | Skip doji candle signals: If closed candle bar will be the uncertain doji > no trade will be open.
>>>>> Divergence/Oscillator Analysis | EWO (Elliot Wave Oscillator) signal confirmation: LONG will only be open if at signal, EWO is green or will be at bullish slope (you can select which setting you desire), SHORT if EWO is red or will be at bearish slope.
>>>>> Divergence/Oscillator Analysis | VWAP signal confirmation: LONG will only be open if at signal, the price will be above VWAP, SHORT if below.
>>>>> Divergence/Oscillator Analysis | Moving Average signal confirmation: LONG will only be open if at signal, the price will be above selected Moving Average, SHORT if below.
>>>>> Divergence/Oscillator Analysis | ATR signal confirmation: LONG will only be open if at signal, the price will be above ATR, SHORT if below.
>>>>> Divergence/Oscillator Analysis | RSI + MACD signal confirmation: LONG will only be open if at signal, RSI + MACD will be bullish, SHORT if RSI + MACD will be bearish.
===========================================================================
Alert Settings (you don’t have to touch this section unless you will be using TradingView alerts through a Webhook to use with trading bot)
---------------------------------------------------------------------------
Here is how a LONG OPEN alert looks like (each label is customizable + I can add up more items/labels if needed):
COIN: BTCUSD
TIMEFRAME: 15M
LONG: OPEN
ENTRY: 20000
TP1: 20500
TP2: 21000
TP3: 21500
SL: 19000
Leverage: 0
===========================================================================
Trade Open Signal SOURCE + Take-Profit/Stop-Loss SOURCE
---------------------------------------------------------------------------
>>> Customize your signal SOURCE, Take-Profit and Stop-Loss SOURCE as desired (NOTE: These are pre-configured and should be usable on majority of markets, however feel free to play around with these settings as there is nearly an infinite amount of setups out there!
===========================================================================
Adding Alerts in TradngView
---------------------------------------------------------------------------
-Right-click anywhere on the TradingView chart
-Click on Add alert
-Condition: Select this indicator by it’s name
-Alert name: Whatever you want
-Hit “Create”
-Note: If you change ANY Settings within the indicator – you must DELETE the current alert and create a new one per steps above, otherwise it will continue triggering alerts per old Settings!
===========================================================================
If you have any questions or issues with the indicator, please message me directly via TradingView.
---------------------------------------------------------------------------
Good Luck! (NOTE: Trading is very risky, so please trade responsibly!)
FRAMA & CPMA Strategy [CSM]The script is an advanced technical analysis tool specifically designed for trading in financial markets, with a particular focus on the BankNifty market. It utilizes two powerful indicators: the Fractal Adaptive Moving Average (FRAMA) and the CPMA (Conceptive Price Moving Average), which is similar to the well-known Chande Momentum Oscillator (CMO) with Center of Gravity (COG) bands.
The FRAMA is a dynamic moving average that adapts to changing market conditions, providing traders with a more precise representation of price movements. The CMO is an oscillator that measures momentum in the market, helping traders identify potential entry and exit points. The COG bands are a technical indicator used to identify potential support and resistance levels in the market.
Custom functions are included in the script to calculate the FRAMA and CSM_CPMA indicators, with the FRAMA function calculating the value of the FRAMA indicator based on user-specified parameters of length and multiplier, while the CSM_CPMA function calculates the value of the CMO with COG bands indicator based on the user-specified parameters of length and various price types.
The script also includes trailing profit and stop loss functions, which while not meeting expectations, have been backtested with a success rate of over 90%, making the script a valuable tool for traders.
Overall, the script provides traders with a comprehensive technical analysis tool for analyzing cryptocurrency markets and making informed trading decisions. Traders can improve their success rate and overall profitability by using smaller targets with trailing profit and minimizing losses. Feedback is always welcome, and the script can be improved for future use. Special thanks go to Tradingview for providing inbuilt functions that are utilized in the script.
Yesterday’s High Breakout - Trend Following StrategyYesterday’s High Breakout it is a trading system based on the analysis of yesterday's highs, it works in trend-following mode therefore it opens a long position at the breakout of yesterday's highs even if they occur several times in one day.
There are several methods for exiting a trade, each with its own unique strategy. The first method involves setting Take-Profit and Stop-Loss percentages, while the second utilizes a trailing-stop with a specified offset value. The third method calls for a conditional exit when the candle closes below a reference EMA.
Additionally, operational filters can be applied based on the volatility of the currency pair, such as calculating the percentage change from the opening or incorporating a gap to the previous day's high levels. These filters help to anticipate or delay entry into the market, mitigating the risk of false breakouts.
In the specific case of NULS, a 9% Take-Profit and a 3% Stop-Loss were set, with an activated trailing-stop percentage. To postpone entry and avoid false breakouts, a 1% gap was added to the price of yesterday's highs.
Name : Yesterday's High Breakout - Trend Follower Strategy
Author : @tumiza999
Category : Trend Follower, Breakout of Yesterday's High.
Operating mode : Spot or Futures (only long).
Trade duration : Intraday.
Timeframe : 30M, 1H, 2H, 4H
Market : Crypto
Suggested usage : Short-term trading, when the market is in trend and it is showing high volatility.
Entry : When there is a breakout of Yesterday's High.
Exit : Profit target or Trailing stop, Stop loss or Crossunder EMA.
Configuration :
- Gap to anticipate or postpone the entry before or after the identified level
- Rate of Change for Entry Condition
- Take Profit, Stop Loss and Trailing Stop
- EMA length
Backtesting :
⁃ Exchange: BINANCE
⁃ Pair: NULSUSDT
⁃ Timeframe: 2H
⁃ Fee: 0.075%
⁃ Slippage: 1
- Initial Capital: 10000 USDT
- Position sizing: 10% of Equity
- Start : 2018-07-26 (Out Of Sample from 2022-12-23)
- Bar magnifier: on
Credits : LucF for Pine Coders (f_security function to avoid repainting using security)
Disclaimer : Risk Management is crucial, so adjust stop loss to your comfort level. A tight stop loss can help minimise potential losses. Use at your own risk.
How you or we can improve? Source code is open so share your ideas!
Leave a comment and smash the boost button!
Thanks for your attention, happy to support the TradingView community.
Super 8 - 30M BTCWelcome to Super 8, the ultimate automatic trading script for Pine!
This bad boy is designed to go both long and short, and it's equipped with all the tools you need to maximize your profits. Whether you're looking to take profit, set a trailing stop, or protect yourself with a stop loss, Super 8 has you covered.
But that's not all! Super 8 is also loaded with 8 powerful indicators to help you make informed decisions. We've got the EMA, ADX, SAR, MACD, VOLUME, BOLLINGER BANDS, DONCHIAN, and ATR all working together to give you the best possible trading experience.
And if you want to take it to the next level, Super 8 also has a feature that lets you use stepped entries in normal mode or incremental 1,2,3,... to improve your average price. Plus, if you're using trailing stop, you can activate the Backtest precision to use lower timeframes.
But what's in a name? Super 8 is called that because it's just that... super! It's tailored specifically for the OKX:BTCUSDT.P pair, so you know you're getting the best possible results. it's highly adjustable and can be used with any other pair. So no matter what market you're trading in, Super 8 has got you covered.
So if you want to level up your trading game, give Super 8 a try. You won't be disappointed.
Certain Risks of Live Algorithmic Trading:
Backtesting Cannot Assure Actual Results.
The relevant market might fail or behave unexpectedly.
Your broker may experience failures in its infrastructure, fail to execute your orders in a correct or timely fashion or reject your orders.
The system you use for generating trading orders, communicating those orders to your broker, and receiving queries and trading results from your broker may fail.
Time lag at various point in live trading might cause unexpected behavior.
The systems of third parties in addition to those of the provider from which we obtain various services, your broker, and the applicable securities market may fail or malfunction.
ATR_RSI_Strategy v2 with no repaint [liwei666]🎲 Overview
🎯 this is a optimized version based on ATR_RSI_Strategy with no-repaint.
Sharpe ratio: 1.4, trade times: 116 ,
trade symbol: BINANCE:BTCUSDTPERP 15M
you can get same backtesting result with the correct settings.
🎲 Strategy Logic
🎯 the core logic is quite simple, use ATR and RSI and SMA
1. when price is in high volatility ( atr_value > atr_ma);
2. wait for a break signal (rsi_value > rsi_buy or rsi_value < rsi_sell);
3. entry Long or Short,use trailing stop-loss to max security and percent TP to keep profit.
🎲 Settings
🎯 there are 7 input properties in script, but I only finetune 4 of them ( bold field below ),
you may change other parameter to get better result by yourself.
atr_length: length to get atr value
atr_ma_length : length of smoothing atr value
atr_ma_norm_min : atr_ma normalized min value, filter high volatility ranges
atr_ma_norm_max : atr_ma normalized max value, filter high volatility ranges
rsi_length : length to get rsi value
rsi_entry: 50 +/- rsi_entry to get entry threshold
trailing_percent: trailing stop-loss percent
🎲 Usage
🎯 the commission set to 0.05% , part of exchange the commission is less than 0.05% in reality,
but I will still use 0.05% in my next script.
🎯 this script use 50% of equity to size positions follow general script position,
you can adjust the value to fix size or 100% of equity to compare result with other strategy,
but I still suggest you use 5-10% of equity for each strategy in reality.
🎯any questions please comment below. if there are any words violate House Rule, please tell me below and i will revise immediately
don't want be hiddened again 😂😂
Additionally, I plan to publish 20 profitable strategies in 2023;
let‘s witness it together!
Hope this strategy will be usefull for you :)
enjoy! 🚀🚀🚀
[SPOILED]SuperTrench - ETH Super ScalperHi Traders,
I'm republishing this script as I finally polished it to perfection IMO. The script uses 5 coding sections: entry, trend filter, pivot filter, take profit, and stop loss. The script mainly uses trailing as take profit; this is probably the easiest way to make a profitable scalper strategy.
Backtest capital is set to 1000 USDT, 35% equity, 0.04% commission, limited backtest date from Jan 2022 to now, backtested on ETH/USDT prep contracts 15m timeframe, result as shown below.
It looks unreal right? Hell no, I actually tested this strategy on Binance from Dec 06 to Dec 10. I got 8.29% return with 4x leverage, 50% equity setup; 75% win rate,1.58 profit factor, with 4.3% max drawdown, it is amazingly close to the backtest result.
User Manual
Entry >>> Stoch RSI:
I added 5 MA types to the Stoch RSI which is HMA/VWMA/WMA/EMA/SMA, HMA with Length setting of 5, 8 seems to be most efficient, VWMA and WMA with 8, 13 will generate less entry signals but with less entry risks.
Entry >>> R Style:
It based on price action, with candlestick makes a U turn, after 2nd candlestick confirmed, it generates entry signal, this will give you some extra entries, better leave it enabled.
Entry >>> Price Step:
This probably is the core feature of this strategy; also my secret ingredient to making this strategy this efficient. It is recommended to enable step 1-5, more steps basically means more entries, but they are not necessarily profitable.
Trend Filter >>> Price Step:
I couldn't tell you much details about how this indicator works, but it is a reliable indicator, based on price action, and I got some ideas from Demark9 indicator. The bigger the level, the stronger the filter is, please note that if 'Price Step Entries' less than Price Step Trend, entries will be ignored.
Pivot Filter >>> RSI Pivot & Pinbar Pivot:
RSI Pivot detects if the RSI signal line making U turn in certain condition, Pinbar detection combines R Style entry when price action U turn took place, these 2 pivot filter will close the trade once it is counter trend, so it better enable and leave it as is.
Trend Filter >>> Trend Magic:
Trend Magic uses CCI and ATR to calculate trend status, green means uptrend, red means downtrend, pretty straight forward, the best value for this indicator would be, 21, 34, 55, 89.
Trend Filter >>> Alpha:
This filter combines R style pivot, price step, EMA all together to detects consolidation area, because EMA was involved, so the best look back period would be around 15-35, it is best to use default value IMO, in another hands, if you need stronger filter, feel free to use 10, 18, 20, 25, 30, 35, make sure look back period should increase or decrease by 5 every time.
Take Profit and Stop Loss:
The default value for tp is set to 0.4%, but I also give you option to switch to ATR TP; you can adjust in the ATR multiplier, default ATR trailing stop loss uses 1 ATR, but you can adjust it for better drawdown tolerance. Fixed ATR SL is also given when fixed ATR is enabled. There will be a failsafe SL default set to 1% if price moves counter direction of opened position, it will close trade no matter what happens.
Enjoy :)
Fast EMA above Slow EMA with MACD (by Coinrule)An exponential moving average ( EMA ) is a type of moving average (MA) that places a greater weight and significance on the most recent data points. The exponential moving average is also referred to as the exponentially weighted moving average . An exponentially weighted moving average reacts more significantly to recent price changes than a simple moving average simple moving average ( SMA ), which applies an equal weight to all observations in the period.
Moving average convergence divergence ( MACD ) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price. The MACD is calculated by subtracting the 26-period exponential moving average ( EMA ) from the 12-period EMA .
The result of that calculation is the MACD line. A nine-day EMA of the MACD called the "signal line," is then plotted on top of the MACD line, which can function as a trigger for buy and sell signals. Traders may buy the coin when the MACD crosses above its signal line and sell—or short—the security when the MACD crosses below the signal line. Moving average convergence divergence ( MACD ) indicators can be interpreted in several ways, but the more common methods are crossovers, divergences, and rapid rises/falls.
The Strategy enters and closes the trade when the following conditions are met:
LONG
The MACD histogram turns bullish
EMA8 is greater than EMA26
EXIT
Price increases 3% trailing
Price decreases 1% trailing
This strategy is back-tested from 1 January 2022 to simulate how the strategy would work in a bear market and provides good returns.
Pairs that produce very strong results include AXSUSDT on the 5-minute timeframe. This short timeframe means that this strategy opens and closes trades regularly.
Additionally, the trailing stop loss and take profit conditions can also be changed to match your needs.
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.
Ichimoku Cloud with MACD and Trailing Stop Loss (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/Exit 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
Exit Position:
Price increases 3% trailing
Price decreases 3% trailing
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.
FFT Strategy Bi-Directional Stop/Profit/Trailing + VMA + AroonThis strategy uses the Fast Fourier Transform inspired from the source code of @tbiktag for the Fast Fourier Transform & @lazybear for the VMA filter.
If you are not familiar with the Fast Fourier transform it is a variation of the Discrete Fourier Transform. Veritasium on youtube has a great video on it with a follow up recommendation from 3brown1blue. In short it will extract all the frequencies from a set of data. @tbiktag laid the groundwork for creating the indicator which will allow you to isolate only those signals which are the most relevant and remove the noise. I recommend having @tbiktag's FFT Transform indicator side by side with this to understand what my variation is doing by setting similar settings .
Using this idea, you can then optimize a strategy to the frequencies that are best. The main entry signal is when the FFT Signal crosses above or below the 0 line .
Included with this strategy is the ability to optionally bi-directionally set:
Stop Loss
Trailing Stop Loss
Take Profit
Trailing Take Profit
Entries are optionally further filtered by use of the VMA using the algorithm from LazyBear which allows you to adjust a variable moving average with 3 market trend detections. Green represents upwards momentum; Blue sideways trading and Red downwards momentum. The idea being to filter out buy or sell entries unless the market is moving in that direction, and this makes a big difference as you can see for yourself when you turn it off or on. Turning it off will change the color of the FFT signal to orange instead of the green, blue, red colors .
I have added 2 custom stop loss types as well for experimentation:
1. VMA Filter stop loss to exit the trade if the VMA detects a market trend direction change matching the rules you have set. I have set this to off by default, but it is there so you can see what affect it may have on other tickers. It can increase the profit factor but usually at a cost of net profit.
2. The Aroon Filter stop loss with different lengths for the short or long direction. For the Aroon strategy (which is a trend change detector) it is considered bullish if the upper line (green in my code) is above 70 and the lower line (red in my code) is below 30 and the opposite for the bearish case. With this in mind, I have set it to filter by default only the extreme ends (99 and 1) to increase profit factor and net profit but I encourage you to try different settings and see how it affects things. Turning this off yields much higher net profit but at the cost of the profit factor and drawdown . To disable this just uncheck the 'Use Aroon Filter Long' (or short) and it will also hide the aroon graphics and crosses on the plot.
I will be adding more features in an attempt to lower the drawdown on this strategy but I hope you enjoy what I have so far!
Trend Follower Intraday [ Adjustable TF ]Trend Follower Intraday for 3 minute Time-Frame (Adjustable) , that has the time condition for Indian Markets as well.
Unlike the Free Scripts - Risk Management , Position Sizing , Partial Exit etc. are also included .
Send us a Message to know more about the strategy.
// ══════════════════════════════════════════════════════════════════════════ //
The Timing can be changed to fit other markets, scroll down to "TIME CONDITION" to know more.
The commission is also included in the strategy .
The basic idea is when ,
1) EMA1 crosses above EMA2 , is a Long condition .
2) EMA1 crosses below EMA2 , is a Short condition .
3) Green Section indicates Long position.
4) Red Section indicates Short position.
5) Allowed hours specifies the trade entry timing.
6) ATR STOP is the stop-loss value on chart , can be adjusted in INPUTS.
7) Target 1 is the 1st target value on chart , can be adjusted in INPUTS.
8) RISK is Maximum Risk per trade for the intraday trade can be changed .
9) Total Capital used can be adjusted under INPUTS.
10) ATR TRAIL is used for trailing after entry, as mentioned in the inputs below.
11) Check trades under the list of trades .
12) Trade only in liquid stocks .
13) Risk only 1-5% of total capital.
14) Inputs can be changed for better back-test results, but also manually check the trades before setting alerts
15) SQUARE OFF TIME - As you change the time frame , also change the square-off time to the candle's closing time.
Eg: For 3min Time-frame , Hour = 2Hrs | Minute = 57min
16) Strategy stops for the day if you have a loss .
17) COMMISSION value is set to 20Rs and SLIPPAGE value is set to 2 . Go to properties to change it .
*The input values and the results are mentioned under "BACKTEST RESULTS" below*
// ══════════════════════════════ //
// ————————> RISK MANAGEMENT <——————— //
// ══════════════════════════════ //
Risk management is done based on max loss per trade and can be adjusted in the INPUTS.
// ═══════════════════════════ //
// ————————> POSITION SIZE <——————— //
// ═══════════════════════════ //
Quantity of each trade is different based on the loss
// ═════════════════════════ //
// ————————> PROPERTIES <——————— //
// ═════════════════════════ //
COMMISSION , SLIPPAGE ,RECALCULATE is already mentioned in the code.
COMMISSION can be charges , based on the broker charges.
// ═══════════════════════════════//
// ————————> TIME CONDITION <————————— //
// ═══════════════════════════════//
The time can be changed in the INPUT.
The Indian Markets open at 9:15am and closes at 3:30pm.
The 'Allowed hours' under Inputs specifies the time at which Entries should happen .
"Close All" function closes all the trades before 3pm , at the open of the next candle.
To change the time to close all trades , check INPUT.
All open trades get closed by 3pm , because some brokers don't allow you to place fresh intraday orders after 3pm .
// ═══════════════════════════════════════════════ //
// ————————> BACKTEST RESULTS ( 123 CLOSED TRADES ) <————————— //
// ═══════════════════════════════════════════════ //
INPUTS can be changed for better Back-Test results.
The strategy applied to NSE:JSWENERGY (3 min Time-Frame and with a capital of 3,00,000 ) gives us 81% profitability , as shown below
It was tested for a period a 6 months with a Profit Factor of 1.957 ,net Profit of 43,000Rs .
Sharpe Ratio = 0.745
Sortino Ratio = 2.091
No strategy in the world promises 100% profits in all market conditions , so always define your risk before trading.
Also check Back-Test results manually ,before setting Alerts
The Graph has a Linear Curve with Consistent Profits.
The INPUTS are as follows,
1) EMA1 ————————————————> 38
2) EMA2 ————————————————> 118
3) ALLOWED HRS ———————————> 9:35 TO 14:30
4) ATR STOP ——————————————> 3.2
5) RISK ——————————————————> 3000
6) ATR TRAIL ———————————————> 2.6
7) TARGET 1 ————————————————> 2.4
8) MAX POSITION VALUE ——————————> 3,00,000
8) MAX DRAWDOWN —————————————> 9,000
8) SQUARE-OFF ————————————————> 14:57
NSE:JSWENERGY
Apply it to your charts Now !
NSE:JSWENERGY
Send us a message for FREE TRIALS | Instant Access
Thank You ☺
Trailing Stop SnippetThis is an example snippet that should allow for adding a trailing stop and trailing stop activation to almost any script.
You can use it by setting a trailing stop alone. This will provide you standard trailing stop functionality allowing you to lock in profits and increase your stop-loss as the price moves in your direction.
You can also set the trailing stop activation to trigger the original trailing stop at a certain level. "Once price rises 5%, set a trailing stop at break even". This would be set as 5 and 5 in the settings.
[D] Dudu 95 Strategy Template ver.1.1.Hello Guys! Nice to meet you all!
This is my Second script after changing My Profile Name!
I updated my strategy template before - I added some filter conditions (EMA, ADX, DMI).
If there's something to update, I will update this script!
Thank you!
-----
I made this based on the open source strategies by jason5480, kevinmck100, myncrypto.
Thank you All!
### Filter
1. Can Choose whether to use filter.
2. Filters Based on ATR, EMA, ADX, and DMI are ready to use.
### StopLoss
1. Can Choose Stop Loss Type: Percent, ATR, Previous Low / High.
2. Can Chosse inputs of each Stop Loss Type.
### Take Profit
1. Can set Risk Reward Ratio for Take Profit.
- To simplify backtest, I erased all other options except RR Ratio.
- You can add Take Profit Logic by adding options in the code.
2. Can set Take Profit Quantity.
### Risk Manangement
1. Can choose whether to use Risk Manangement Logic.
- This controls the Quantity of the Entry.
- e.g. If you want to take 3% risk per trade and stop loss price is 6% below the long entry price,
then 50% of your equity will be used for trade.
2. Can choose How much risk you would take per trade.
### Plot
1. Added Labels to check the data of entry / exit positions.
2. Changed and Added color different from the original one. (green: #02732A, red: #D92332, yellow: #F2E313)
Trend Hunter v4This strategy follows the Trend Hunter training strategy taught at InvestIshare.
Entries are made based predominantly on the price action being above/below the Ichimoku Cloud with the ATR based super trend being used as a trailing stop loss.
Additional trend tracking tools can be toggled on / off to improve the wind rate on some time frames, with additional options available to limit entries if certain conditions are met.
If you would like access to this indicator, send me a DM on the Investishare Discord in the Trend Hunters channel.
The default parameters are set for BTC on the 2 HR time frame
AlphaTrend Strategy with Trailing SL %this is a modified version of AlphaTrend Strategy with added trailing Stop Loss
this is my first script that I have added to tradingview community
the trailing SL makes it very effective to lower the losses and can improve the overall return