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.
Manual
Draw Line For High Low Custom Range Interactive█ OVERVIEW
This indicator is an educational indicator to make pine coders easier to how to use interactive inputs with User-Defined Type (UDT) especially when dealing input.time.
█ NOTES
This indicator is not perfect but it is a good starting point or template to start develop custom range interactive indicator.
█ INSPIRATIONS
ABC 123 Harmonic Ratio Custom Range Interactive
XABCD Harmonic Pattern Custom Range Interactive
PriceTimeInteractive
█ CREDITS
CAGR Custom Range
Pine scripts are now interactive
█ FEATURES
1. High Low points are determined based on points selected.
2. Line will be drawn after points are correctly arranged.
3. Label show error once wrong point is selected, move the point as instructed in example.
█ EXAMPLES / USAGE
Simple OHLC Custom Range Interactive█ OVERVIEW
This indicator show lines of OHLC which can be commonly used as support and resistance zones.
OHLC can be shown table with candlestick visual.
Color of candlestick depends on direction of bullish / bearish of the chosen candlestick.
█ INSPIRATION
Inspired by design, code and usage of CAGR . Basic usage of custom range / interactive, pretty much explained here . Credits to TradingView .
█ FEATURES
Table can positioned by any position and font size can be resized.
OHLC can be in full or simple name.
Lines can be extend either right, left, both or none.
█ HOW TO USE
Only 1 point is required.
Dont worry about magnet, point will attached depends on High or Low of the candle.
█ USAGE / TIPS EXAMPLES (Description explained in each image)
ABC 123 Harmonic Ratio Custom Range Interactive█ OVERVIEW
This indicator was designed based on Harmonic Trading : Volume One written by Scott Carney.
This is about harmonic ratios which expanded through retracement and projection.
Derivation is pretty much explained here such as Primary, Primary Derivation, Secondary Derivation and Secondary Derivation Extreme.
Derivation value depends on minimum retracement or maximum projection.
This derivation value utilize Fibonacci value which later expand to Harmonic Ratio.
█ INSPIRATION
Inspired by design, code and usage of CAGR . Basic usage of custom range / interactive, pretty much explained here . Credits to TradingView.
This build is based and visualized upon Harmonic Trading Ratios.
This build also was stripped down from XABCD Harmonic Pattern Custom Range Interactive .
█ CREDITS
Scott Carney, Harmonic Trading : Volume One (Page 18)
█ FEATURES
Table can positioned by any position and font size can be resized.
Labels can be either changed to alphabets or numbers.
█ HOW TO USE
Draw points from Point A to Point C.
Dont worry about magnet, point will attached depends on High or Low of the candle.
█ USAGE / TIPS EXAMPLES (Description explained in each image)
CFB Utility - Manual LevelsManual Level's for the seasoned Set and Forget trader! Want to keep your levels in an organized place, wrapped up nicely in an indicator? You've found the right tool.
Features Include:
Up to 20 Manually Declared Levels
User defined Coloring and text
XABCD Harmonic Pattern Custom Range Interactive█ OVERVIEW
This indicator was designed based on Harmonic Pattern Book written by Scott Carney. It was simplified to user who may always used tools such as XABCD Pattern and Long Position / Short Position, which consume a lot of time, recommended for both beginner and expert of Harmonic Pattern Traders. XABCD Pattern require tool usage of Magnet tool either Strong Magnet, Week Magnet or none, which cause error or human mistake especially daily practice.
Simplified Guideline by sequence for Harmonic Pattern if using manual tools :
Step 1 : Trade Identification - XABCD Pattern
Step 2 : Trade Execution - Any manual tools of your choice
Step 3 : Trade Management - Position / Short Position
█ INSPIRATION
Inspired by design, code and usage of CAGR. Basic usage of custom range / interactive, pretty much explained here . Credits to TradingView.
I use a lot of XABCD Pattern and Long Position / Short Position, require 5 to 10 minutes on average, upon determine the validity of harmonic pattern.
Upon creating this indicator, I believed that time can be reduced, gain more confidence, reduce error during drawing XABCD, which helps most of harmonic pattern users.
█ FEATURES
Table can positioned by any postion and font size can be resized.
Table can be display through optimized display or manual control.
Validility of harmonic pattern depends on BC ratio.
Harmonic pattern can be displayed fully or optimized while showing BC ratio validity.
Trade Execution at point D can be displayed on / off.
Stop Loss and Take Profit can be calculated automatically or manually.
Optimized table display based extend line setup and profit and loss setup.
Execution zone can be offset to Point C, by default using Point D.
Currency can be show or hide.
Profit and Loss can be displayed on axis once line is extended.
█ HOW TO USE
Step 1 : Trade Identification - Draw points from Point X to Point C. Dont worry about magnet, point will attached depends on High or Low of the candle.
Step 2 : Trade Execution - Check the validity of BC to determine the validity of harmonic pattern generated. Pattern only generate 1 pattern upon success. Otherwise, redraw to other points.
Step 3 : Trade Management - Determine the current candle either reach Point D or Potential Reversal Zone (PRZ). Check for Profit & Loss once reach PRZ.
█ USAGE LIMITATIONS
Harmonic Patterns only limits to patterns mentioned in Harmonic Trading Volume 3 due to other pattern may have other or different philosophy.
Only can be used for Daily timeframe and below due to bar_time is based on minutes by default.
Not recommended for Weekly and Monthly timeframe.
If Point X, A, B, C and D is next to each other, it is recommend to use lower timeframe.
Automated alert is not supported for this release. However, alert can be done manually. Alert will updated on the version.
█ PINE SCRIPT LIMITATIONS
Known bug for when calculate time in array, causing label may not appeared or offset.
Unable to convert to library due to usage of array.get(). I prefer usage for a combination of array.get(id, 0), array.get(id, 1), array.get(id, 2) into custom function, however I faced this issue during make arrays of label. Index can be simply refered as int, for id, i not sure, already try id refered as simple, nothing happens.
linefill.new() will appeared as diamond box if overused.
Text in box.new() unable to use ternary condition or switch to change color. Bgcolor also affected.
Label display is larger than XABCD tool. Hopefully in future, have function to resize label similar to XABCD tools.
█ IMPORTANTS
Trade Management (Profit & Loss) is calculated from Point A to D.
Take Profit is calculated based on ratio 0.382 and 0.618 of Point A to D.
Always check BC validity before proceed to Trade Management.
Length of XABCD is equal to XAB plus BCD, where XAB and BCD are one to one ratio. Length is measured in time.
Use other oscillator to countercheck. Normally use built-in Relative Strength Index (RSI) and Divergence Indicator to determine starting point of Point X and A.
█ HARMONIC PATTERNS SUPPORTED
// Credits to Scott M Carney, author of Harmonic Trading Volume 3: Reaction vs. Reversal
Alt Bat - Page 101
Bat - Page 98
Crab - Page 104
Gartley - Page 92
Butterfly - Page 113
Deep Crab - Page 107
Shark - Page 119 - 220
█ FAQ
Pattern such as 5-0, perfect XABCD and ABCD that not included, will updated on either next version or new release.
Point D time is for approximation only, not including holidays and extended session.
Basic explaination for Harmonic Trading System (Trade Identification, Trade Execution and Trade Management).
Harmonic Patterns values is pretty much summarized here including Stop Loss.
Basic explanation for Alt Bat, Bat, Crab, Gartley, Deep Crab and Butterfly.
█ USAGE / TIPS EXAMPLES (Description explained in each image)
Manual Buy & Sell AlertsThis strategy is not an automation strategy.
It is a tool that generates an 'alerts' so that you can buy and sell it at a predetermined price.
The user can set the contents below.
1. Period
2. Entry price and entry type.
1) buy STOP
2) buy LIMIT
3. Target price.
4. stop loss price.
You can easily test by changing the period value and the set value.
I hope it will help you. Thank you.
Profit Maxima: a crypto strategyThis strategy is designed for those who are looking for long-term positions with low risk and high profitability.
How does it work?
In short, the basis of this strategy is the frequent modeling of the price using regression equations and the estimation of the range of price movements.
The price modeling process starts from the first bars and will be repeated on each bar. This process is performed in each candle based on the data available up to that candle, and data for subsequent bars is not used.
There is also no fixed price model, but it will change from one candle to the next; Therefore, the more candles there are, the larger the statistical population and therefore the quality of the price model increases.
I have also used the concept of scarcity. Bitcoin is the first scarce digital object in the world. Once something becomes scarce enough, it can be used as money. This scarcity gradually increases and affects the price. The entire crypto market also follows Bitcoin.
However, always remember that past results in no way guarantee future performance.
Why this strategy generates a small number of trades?
Preston Pysh believed Bitcoin cycles happen in three phases: the Bull Run, the Correction, and the Reversion to the Mean. He estimates there are about 200,000 blocks per cycle and there are about 144 blocks per day.
Therefore, each cycle of Bitcoin lasts about four years. The entire crypto market follows bitcoin. On the other hand, cryptocurrency is a new phenomenon. They have a limited price history.
This strategy is designed to open a long position at the lowest possible price. In addition, due to the concept of scarcity and its continued impact on prices, trading in the “short” direction is avoided.
The combination of these factors leads to generate a small number of trades. However, you can test it on several different charts to make sure it works properly.
Default settings
{ default_qty_type } = strategy.percent_of_equity
{ default_qty_value } = 3.3
{ commission_value } = 0.1
{ pyramiding } = 3
{ close_entries_rule } = "ANY"
In a simple word, buy (Entry) and sell (take-profit) orders are each done at three different levels. At each level, 3.3% of equity is used (9.9% in total)
0.1% commission is considered for each transaction.
“close_entries_rule” determines the order in which orders are closed. The default is FIFO (first in, first out), but in this strategy, orders are executed in “first in, last out” order. In this way, the lowest buy (Entry) order corresponds to the lowest sell (take profit) order.
Choose the best chart
Charts have a significant impact on the performance of the strategy. As mentioned, the more historical bars there are, the larger the statistical population and therefore the quality of the price model increases.
You can use the Chart Quality panel to choose the appropriate chart:
The ‘Historical Bars’ field shows the number of candles in the chart. Choose the chart of an exchange that has the most historical bars.
The ‘Recommended Chart’ field shows the suggested chart for some symbols.
The “Predictability” field indicates to what extent price movements can be predicted using the model; the higher the “predictability”, the more credible the results of the strategy. "Predictability" indicates that the results of the strategy are reliable or not.
The image below shows the recommended chart for 20 different symbols:
How to use
You don't need automated trading platforms to use it. It can be used by placing simple buy and sell (take-profit) orders manually.
The green and red lines indicate the 'Entry' and 'Profit' levels respectively. If there is no order (buy / sell) active on one of these levels, it will be displayed in gray. The corresponding values are displayed in the Entry & Profit Limits table.
After choosing the appropriate chart, you can use this table to place your orders manually.
Note that trading in the "short" direction is not recommended at all.
Samples
[BT] - Manual TSSL [ALERTS] v1Manual TSSL - V1
Enter the market on your own, and use this script to alert you when to sell. I found myself many times in position but wanted a script to help automatically exit the market when I stepped away.
Directions
You must provide the timestamp and price in the settings. Adjust the TSSL settings, make sure you leave enough room so the market can breath. Once the price goes below the bottom TSSL red line, is when the alert will trigger. Added some labels to keep track of the buy/sell and when the bottom TSSL price moves up.
If you like this idea, but would like another indicator instead of TSSL, please feel free to message me directly.
Thanks for looking!
Triple MA 5-period forecast [Siem]This script calculates 3 MAs and forecasts where these MAs will be in the next 5 future periods.
Automatic mode - price will be based on current price ("flat") or an X-period linear regression ("linreg").
Manual mode - enter your own value('s): let's see where the MA's will be when your favourite equity all of a sudden hits 1 million tomorrow!
based on Triple MA Forecast by yatrader2 , idea by anthnyl