PROTECTED SOURCE SCRIPT

[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 [SETUP AS DEFAULT]): 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 | [x] 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 [x] | 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) [NOTE: These will show unconditionally, outside of trade engine and can be hidden if desired].

>>>>> Take-profit/Stop-loss SOURCE: HHLL (Highest High Lowest Low) [NOTE: These are the green and red lines above/below price, can be hidden if desired].

>>>>> 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 [This is for “Static” Take-Profit System ONLY!!!]: 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 [This is for “Dynamic” Take-Profit System ONLY!!!]: 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 ["COIN"] 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!)

リリースノート
* Added optional Volume confirmation to the whole chain of signal analysis, you can now set average Volume length and check if at the signal - the volume is very strong (>150%) and only then process the signal/alert. Candle color will differ depending on the Volume if this setting is turned on.
リリースノート
* Fixed some minor issues with alerts + dynamic SL with static TP was only moving to Entry once TP1 is hit, now it will move to Entry even if TP2/3/4 is hit before TP1
リリースノート
* Fixed a weird table issue where date range was not working
リリースノート
* Added Trading Schedule highlight option, so you can see exactly during which time the indicator is trading in the past, when does it start/end trading live!
リリースノート
Fixed a small issue with Intraday Close Settings.
Please note the 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
リリースノート
* Added another feature, which can be 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.
リリースノート
* Minor fix
リリースノート
* Updated current position LIVE P/L (profit/loss) table display to convert the result to PIPS if FOREX is being traded
リリースノート
* Updated background color of active trading schedule, looks much better now
リリースノート
* Updated 1/3 and 5/3 percentage of total trade from 33 to 34 percent, that way it rounds up correctly when you use multi-profit system, this should not affect backtesting
リリースノート
* Minor fix
リリースノート
* Minor fix with SL behavior
リリースノート
* Minor logic fix
リリースノート
* EOD (End of Day) close in profit would show "loss" alert - fixed
リリースノート
* Added additional feature when open signal consumes several/all Take-Profit areas as very rarely but with huge candles it may create an issue where a position/trade will be open with no Take-Profits to take and the trade will get "stuck" until it either hits Stop-Loss or will be closed at EOD (End of Day) if EOD is turned on. Here is the explanation of how the feature works:

>>>>> Signal Candle Bar consuming Take-Profits - position/trade signal candle bar is so big that it consumes the last TP setting (If signal open candle bar is so big that it covers the last Take-Profit area [For 5 # of TPs, it will be TP5], the signal can either be skipped, or all Take-Profit areas pushed ahead from signal candle bar close using smart formula)
NOTE1: If opening candle bar is big enough to consume several Take-Profit areas, but not the last Take-Profit area, indicator will behave the same way (taking remaining Take-Profits if hit).
NOTE2: If opening candle bar is so big that it consumes all Take-Profit areas, including last one (if 5 # of TPs selected: TP5 has to be consumed), depending on the "Signal Candle Bar consuming Take-Profits" input setting, it will either skip/NOT open a trade at all, or push all Take-Profit areas ahead using smart formula.
リリースノート
* Organized alerts better + TP/SL alerts will show closing price at alert, since even though TP/SL levels are pre-calculated at trade/position open - every target is considered HIT once candle bar actually breaks it (closes beyond it)
リリースノート
* Another minor fix
リリースノート
* Fixed an issue with multiTP system, where a TP2/3/4/5 would get ahead of TP1, alerts would show wrong percentage, now alerts will show exact percentage to close when TPs are hit!
リリースノート
* Added automated rounding of Entry/TP/SL/Close numbers within alerts, so it should be much easier to read now!
リリースノート
* Minor plotting fix
リリースノート
* Minor change in TP consumption formula (it's better now!)
リリースノート
* Fixed a rare issue where SL is hit on the same bar a trade/position is open, now SL can only be hit next candle after trade/position is open
リリースノート
* Another minor fix
リリースノート
* Stats table now show more info (now will also show if any of the TPs were taken and which was the last TP that was taken)
リリースノート
* Volume Strength analysis Percentage can now be manually set (strong and weak)
リリースノート
* Adjusted use_bar_magnifier to false by default, so that non-premium user accounts would not get study error (for Premium accounts - it can be turned on via Indicator Settings > Properties > Backtesting Precision)
リリースノート
* Fixed a minor plot issue where with large signal candle - 1st TP (TP1) gets consumed and input setting is set to 'Skip Signal', it would still show plot label, now it will include a white cross over it with "SKIP"
リリースノート
* Minor fix
リリースノート
* Changed calc_on_order_fills default setting to false, as it does not affect this indicator, yet it will show a warning now that backtesting results maybe unrealistic...
リリースノート
*** Please check this video guide to learn more about my indicators (the video is for my different indicator, but the way it operates and the way you configure it is very similar!): youtu.be/NuQOwgKgegA?si=Q0iqL4V_xvTaKdLP
リリースノート
* Minor fix to stats table
リリースノート
* Minor fix
リリースノート
* Improved Stop-Loss options, now there is also a trailing stop included:
- Static: it remains where it was set at trade/position open
- Dynamic: it moves to Entry at TP1 (or TP2/3/4/5 if it hits ahead)
- Trailing: it will be moved along the trade/position (smart trailing stop-loss), at TP1 taken > SL will move to Entry, at TP2 taken > SL will move to TP1, at TP3 taken > SL will move to TP2 and so on

NOTE: Dynamic Take-Profit works the same way as before, Trailing Stop-Loss now will work with Static and with Dynamic TP system. Otherwise, there will simply be less confusion now, Take-Profit system is by itself and Stop-Loss system is by itself as well, both can be set to whatever desired!
リリースノート
* Updated scheduling settings. Now it is fully customizable and any cut off hour can be set to close any open trade/alert triggered, not only at US market close or before Power Hour. Now any custom intraday schedule can be set as desired!
リリースノート
* Minor fix
リリースノート
* Minor fix
リリースノート
* Updated the wording for "EOD(End of Day) Close/Trading Cut Off" settings so it is more friendly.
リリースノート
* Mistype fix
リリースノート
* Added additional optional signal confirmation by Volume above average MA line at signal trigger, if turned on - position/trade will be opened only if volume is above the volume MA line (volume MA length can be customized).
リリースノート
* Cleaned up and very slightly re-worded input parameters, hidden some of the long explanations inside a tooltip (hover mouse over (i) to the right from the parameter for more info). Reading and experimenting / searching for best combination of parameters should be now much easier and more convenient! Please NOTE: Nothing changed in the algorithm, this is a cosmetic change.
リリースノート
* Minor fix, EOD grey vertical line was showing at the wrong time (had custom timezone mistakenly included in the code)
リリースノート
* Fixed a bunch of warnings within the script, this is preventive measure as with new version of PineScript, these warnings may become errors. No changes were made to algorithm.
リリースノート
* There was a very minor issue with TP Consumed - Push approach, fixed it with a while loop
リリースノート
* Fixed an issue where EOD would combine with TP1/2/3/4/5 or SL on the same closed candle, where it would not fully close out the trade and leave it partially open due to a mix up the script trying to process both: EOD and another action like TP1.
リリースノート
* minor fix
リリースノート
* Cosmetic fix
リリースノート
* Minor fix
algotradinganalysisCandlestick analysisChart patternscustomizablecustomtradingsystemdynamiclevelsdynamicsupportandresistancemultipletargetssentimenttrailingstopuniversal

保護スクリプト

このスクリプトは保護スクリプトとして公開されており、個人利用として利用することは可能です。

チャートでこのスクリプトを利用したいですか?


Trading like a machine!
他のメディア:

免責事項