Liquidity VisualizerThe "Liquidity Visualizer" indicator is designed to help traders visualize potential areas of liquidity on a price chart. In trading, liquidity often accumulates around key levels where market participants have placed their stop orders or pending orders. These levels are commonly found at significant highs and lows, where traders tend to set their stop-losses or take-profit orders. The indicator aims to highlight these areas by drawing unbroken lines that extend indefinitely until breached by the price action.
Specifically, this indicator identifies and marks pivot highs and pivot lows, which are price levels where a trend changes direction. When a pivot high or pivot low is formed, it is represented on the chart with a horizontal line that continues to extend until the price touches or surpasses that level. The line remains in place as long as the level remains unbroken, which means there is potential liquidity still resting at that level.
The concept behind this indicator is that liquidity is likely to be resting at unbroken pivot points. These levels are areas where stop-loss orders or pending buy/sell orders may have accumulated, making them attractive zones for large market participants, such as institutions, to target. By visualizing these unbroken levels, traders can gain insight into where liquidity might be concentrated and where potential price reversals or significant movements could occur as liquidity is taken out.
The indicator helps traders make more informed decisions by showing them key price levels that may attract significant market activity. For instance, if a trader sees multiple unbroken pivot high lines above the current price, they might infer that there is a cluster of liquidity in that area, which could lead to a price spike as those levels are breached. Similarly, unbroken pivot lows may indicate areas where downside liquidity is concentrated.
In summary, this indicator acts as a "liquidity visualizer," providing traders with a clear, visual representation of potential liquidity resting at significant pivot points. This information can be valuable for understanding where price might be drawn to, and where large movements might occur as liquidity is targeted and removed by market participants.
Stop
Trailing Stop ProTrailing Stop Pro is a sophisticated TradingView indicator designed to enhance your trading strategy by dynamically managing trailing stops based on market volatility. This tool leverages the Average True Range (ATR) to adjust stop levels, providing traders with a robust mechanism to protect profits and minimize losses.
Key Features:
Dynamic Trailing Stops: Automatically adjusts stop levels using ATR, allowing for responsive and adaptive risk management.
Customizable Inputs: Tailor the indicator to your trading style with adjustable parameters such as ATR Length, ATR Multiplier, and Source Vector.
Visual Clarity: Distinct color settings for long and short stops, with adjustable line thickness and transparency, ensuring clear visualization on your charts.
Professional Grade: The "Pro" designation signifies advanced features suitable for both novice and experienced traders seeking reliable and efficient stop management.
How It Works:
To set up the indicator, begin by defining the Chrono Point, which specifies the exact time you want the trailing stop mechanism to activate. This allows for precise control over when your stops begin to trail. Next, set the Credit Unit as the initial entry price for your trade, serving as the baseline from which the trailing stops will adjust.
The indicator uses ATR-based adjustments to determine stop levels. Customize the sensitivity of the trailing stop by adjusting the ATR Length (default is 14) and ATR Multiplier (default is 0.5). A longer ATR length smooths out volatility, while a higher multiplier increases the distance of the stop from the price.
Select your Source Vector from "High/Low," "Close," or "Open" prices as the basis for stop calculation. This flexibility allows you to align the indicator with your preferred trading strategy. The indicator plots trailing stops directly on the chart, with color-coded lines indicating long (teal) and short (red) positions. You can adjust the line thickness and transparency for optimal visibility.
The Mission Status feature automatically detects whether the trade is long or short and adjusts the trailing stop accordingly. If the price hits the trailing stop, the trade is considered exited, and the indicator calculates the profit or loss percentage.
Benefits:
Risk Management: Protect your trades from adverse market movements while locking in profits as prices move favorably.
Automation: Reduce manual intervention with automatic stop adjustments, allowing you to focus on strategic decision-making.
User-Friendly Interface: Intuitive settings and clear visual cues make it easy to integrate into your existing trading workflow.
Conclusion:
Trailing Stop Pro is an essential tool for traders looking to enhance their risk management strategies with precision and ease. By automating the trailing stop process and providing clear visual feedback, this indicator empowers you to navigate the markets with confidence. Whether you're a seasoned trader or just starting, Trailing Stop Pro offers the functionality and flexibility needed to optimize your trading performance.
The Trailing Stop Pro indicator is a tool designed to assist traders in managing risk and optimizing their trading strategies. However, it should not be considered as financial advice or a guarantee of profitability. Trading involves significant risk, and it is possible to lose more than your initial investment. Users are encouraged to thoroughly test the indicator in a demo environment and consider their own financial situation and risk tolerance before using it in live trading. Past performance is not indicative of future results, and users should seek advice from a qualified financial advisor if needed.
Fibonacci-Only StrategyFibonacci-Only Strategy
This script is a custom trading strategy designed for traders who leverage Fibonacci retracement levels to identify potential trade entries and exits. The strategy is versatile, allowing users to trade across multiple timeframes, with built-in options for dynamic stop loss, trailing stops, and take profit levels.
Key Features:
Custom Fibonacci Levels:
This strategy calculates three specific Fibonacci retracement levels: 19%, 82.56%, and the reverse 19% level. These levels are used to identify potential areas of support and resistance where price reversals or breaks might occur.
The Fibonacci levels are calculated based on the highest and lowest prices within a 100-bar period, making them dynamic and responsive to recent market conditions.
Dynamic Entry Conditions:
Touch Entry: The script enters long or short positions when the price touches specific Fibonacci levels and confirms the move with a bullish (for long) or bearish (for short) candle.
Break Entry (Optional): If the "Use Break Strategy" option is enabled, the script can also enter positions when the price breaks through Fibonacci levels, providing more aggressive entry opportunities.
Stop Loss Management:
The script offers flexible stop loss settings. Users can choose between a fixed percentage stop loss or an ATR-based stop loss, which adjusts based on market volatility.
The ATR (Average True Range) stop loss is multiplied by a user-defined factor, allowing for tailored risk management based on market conditions.
Trailing Stop Mechanism:
The script includes an optional trailing stop feature, which adjusts the stop loss level as the market moves in favor of the trade. This helps lock in profits while allowing the trade to run if the trend continues.
The trailing stop is calculated as a percentage of the difference between the entry price and the current market price.
Multiple Take Profit Levels:
The strategy calculates seven take profit levels, each at incremental percentages above (for long trades) or below (for short trades) the entry price. This allows for gradual profit-taking as the market moves in the trade's favor.
Each take profit level can be customized in terms of the percentage of the position to be closed, providing precise control over exit strategies.
Strategy Backtesting and Results:
Realistic Backtesting:
The script has been backtested with realistic account sizes, commission rates, and slippage settings to ensure that the results are applicable to actual trading scenarios.
The backtesting covers various timeframes and markets to ensure the strategy's robustness across different trading environments.
Default Settings:
The script is published with default settings that have been optimized for general use. These settings include a 15-minute timeframe, a 1.0% stop loss, a 2.0 ATR multiplier for stop loss, and a 1.5% trailing stop.
Users can adjust these settings to better fit their specific trading style or the market they are trading.
How It Works:
Long Entry Conditions:
The strategy enters a long position when the price touches the 19% Fibonacci level (from high to low) or the reverse 19% level (from low to high) and confirms the move with a bullish candle.
If the "Use Break Strategy" option is enabled, the script will also enter a long position when the price breaks below the 19% Fibonacci level and then moves back up, confirming the break with a bullish candle.
Short Entry Conditions:
The strategy enters a short position when the price touches the 82.56% Fibonacci level and confirms the move with a bearish candle.
If the "Use Break Strategy" option is enabled, the script will also enter a short position when the price breaks above the 82.56% Fibonacci level and then moves back down, confirming the break with a bearish candle.
Stop Loss and Take Profit Logic:
The stop loss for each trade is calculated based on the selected method (fixed percentage or ATR-based). The strategy then manages the trade by either trailing the stop or taking profit at predefined levels.
The take profit levels are set at increments of 0.5% above or below the entry price, depending on whether the position is long or short. The script gradually exits the trade as these levels are hit, securing profits while minimizing risk.
Usage:
For Fibonacci Traders:
This script is ideal for traders who rely on Fibonacci retracement levels to find potential trade entries and exits. The script automates the process, allowing traders to focus on market analysis and decision-making.
For Trend and Swing Traders:
The strategy's flexibility in handling both touch and break entries makes it suitable for trend-following and swing trading strategies. The multiple take profit levels allow traders to capture profits in trending markets while managing risk.
Important Notes:
Originality: This script uniquely combines Fibonacci retracement levels with dynamic stop loss management and multiple take profit levels. It is not just a combination of existing indicators but a thoughtful integration designed to enhance trading performance.
Disclaimer: Trading involves risk, and it is crucial to test this script in a demo account or through backtesting before applying it to live trading. Users should ensure that the settings align with their individual risk tolerance and trading strategy.
Custom ATR Trailing StopThis Script creates a custom ATR (Average True Range) trailing stop. It allows traders to set up automated stop-loss levels based on the ATR, which adjusts dynamically to market volatility. The script is designed to support both long and short trades, offering flexibility and precision in trade management.
When loading the indicator to your chart, simply click to set the trade begining time, confirm various settings and you are set.
Check tooltips for more details in the input settigns menu.
User Inputs
Trade Setup: Allows users to set the trade direction (Long or Short), the signal source for entries, and the specific bar time for the trade setup.
ATR Settings: Configurable ATR lookback period, ATR smoothing period, initial ATR multiplier for setting the stop-loss, breakeven ATR multiplier, and a manual breakeven level.
ATR Calculations
Computes the ATR and its moving average.
Determines initial and breakeven stop levels based on the ATR.
Signal Validation
Validates long or short trade signals based on the specified bar time and trade direction.
Triggers alerts when a valid trade signal is detected.
Trailing Stop Logic
For long trades, adjusts the stop-loss level dynamically based on the ATR.
For short trades, performs similar adjustments in the opposite direction.
Updates the trailing stop level to ensure it follows the price, moving closer as the price moves favorably.
Resets the trade state when the stop-loss is hit, triggering an alert.
Plotting
Plots the trailing stop levels on the chart.
Uses green for stop levels indicating profit and red for stop levels indicating a loss.
Parabolic SAR Waves [MMA]Parabolic SAR Waves
Description:
The "Parabolic SAR Waves " is an advanced version of the traditional Parabolic SAR indicator, customized for TradingView. This script incorporates dynamic acceleration factors and optional gradient coloration to enhance visual interpretation and utility for traders aiming to accurately capture trends and predict potential reversals.
Features:
- Dynamic Acceleration: Adjust the initial, incremental, and maximum values of the acceleration factor to suit various market conditions and trading preferences.
- Gradient Coloring: Use gradient colors to indicate the strength and stability of the trend, providing visual cues that are easy to interpret.
- Trend Visibility: The SAR dots are plotted directly on the price chart, making it easy to spot trend changes and maintain situational awareness.
- Overlay Feature: Designed to overlay directly on the price charts, allowing for seamless integration with other technical analysis tools.
Benefits:
- Trend Detection: Helps in identifying the beginning and potential reversal of trends, aiding in timely decision-making.
- Stop-Loss Management: Utilizes the positions of the SAR dots as dynamic stop-loss points, which helps in risk management.
- Visual Simplicity: Enhances the decision-making process through a straightforward visual representation of trend data.
Parameters:
- Acceleration Start (accel_start): The initial value for the acceleration, set to 0.02 by default.
- Acceleration Increment (accel_inc): The amount by which the acceleration increases, set to 0.005 by default.
- Acceleration Maximum (accel_max): The maximum limit of the acceleration factor, set to 0.1 by default.
- Use Gradient Colors (use_gradient): A boolean toggle to enable or disable gradient coloring, enabled by default.
Indicator Usage:
1. To apply, select this indicator from TradingView's indicator library.
2. Adjust the acceleration parameters based on your specific trading strategy and market analysis.
3. Interpret the indicator signals:
- Green SAR dots below the price bars indicate a bullish trend.
- Red SAR dots above the price bars signify a bearish trend.
- Gradient colors, if enabled, provide insights into the acceleration factor's intensity relative to trend strength.
Alerts:
- Bullish Reversal Alert: Issues a notification if there is a potential upward reversal when the trend shifts to bullish.
- Bearish Reversal Alert: Alerts when there's potential for a downward move as the trend turns bearish.
The "Parabolic SAR Waves " is a robust tool, ideal for traders who need precise, customizable trend-following capabilities that integrate seamlessly with other market analysis strategies. Enhance your trading with detailed trend insights and adaptive parameter controls.
Pure Morning 2.0 - Candlestick Pattern Doji StrategyThe new "Pure Morning 2.0 - Candlestick Pattern Doji Strategy" is a trend-following, intraday cryptocurrency trading system authored by devil_machine.
The system identifies Doji and Morning Doji Star candlestick formations above the EMA60 as entry points for long trades.
For best results we recommend to use on 15-minute, 30-minute, or 1-hour timeframes, and are ideal for high-volatility markets.
The strategy also utilizes a profit target or trailing stop for exits, with stop loss set at the lowest low of the last 100 candles. The strategy's configuration details, such as Doji tolerance, and exit configurations are adjustable.
In this new version 2.0, we've incorporated a new selectable filter. Since the stop loss is set at the lowest low, this filter ensures that this value isn't too far from the entry price, thereby optimizing the Risk-Reward ratio.
In the specific case of ALPINE, a 9% Take-Profit and and Stop-Loss at Lowest Low of the last 100 candles were set, with an activated trailing-stop percentage, Max Loss Filter is not active.
Name : Pure Morning 2.0 - Candlestick Pattern Doji Strategy
Author : @devil_machine
Category : Trend Follower based on candlestick patterns.
Operating mode : Spot or Futures (only long).
Trades duration : Intraday
Timeframe : 15m, 30m, 1H
Market : Crypto
Suggested usage : Short-term trading, when the market is in trend and it is showing high volatility .
Entry : When a Doji or Morning Doji Star formation occurs above the EMA60.
Exit : Profit target or Trailing stop, Stop loss on the lowest low of the last 100 candles.
Configuration :
- Doji Settings (tolerances) for Entry Condition
- Max Loss Filter (Lowest Low filter)
- Exit Long configuration
- Trailing stop
Backtesting :
⁃ Exchange: BINANCE
⁃ Pair: ALPINEUSDT
⁃ Timeframe: 30m
⁃ Fee: 0.075%
⁃ Slippage: 1
- Initial Capital: 10000 USDT
- Position sizing: 10% of Equity
- Start: 2022-02-28 (Out Of Sample from 2022-12-23)
- Bar magnifier: on
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.
Bollinger Bands - Breakout StrategyThe Bollinger Bands - Breakout Strategy is a trend-following optimized for short-term trading in the crypto market. This strategy employs the Bollinger Bands, a widely recognized technical indicator, as its primary instrument for pinpointing potential trades. It is capable of executing both long and short positions, depending on whether the market is in a spot or futures, and is particularly effective in trending markets.
The strategy boasts a high degree of configurability, allowing users to set the Bollinger Bands period and deviation, trend filter, volatility filter, trade direction filter, rate of change filter, and date filter. Furthermore, it offers options for Take Profit, Stop Loss, and Trailing Stop for both long and short positions, ensuring a comprehensive risk management approach. The inclusion of a maximum intraday loss feature adds another layer of protection, making this strategy a valuable tool for traders seeking a professional and adaptable trading system.
Name : Bollinger Bands - Breakout Strategy
Category : Trend Follower based on Bollinger Bands
Operating mode : Long and Short on Futures or Long on Spot
Trade duration : Intraday
Timeframe : 2H, 3H, 4H, 5H
Market : Crypto
Suggested usage : Trending Markets
Entry : When the price crosses above or below the Bollinger Bands
Exit : Opposite Cross or Profit target, Trailing stop or Stop loss
Configuration :
- Bollinger Bands period and deviation
- Trend Filter
- Volatility Filter
- Trade direction filter
- Rate of Change filter
- Date Filter (for backtesting purposes)
- Take Profit, Stop Loss and Trailing Stop for long and short positions
- Risk Management: Max Intraday Loss
Backtesting :
⁃ Exchange: BINANCE
⁃ Pair: BTCUSDT.P
⁃ Timeframe: 4H
⁃ Fee: 0.025%
⁃ Slippage: 1
- Initial Capital: 10000 USDT
- Position sizing: 10% of Equity
- Start : 2019-09-19 (Out Of Sample from 2022-12-23)
- Bar magnifier: on
Credits :
- LucF of Pine Coders for f_security function to avoid repainting using security.
- QuantNomad for Monthly Table.
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.
Dynamic Stop Loss DemoWhat does this script do ?
This script is for pine script programmers and explains how to implement a dynamic stop-loss strategy. It is different from trailing stop-loss. Trailing stop-loss can only set the retracement value, but this script can take profit on part of the position at a fixed price and allows users to decide whether to take profit on all positions based on whether a certain track is breached or other conditions author want. In this demo, it use rsi crossover and crossunder to decide the strategy condition, and use close price as open price, and use lowest low / highest high as stop price, and use 1.5 risk ratio to calculate the fixed first profit price. It will take 50% position size when the first profit price was reached. Then it will close all rest positions when the inverse condition come out or the dynamic stop(calculated by ATR) breached or when the price back to the open price or the stop price.
How is this script implemented
When start strategy by strategy.entry , it gives a custom id which contains direction, openPrice, stopPrice, profitPrice, qty, etc. It can be get from the global variable strategy.posiition_entry_name .
cankardesler stoploss v2This stoploss allows to filter high volatility fake trends;
But how we are made it; we are calculating the last spikes value average and calculating the standart deviation, after we added to the standart stoploss formula price+2atr and voila!!
Your stop loss is ready.
The idea behind this formula: what is explosing our stops? fake-out spikes.
We think if we get the last spikes average and calculate the standart deviation on it and after add it to the original stop formula, its gonna help for bypassing the spikes.
Thanks a lot @ocankardes for helping me to developing this formula
TrailingStopsLibrary "TrailingStops"
This library contains functions to output trailing stop lines.
f_marketStructureStop(_restartMode, _flipMode, _restartLowIn, _restartHighIn)
Parameters:
_restartMode - Defines how the stop lines persist. Allowed values are:
"Always On" - The stop lines are always present and they just reset when they're crossed.
"Flip" - The stop lines flip when they're crossed.
"Manual" - The stop lines turn off when they're crossed, and turn back on again when _restartLowIn or _restartHighIn are passed into the function as true.
_flipMode - Defines whether the stop lines are broken by wicks or closes. Allowed values are "Wick", and "Close".
_restartLowIn - If _restartMode is "Manual", passing this parameter as true restarts the Low stop line.
_restartHighIn - If _restartMode is "Manual", passing this parameter as true restarts the High stop line.
@returns - floats for the Low and High stop line.
Interactive SAR Stop-Loss [TANHEF]This indicator is "Interactive" which means some inputs can are manually added through the first click after adding the indicator to the chart (SAR Trailing Stop-loss start point).
Unlike the normal Parabolic SAR, this indicator allows for the modification of the start point of the Parabolic SAR’s first bar calculation. Normally, the Parabolic SAR automatically has a start point after the first bar of an asset’s historical price that will then switch between trailing above and below price respectively. It must be noted that due to how the first position of the Parabolic SAR is calculated, on occasion the Parabolic SAR will immediately flip on the next bar to the opposite side relative to price that it was just located. Modifying the setting “⭐Initial Interactive SAR Position Source”, then selecting either 'Clicked' or 'ATR' level as the vertical start position will prevent this. See images below for more explanation.
Why use a trailing stop-loss?
A trailing stop-loss provides an exit when price moves against you but also enables you to move the exit point further into profit when price is moving in the desired direction of a trade. The Parabolic SAR ( stop and reverse ) which is used to determine price direction as well as when price direction is changing, is very effective at functioning as a trailing stop loss.
Indicator Explanation
Initially when this indicator is added to the chart, you will be prompted to select where to begin the SAR Trailing Stop-loss.
For a long stop-loss, select below price.
For a short stop-loss, select above price.
After this indicator is placed, it can be modified via dragging or from within the settings by modifying the time and the price input. Or simply re-add the indicator to the chart. Another option is to have this Parabolic SAR begin directly on the price that was initially ‘Clicked’ or the ‘ATR’ level, which requires selecting the option in settings labeled “⭐Initial Interactive SAR Position Source”
The SAR Stop Loss plotted. Note that the calculation that occurs on this first bar of the ‘Interactive SAR’ is as if the prior bar was the oldest historical bar of the asset. Due to the SAR’s calculations, if the ‘Normal SAR’ were to also flip sides over to the position that has been manually set for the ‘Interactive SAR’, they won’t necessarily have the same result.
An optional fixed profit target can be added within the settings. This profit target will only actively be plotted when the SAR Trailing Stop-loss has not be hit yet or until the profit target has been hit.
Here shows that the profit target was hit, then later on the SAR Trailing Stop-loss was hit.
Note, trailing stop-loss will continue to be plotted until it has been hit regardless of the profit target being hit or not.
Here is an example of when the Parabolic SAR will immediately flip on the next bar to the opposite side relative to price that it was just first located. This is due to how the Parabolic SAR is calculated and will also occur with the traditional Parabolic SAR that is not interactively (manually) given a start location. To prevent this, either relocate this time in which this SAR beings or consider modifying the SAR’s (start, increment, max) settings specifically.
Here instead of using the SAR’s calculation for an initial bar, the ‘ATR’ was selected as the start point within the setting “⭐Initial Interactive SAR Position Source”.
Alerts
1. 'Check' alerts to use within indicator settings (trailing stop hit and/or profit target hit).
2. Select 'Create Alert'
3. Set the condition to 'Interactive SAR''
4. Select create.
Movable Stop + Trail + Alerthello everybody !
.....
this indicator helps you to get a better trading setting.
it's similar to the default draw tool from the trading view but the difference is you can add Trail stop and Alert .
.....
It also helps to free accounts to set more than 1 Alarm !!!
.....
Alert setting
just remember after you see set an alert if you change stop or entry, the alert will work with previous values/settings.
so you need to recreate an alert.
also don't change alert setting
.....
indicator setting
How is it works ?
...
settings
...
everything on :
you can see the information on the table
...
short sample :
everything on
...
simple short trade setting:
.....
my goal is to upgrade this indicator with your ideas.
not financial advice !
please , share your ideas with me to improve the indicator
I would like to see what you think about this indicator <3
also if you have any ideas to create an indicator or strategy you can make contact with me .
have a great day.
Trailing Stop AlertsThis script is designed as an ATR-based trailing stop tool to assist in managing open positions.
Once you're involved in a profitable trade, if you add this script to your chart you'll be prompted to select a bar to begin trailing from.
You can then adjust the candle lookback distance for swing high/lows (7 by default), the ATR multiplier (1.0 by default), and the direction to trail (Long/Short).
You can also adjust the ATR period in the settings menu if you want to (14 period by default).
Once the script is added to your chart, it will begin drawing your trailing stop and you can then set up alerts.
Alert Options:
Any alert() function call : Will trigger an alert for both conditions (trailing stop updated, trailing stop hit)
Alert Conditions : Trailing Stop Update will trigger whenever the stop is updated, Trailing Stop Hit will trigger whenever the stop is hit.
Note: the alerts will only fire once per bar close and the trailing stop will not update on realtime bars.
ATR Start & Stop BotThis script is using Average True Range (ATR) and works very well on the Bitcoin 4 hour timeframe to determine when to stop and start your bots.
It has a very similar visual to the EMA RSI Indicator found here:
This 'ATR Start & Stop Bot' is better because it has less confusion during sideways market movement.
As an example - You are using 3commas and have a Composite bot setup with several alt coins, you can use this indicator with the ' Stop bot ' alert to disable your composite bot from taking trades at times when the market is on a trend that looks in the red.
Alternatively you can use the ' Start bot ' alert to turn your bot back on during the green uptrends.
Using this indicator with these alerts on the Bitcoin 4-Hour chart add a great layer of automation to your already existing bots.
Credits:
Original 'ATR Stops' indicator belong to the user failathon and that script is found here:
Also credits to Dradian for the alert additions.
Moving Stop-Loss mechanism + alerts to MT4/MT5"How to code moving stop-loss mechanism", is one of the most often repeating questions in private messages I receive, so just to focus on this mechanism, I made a spin-off from my previous script: TradingView-Alerts-to-MT4-MT5-dynamic-variables-NON-REPAINTING .
The logic here moves the stop-loss each time a trade is running and a new pivot high/low is detected. When such event occurs (UpdateLongStopLoss or UpdateShortStopLoss), stoploss_long or stoploss_short mutable variable is modified. And it needs to be coded inside strategy.exit() line as "stop=stoploss_long" or "stop=stoploss_short". Entries are pretty straightforward - on Stoch crosses.
Last lines of the script show how to wrap information about such updates and send send alerts to MetaTrader via TradingConnector for execution in Forex/indices/commodities/crypto markets via MetaTrader. Please note that "tradeid=" variable must be passed with each alert, to let MetaTrader know which trade to modify. SLMOD, TPMOD are recently added commands, along with BE (as in "move stop-loss to breakeven" - but that's another topic).
Please disregard strategy backtest results, as this script is for coding education purposes only. However, it seems with the stop-loss mechanism enabled, the results are even better, than in original version of the script :)
ATR Stop Loss FinderThis Indicator uses Average True Range (ATR) to determine a safe place to put stop losses to avoid being stop hunted or stopped out of a trade due to a tight stop loss. Default multiplier setting is 1.5. For a more conservative stop loss use 2 and for a tighter stop loss use 1. ATR and stop loss prices are displayed in table at bottom of screen. Use high(red) for shorts and low(teal) for longs.
SL Hunter Tracker SL Hunter Tracker
coded by Bogdan Vaida
SL Hunter Tracker is a meticulous hunter that tracks SL hunters.
First it plots the fractals on the chart, then it draws lines from them
to the last wick that touched that height. You can add sweep alerts, once
per bar close, so that you get notified when a wick was touched.
Tested on: EURUSD 30'
MultiPrice AlertThis is an alert script using Pinescript version 4. This enables one to set 5 alerts (1 StopLoss, 4 Targets), on 3 different symbols, at using a single alert in the UI.
Every visible line will only appear on the symbols that are selected. After setting targets when making an alert, select this indicator as a condition. Change the name to whatever you want, usually the names of the set of tickers.
The Alert message is dyanmic showing which Symbol with each type of alert, at whatever price.
Ability to disable the targets + symbols.
Alerts work by Stop Loss crossing under price and Targets Cross Over. Enabling the "Short" Targets reverses this.
The line that is being displayed is actually the price of the asset being moved over x number of bars. I have not found a way to plot a traditional horizontal line, as the code for it uses a fixed price.
As it being a user input, it is a variable. Any help with this would be appreicated.
Alerts are set to once per bar.
Known bug that sometimes if the prices that you set are inside the current candle stick, then your alert will immeaditally fire, either change the timeframe or let it fire and wait fo
After a target is hit, I reccomend setting the alert to 0 and REMAKING the alert. You MUST REMAKE THE ALERT AFTER ANY CHANGES. This script WILL NOT CHANGE ALERTS AS YOU CHANGE SETTINGS.
TradingView Alerts are not this smart , at least I haven't found a way to do this yet.
Auto Stop
A simple script using the last three bars(including the current) and draws a line on the chart under that for an easy automated stop loss point
Supertrend / Position SizingSuperTrend with position sizing calculator.
This is based on SuperTrend by Kivanc. I only added the position size calculation and displaying the result.
ATR Without OutliersIt is an ATR indicator which filters out outliers.
Outliers are values which are higher than the standard deviation of the true range.
It may be better than normal ATR for stop loss, because it does not keep large values after pump or dump.
It is very useful for high volatile markets like crypto markets.
Tiger's Stop - Objective Stoploss SettingTrading is a lot about risk management too. I created this script to help with setting and moving a proper stop-loss. It plots an area that is a result of adding and subtracting both average true range and something I call "false range".
►The Average True Range is calculated as the candle's high-low. If there is a gap, it is added to complete the result.
►My own False Range just candle bodies. It is calculated as an absolute value of (close-open).
Then, Rolling Moving Average is applied on both ATR and False Range to get an idea of how far the price tends to extend out of pure randomness. The resulting value is multiplied by a Multiplier.
The next step is an addition of the values to the higher part of the candle for short or a lower part of the candle for long. I prefer a special calculation instead of using Highs and Lows because it allows for more precise observation and stop-loss set up for less wicky symbols.
►►►Additional Functions
• Smoothing - applies moving average to candles from which range distance is calculated. This can achieve good smoothness but higher values will lead to using outdated price in the SL area calculation.
• Enable/Disable - if you know the direction you are going to trade in, it is good to disable either Long Stop-Loss Area or Short Stop-Loss Area. Just untick it in the settings.
►►►Actual Using
Before using the script to set your stop-loss, check the historical data and find a similar set-up. Is it engulfing you use as a trigger? Find a different one and see how effective the stop-loss based on the ATR*multiplier was. This will help you to optimize Multiplier value. A picture shows such research for a double top. You should find more similar situations to find an optimal value.
Ultimately, the indicator still gives you relatively a lot of freedom with your stop-loss settings (at least, that is with the default settings). You need to decide how loose stop-loss you want to set. Average True Range is the furthermost part which will make for a very large stop-loss, on the other hand, False Range might be triggered by a villainous wick unnecessarily. The choice should depend on the specific symbol you trade and perhaps, you will learn to set stops regardless of the indicator.
A little trick : 1. You can set the loosest stop-loss and set a TradingView alert for where the tightest stop-loss would be. When alerted, you will get the opportunity to reconsider the trade and take a loss if needs be or exit if a candle closes there. 2. Mostly for cryptocurrencies, you can set the tightest stop-loss to protect yourself from sudden spikes. If the price approaches it slowly enough, you can move the stop-loss to the further part of the channel. This is not the same as moving stop-loss indefinitely with hopes of reversal if you plan it from the beginning and a smaller stop is meant to protect you from spikes that are not always predictable and drive to both directions.
►►►Advantages of trailing stop-loss
I usually stick with my original stop-loss instead of moving to break even. If my entry area was functional support once, it may work again and is, therefore, still a good entry zone. But an alternative used to preserve as much of the profit as possible is trailing.
Trailing is setting a specific value in ticks or a calculation of how to move the stop-loss whenever the price moves in your favor. Tiger's Stop can be used this way. Whenever there is a new value as the candle closes and that value is closer to price than your current stop-loss, you can update it. However, if it moves further from your price, don't change the stop-loss. This can be a little tiresome if you do it manually but should be worth the effort.
I usually start trailing only after the price moves significantly in my favor that allowing it to return to the entry price would not make any sense.
►►►Feedback and optimization
The preview chart is chosen entirely at random and the values are not optimized for any specific symbol. If you opt to use it, let me know which values work for you the best, I'll add it to the description when I update it.
Furthermore, let me know if you think any sort of alerts would be useful with my script.
Good luck!