Price Cross Time Custom Range Interactive█ OVERVIEW
This indicator was a time-based indicator and intended as educational purpose only based on pine script v5 functions for ta.cross() , ta.crossover() and ta.crossunder() .
I realised that there is some overlap price with the cross functions, hence I integrate them into Custom Range Interactive with value variance and overlap displayed into table.
This was my submission for Pinefest #1 , I decided to share this as public, I may accidentally delete this as long as i keep as private.
█ INSPIRATION
Inspired by design, code and usage of CAGR. Basic usage of custom range / interactive, pretty much explained here . Credits to TradingView.
█ FEATURES
1. Custom Range Interactive
2. Label can be resize and change color.
3. Label show tooltip for price and time.
4. Label can be offset to improve readability.
5. Table can show price variance when any cross is true.
6. Table can show overlap if found crosss is overlap either with crossover and crossunder.
7. Table text color automatically change based on chart background (light / dark mode).
8. Source 2 is drawn as straight line, while Source 1 will draw as label either above line for crossover, below line for crossunder and marked 'X' if crossing with Source 2's line.
9. Cross 'X' label can be offset to improve readability.
10. Both Source 1 and Source 2 can select Open, Close, High and Low, which can be displayed into table.
█ LIMITATIONS
1. Table is limited to intraday timeframe only as time format is not accurate for daily timeframe and above. Example daily timeframe will give result less 1 day from actual date.
2. I did not include other sources such external source or any built in sources such as hl2, hlc3, ohlc4 and hlcc4.
█ CODE EXPLAINATION
I pretty much create custom function with method which returns tuple value.
method crossVariant(float price = na, chart.point ref = na) =>
cross = ta.cross( price, ref.price)
over = ta.crossover( price, ref.price)
under = ta.crossunder(price, ref.price)
Unfortunately, I unable make the labels into array which i plan to return string value by getting the text value from array label, hence i use label.all and add incremental int value as reference.
series label labelCross = na, labelCross.delete()
var int num = 0
if over
num += 1
labelCross := label.new()
if under
num += 1
labelCross := label.new()
if cross
num += 1
labelCross := label.new()
I realised cross value can be overlap with crossover and crossunder, hence I add bool to enable force overlap and add additional bools.
series label labelCross = na, labelCross.delete()
var int num = 0
if forceOverlap
if over
num += 1
labelCross := label.new()
if under
num += 1
labelCross := label.new()
if cross
num += 1
labelCross := label.new()
else
if cross and over
num += 1
labelCross := label.new()
if cross and under
num += 1
labelCross := label.new()
if cross and not over and not under
num += 1
labelCross := label.new()
█ USAGE / EXAMPLES
Interactive
Interactive MA Stop Loss [TANHEF]This indicator is "Interactive." Once added to the chart, you need to click the start point for the moving average stoploss. Dragging it afterward will modify its position.
Why choose this indicator over a traditional Moving Average?
To accurately determine that a wick has crossed a moving average, you must examine the moving average's range on that bar (blue area on this indicator) and ensure the wick fully traverses this area.
When the price moves away from a moving average, the average also shifts towards the price. This can make it look like the wick crossed the average, even if it didn't.
How is the moving average area calculated?
For each bar, the moving average calculation is standard, but when the current bar is involved, its high or low is used instead of the close. For precise results, simply setting the source in a typical moving average calculation to 'Low' or 'High' is not sufficient in calculating the moving average area on a current bar.
Moving Average Options:
Simple Moving Average
Exponential Moving Average
Relative Moving Average
Weighted Moving Average
Indicator Explanation
After adding indicator to chart, you must click on a location to begin an entry.
The moving average type can be set and length modified to adjust the stoploss. An optional profit target may be added.
A symbol is display when the stoploss and profit target are hit. If a position is create that is not valid, "Overlapping MA and Bar" is displayed.
Alerts
'Check' alerts to use within indicator settings (stop hit and/or profit target hit).
Select 'Create Alert'
Set the condition to 'Interactive MA''
Select create.
Alert messages can have additional details using these words in between two Curly (Brace) Brackets:
{{stop}} = MA stop-loss (price)
{{upper}} = Upper MA band (price)
{{lower}} = Lower MA band (price)
{{band}} = Lower or Upper stoploss (word)
{{type}} = Long or Short stop-loss (word)
{{stopdistance}} = Stoploss Distance (%)
{{targetdistance}} = Target Distance (%)
{{starttime}} = Start time of stoploss (day:hour:minute)
{{maLength}} = MA Length (input)
{{maType}} = MA Type (input)
{{target}} = Price target (price)
{{trigger}} = Wick or Close Trigger input (input)
{{ticker}} = Ticker of chart (word)
{{exchange}} = Exchange of chart (word)
{{description}} = Description of ticker (words)
{{close}} = Bar close (price)
{{open}} = Bar open (price)
{{high}} = Bar high (price)
{{low}} = Bar low (price)
{{hl2}} = Bar HL2 (price)
{{volume}} = Bar volume (value)
{{time}} = Current time (day:hour:minute)
{{interval}} = Chart timeframe
{{newline}} = New line for text
I will add further moving averages types in the future. If you suggestions post them below.
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
Limit Order + ATR Stop-Loss [TANHEF]This indicator enables interactive placement of limit or stop-limit orders with a trailing ATR stop-loss and optional profit target (with alerts). Refer to the images below for further clarification.
Why use a trailing stop-loss?
A trailing stop-loss serves as an exit strategy when price moves against you, while also allowing you to adjust the exit point further into profit when price moves favorably. The ATR (Average True Range), a reliable measure of volatility, acts as an effective risk management tool, functioning as a trailing stop-loss.
Indicator Explanation
Initial indicator placement: Select Long Limit or Long-Stop Limit order.
Change Entry Type: Switch between Long and Short within settings.
Modify entry price: Drag circle, adjust in settings, or re-add indicator to chart.
Optional Profit Target: Use Risk/Reward ratio or specify price.
Entry anticipation: Estimated ATR stop-loss and profit target as blue circles (fluctuates with volatility changes).
Entry triggered: Actual ATR stop-loss and profit target plotted.
Exit conditions: Stop-loss or profit target hit, exit entry.
Update Frequency: Continuously, Bar Open, or Bar Open on entry then continuously.
ATR Overlap: no entry occurs if the ATR overlaps with price (stop-loss 'hit' already on entry bar)
Table: Displays input settings selected.
Show Only On Ticker: Ability to hide indicator on other tickers.
Long Limit
Long Stop-Limit
Short Limit
Short Stop-Limit
Alerts
1. 'Check' alerts to use within indicator settings (entry, trailing stop hit, profit target hit, and failed entry).
2. Select 'Create Alert'
3. Set the condition to 'Limit Order + ATR Stop-Loss''
4. Select create.
Additional details can be added to the alert message using these words in between Curly (Brace) Brackets:
{{trail}} = ATR trailing stop-loss (price)
{{target}} = Price target (price)
{{type}} = Long or Short stop-loss (word)
{{traildistance}} = Trailing Distance (%)
{{targetdistance}} = Target Distance (%)
{{starttime}} = Start time of position (day:hr:min)
{{maxdrawdown}} = max loss
{{maxprofit}} = max profit
{{update}} = stoploss update frequency
{{entrysource}} = entry as 1st bar source (yes/no)
{{triggerentry}} = Wick/Close Trigger entry input
{{triggerexit}} = Wick/Close Trigger exit input
{{triggertarget}} = Wick/Close Trigger target input
{{atrlength}} = ATR length input
{{atrmultiplier}} = ATR multiplier input
{{atrtype}} = ATR type input
{{ticker}} = Ticker of chart (word)
{{exchange}} = Exchange of chart (word)
{{description}} = Description of ticker (words)
{{close}} = Bar close (price)
{{open}} = Bar open (price)
{{high}} = Bar high (price)
{{low}} = Bar low (price)
{{hl2}} = Bar HL2 (price)
{{volume}} = Bar volume (value)
{{time}} = Current time (day:hr:min)
{{interval}} = Chart timeframe
{{newline}} = New line for text
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)
Interactive ATR 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 (ATR Trailing Stop-loss start point). 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 ATR (Average True Range) which is used to measure volatility, 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 ATR 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.
The ATR Stop Loss plotted. Note that the trailing value that is considered as the stop loss value is the value of the ATR from the prior candle. The settings for the ATR calculation can be modified within the settings.
An optional fixed profit target can be added within the settings. This profit target will only actively be plotted when the ATR Trailing Stop-loss has not be hit hit yet or until the profit target has been hit.
Here shows that the profit target was hit, then later on the ATR 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.
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 ATR''
4. Select create.
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)
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)
Support Resistance InteractiveHello All,
Using this "Support Resistance Interactive" script you can set the Support/Resistance levels interactively by clicking on the chart. Using the SR levels you set, the indicator creates Support Resistance zones. The width of the zones are calculated by using Threshold option and Threshold is the percent of the distance between Highest/Lowest levels in last 300 bars. if you set Threshold = 1 then it means 1% of the distance between Highest/Lowest levels. You can change SR levels by moving the level up/down by using your mouse anytime you want.
Now lets see it step by step;
After you added the indicator it will ask 5 Support/Resistance Levels and when you click any point then it's kept as S/R level and it asks another SR levels. if you want to use only 3 SR levels then last 2 SR levels are not important and you can click anywhere on the chart;
After you set all SR levels, it will ask "Number of Support/Resistance" . if you want to activate first 3 SR lines then set it 3. by default it's 5. when you set it click "Apply" and see the SR zones. that's it.
You can enable/disable alerts and set frequency, then create alerts. as it's interactive tool, the SR levels you set are specific for the current/active symbol. if you open another symbol then you better delete the indicator and add it again
Three Alerts exist in the script: Support Broken, Resistance Broken and Price in SR zone . you can enable/disable the alerts as you wish and you can set frequency for each one as "Once Per Bar" or "Once Per Bar Close"
by default Green/Red/Gray colors are used but You can change the colors using the options. according to the Price moves, SR zone colors are changed automatically.
when we have "Reset" feature to run the script interactively (like we added it for first time) I can update the script, then you will not need to delete/re-add each time you changed the symbol :)
In this example "Threshold" is 2 and "Number of Support/Resistance" is 4.
in this example "Threshold" is 0 and "Number of Support/Resistance" is 5.
Last example; Labels are shown for each zone, you can set location of the labels. SR order and Upper/lower band of each zone are shown in each label.
Enjoy!
[pp] Fib AlertsUsing the new input.price() function we can now automate our fibonacci tools a little better.
This tool is designed with the intention of trading off of a fibonacci level using alerts.
How to use:
1.Add the indicator to your chart.
2. Place the bottom price where you would normally start your fibonnaci drawing
3. Place the top price where you would normally end your fibonacci drawing
4. Set your alert syntax "buy alert message" and "sell alert message" Should be replaced with webhook configurations or something better.
5. Fibonacci values > 1 (ie. 0.382, 0.5, 0.618) are recognized as retracements and work well as buying opportunities. When the price crosses one of these levels the "buy alert message" alert will be immediately triggered ONCE per BAR (I may update this in the future so it can only trigger ONCE ever to avoid multiple orders)
6. Fibonacci values < 1 (ie . -0.113, -0.27) are recognized as extensions levels and work well as selling opportunities. When the price crosses one of these levels the "Sell alert message" alert will be triggered.
If anyone knows how to convert the fibonacci values to logarithmic values I would greatly appreciate insight.