LevelsManagerLibrary "LevelsManager"
TODO: Track up to 6 TakeProfits and 1 StopLoss achievement for one or many of your buy/sell conditions.
manageTrade(bool, bool, bool, string, string, float, float, bool, bool, bool, bool, bool, bool, float, float, float, float, float, float, float)
Track TakeProfits and StopLoss achievement for one or many of your buy/sell conditions. CHECK the commented section: "Function @manageTrade" for Description
Parameters:
bool : useSignal.
bool : b_gameOVer.
bool : b_gameOVer.
string : bName.
string : sName.
float : buyEntrySource.
float : sellEntrySource.
bool : useTp1.
bool : useTp2.
bool : useTp3.
bool : useTp4.
bool : useTp5.
bool : useTp6.
float : tp1x.
float : tp2x.
float : tp3x.
float : tp4x.
float : tp5x.
float : tp6x.
float : slx.
Returns: check commented section: "Function @manageTrade".
showOnlyFirstOccurence(booleanInput)
Single out the occurence of a bool series between to 2 bool series.
Parameters:
booleanInput : to activate or deactivate occurences filtering.
Returns: filterred or not bool series.
Alerts
CalculatePercentageSlTpLibrary "CalculatePercentageSlTp"
This Library calculate the sl and tp amount in percentage
sl_percentage(entry_price, sl_price)
this function calculates the sl value in percentage
Parameters:
entry_price : indicates the entry level
sl_price : indicates the stop loss level
Returns: stop loss in percentage
tp_percentage(entry_price, tp_price)
this function calculates the tp value in percentage
Parameters:
entry_price : indicates the entry level
tp_price : indicates the take profit level
Returns: take profit in percentage
sl_level(entry_price, sl_percentage)
this function calculates the sl level price
Parameters:
entry_price : indicates the entry level
sl_percentage : indicates the stop loss percentage
Returns: stop loss price in $
tp_level(entry_price, tp_percentage)
this function calculates the tp level price
Parameters:
entry_price : indicates the entry level
tp_percentage : indicates the take profit percentage
Returns: take profit price in $
RouterOrdersIronLibrary "RouterOrdersIron"
Library for routing orders to the Binance exchange.
MsgDoLongMKT(id, symbol, balance)
Returns json for Iron to buy a symbol for the amount of the balance with market order.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
MsgDoShortMKT(id, symbol, balance)
Returns json for Iron to sell a symbol for the amount of the balance with market order.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
MsgDoLongLR(id, symbol, balance)
Returns json for Iron to buy a symbol for the amount of the balance. It is set at the best price and is re-set each time if a new price has risen before the application.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
MsgDoShortLR(id, symbol, balance)
Returns json for Iron to sell a symbol for the amount of the balance. It is set at the best price and is re-set each time if a new price has risen before the application.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
DoLongMKT(id, symbol, balance)
Buy a symbol for the amount of the balance. It is send market order to Iron.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
DoShortMKT(id, symbol, balance)
Sell a symbol for the amount of the balance. It is send market order to Iron.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
DoLongLR(id, symbol, balance)
Buy a symbol for the amount of the balance. It is set at the best price and is re-set each time if a new price has risen before the application.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
DoShortLR(id, symbol, balance)
Sell a symbol for the amount of the balance. It is set at the best price and is re-set each time if a new price has risen before the application.
Parameters:
id : ID of your Iron router.
symbol : Symbol for a trade, BTC example
balance : The amount for which to carry out the transaction.
Returns: true
GetQty(price, balance)
Get Qty for strategy on balance
Parameters:
price : Order price
balance : The amount for which to carry out the transaction.
Returns: Qty for strategy order TV
RecursiveAlertsLibrary "RecursiveAlerts"
The library provides options to run alert() calls in loop without worrying about limitations of frequency options.
When an alert statement is called within a loop,
it will fire just once per bar irrespective of how many iterations allowed when fequency is set to alert.freq_once_per_bar or alert.freq_once_per_bar_close
it will fire continuously till it breaks when frequency is set to alert.freq_all
The function helps overcome this issue by using varip key array which resets on every bar
rAlert(message, key) Enhanced alert which can be used in loops
Parameters:
message : Alert message to be fired
key : Key to be checked to avoid repetitive alerts
Returns: array containing id of already fired alerts
Thanks to @theheirophant, @JohnBaron and @LucF for discussions and suggestion which eventually lead to this solution :)
TradingHookLibrary "TradingHook"
This library is a client script for making a webhook signal formatted string to TradingHook webhook server.
buy_message(password, amount, order_name) Make a buy Message for TradingHook.
Parameters:
password : (string) password that you set in .env file.
amount : (float) amount. If not set, your strategy qty will be sent.
order_name : (string) order_name. The default name is "Order".
Returns: (string) A string containing the formatted webhook message.
sell_message(password, percent, order_name) Make a sell message for TradingHook.
Parameters:
password : (string) password that you set in .env file.
percent : (string) what percentage of your quantity you want to sell.
order_name : (string) order_name. The default name is "Order".
Returns: (string) A string containing the formatted webhook message.
You can use TradingHook WebServer open source code in github(github.com)
PlurexSignalIntegrationLibrary "PlurexSignalIntegration"
Provides tools for integrating Strategies and Alerts into plurex.io signals.
plurexMarket() Build a Plurex market from a base and quote asset symbol.
Returns: A market string that can be used in Plurex Signal messages.
tickerToPlurexMarket() Builds simple Plurex market string from the syminfo
Returns: A market string that can be used in Plurex Signal messages.
simpleMessage(secret, action, marketOverride) Builds simple Plurex Signal Messages
Parameters:
secret : The secret for your Signal on plurex
action : The action of the message. One of .
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
Returns: A json string message that can be used in alerts to send messages to Plurex.
executeStrategy(secret, openLong, openShort, closeLongs, closeShorts, marketOverride) Executes strategy actions with Plurex Signal messages
Parameters:
secret : The secret for your Signal on plurex
openLong : Strategy should open long if true, aggregated with other boolean values
openShort : Strategy should open short if true, aggregated with other boolean values
closeLongs : Strategy should close longs if true, aggregated with other boolean values
closeShorts : Strategy should close shorts if true, aggregated with other boolean values
marketOverride : Optional, defaults to the syminfo for the ticker. Use the `plurexMarket` function to build your own.
AllTimeHighLowLibrary "AllTimeHighLow"
Provides functions calculating the all-time high/low of values.
hi(val) Calculates the all-time high of a series.
Parameters:
val : Series to use (`high` is used if no argument is supplied).
Returns: The all-time high for the series.
lo(val) Calculates the all-time low of a series.
Parameters:
val : Series to use (`low` is used if no argument is supplied).
Returns: The all-time low for the series.
Timed_exit_alert_for_webhookLibrary "Timed_exit_alert_for_webhook"
TODO: add library description here
fun(x) TODO: add function description here
Parameters:
x : TODO: add parameter x description here
Returns: TODO: add what function returns
for exiting FCM like Tradovate and AMP using API and python MT5 and Webhooks
the writer take no responsibility for trades made using this script its written for informational purposes only
MakeLoveNotWarLibrary "MakeLoveNotWar"
Make Love Not War, place a flag of support on your chart!
flag(pos, text_size) Make Love Not War function.
Parameters:
pos : string, position.
text_size : string, text size.
Returns: table.
bytimeLibrary "bytime"
TODO: to do something at the specified time.
////Return =>> ht = hour , mt = minute , st = second ,Dt = Day, Mt = month, Yt = year , dateTime = full time format./////////////
Note : Remember to always add import when you call our library and change Gtime() to Timeset.Gtime() is used to access internal data.
import hapharmonic/bytime/1 as Timeset
=Timeset.Gtime()
/////////////Set a time to trigger an alert./////////////
ck = false
///hour : minute : second
if ht == TH and mt == TM and st == TS
//some action
//...
//.
ck := true
Gtime()
LukashereLibrary "Lukashere"
TODO: add library description here
fun(x) TODO: add function description here
Parameters:
x : TODO: add parameter x description here
Returns: TODO: add what function returns
Percentual2nu()
getMA()
SymbolsTopMarketcap()
OteHmacSha256Library "OteHmacSha256"
Library to use HMAC SHA-256 by OgahTerkenal
hmac_sha256(string) HMAC SHA-256
Parameters:
string : msg String to be hashed
Returns: Return a hashed string in hex format and an array of 8 32 bits integer
Library to use HMAC SHA-256 for authenticating alert message going out from TradingView.
It has limitation on allowed characters (because PineScript cannot access the underlying bits of each ASCII) from ASCII 32 to 126 only.
Usage Example section at the end of the source code pretty much tell everything about this library.
General example as how to import to your PineScript code is not included (please refer to the PineScript manual).
StocksDeveloper_AutoTraderWebLibrary "StocksDeveloper_AutoTraderWeb"
AutoTrader Web trading API functions implementation for Trading View.
preparePlaceOrderJson(account, symbol, group, variety) Prepare a place order json
Parameters:
account : Pseudo or group account number
symbol : AutoTrader Web's stock/derivative symbol
group : Set it to true to use group account (Default: false)
variety : Variety (Default: REGULAR)
Returns: A json message for the given order data
preparePlaceOrderAlertUsingOrderJson(orderJsonArray) Prepare a place order alert message using order json array
Parameters:
orderJsonArray : Order json can contain one or more orders
Returns: A complete alert message to place orders
preparePlaceOrderAlertMessage(account, symbol, group, variety, validity) Prepare a place order alert json message
Parameters:
account : Pseudo or group account number
symbol : AutoTrader Web's stock/derivative symbol
group : Set it to true to use group account (Default: false)
variety : Variety (Default: REGULAR)
validity : Validity (Default: DAY)
Returns: A complete alert message to place orders
The Divergent LibraryLibrary "TheDivergentLibrary"
The Divergent Library is only useful when combined with the Pro version of The Divergent - Advanced divergence indicator . This is because the Basic (free) version of The Divergent does not expose the "Divergence Signal" value.
Usage instructions:
1. Create a new chart
2. Add The Divergent (Pro) indicator to your chart
3. Create a new strategy, import this library, add a "source" input, link it to "The Divergent: Divergence Signal", and use the library to decode the divergence signals from The Divergent (You can find example strategy code published in our profile)
4. Act on the divergences signalled by The Divergent
---
isRegularBullishEnabled(context) Returns a boolean value indicating whether Regular Bullish divergence detection is enabled in The Divergent.
Parameters:
context : The context of The Divergent Library.
Returns: A boolean value indicating whether Regular Bullish divergence detection is enabled in The Divergent.
isHiddenBullishEnabled(context) Returns a boolean value indicating whether Hidden Bullish divergence detection is enabled in The Divergent.
Parameters:
context : The context of The Divergent Library.
Returns: A boolean value indicating whether Hidden Bullish divergence detection is enabled in The Divergent.
isRegularBearishEnabled(context) Returns a boolean value indicating whether Regular Bearish divergence detection is enabled in The Divergent.
Parameters:
context : The context of The Divergent Library.
Returns: A boolean value indicating whether Regular Bearish divergence detection is enabled in The Divergent.
isHiddenBearishEnabled(context) Returns a boolean value indicating whether Hidden Bearish divergence detection is enabled in The Divergent.
Parameters:
context : The context of The Divergent Library.
Returns: A boolean value indicating whether Hidden Bearish divergence detection is enabled in The Divergent.
getPivotDetectionSource(context) Returns the 'Pivot Detection Source' setting of The Divergent. The returned value can be either "Oscillator" or "Price".
Parameters:
context : The context of The Divergent Library.
Returns: One of the following string values: "Oscillator" or "Price".
getPivotDetectionMode(context) Returns the 'Pivot Detection Mode' setting of The Divergent. The returned value can be either "Bodies" or "Wicks".
Parameters:
context : The context of The Divergent Library.
Returns: One of the following string values: "Bodies" or "Wicks".
isLinked(context) Returns a boolean value indicating the link status to The Divergent indicator.
Parameters:
context : The context of The Divergent Library.
Returns: A boolean value indicating the link status to The Divergent indicator.
init(firstBarSignal, displayLinkStatus, debug) Initialises The Divergent Library's context with the signal produced by The Divergent on the first bar. The value returned from this function is called the "context of The Divergent Library". Some of the other functions of this library requires you to pass in this context.
Parameters:
firstBarSignal : The signal from The Divergent indicator on the first bar.
displayLinkStatus : A boolean value indicating whether the Link Status window should be displayed in the bottom left corner of the chart. Defaults to true.
debug : A boolean value indicating whether the Link Status window should display debug information. Defaults to false.
Returns: A bool array containing the context of The Divergent Library.
processSignal(signal) Processes a signal from The Divergent and returns a 5-tuple with the decoded signal: [ int divergenceType, int priceBarIndexStart, int priceBarIndexEnd, int oscillatorBarIndexStart, int oscillatorBarIndexEnd]. `divergenceType` can be one of the following values: na → No divergence was detected, 1 → Regular Bullish, 2 → Regular Bullish early, 3 → Hidden Bullish, 4 → Hidden Bullish early, 5 → Regular Bearish, 6 → Regular Bearish early, 7 → Hidden Bearish, 8 → Hidden Bearish early.
Parameters:
signal : The signal from The Divergent indicator.
Returns: A 5-tuple with the following values: [ int divergenceType, int priceBarIndexStart, int priceBarIndexEnd, int oscillatorBarIndexStart, int oscillatorBarIndexEnd].
options_expiration_and_strike_price_calculatorLibrary "options_expiration_and_strike_price_calculator"
TODO: add library description here
fun()
this is a library to help calculate options strike price and expiration that you can add to a script i use it mainly for symbol calulation to place orders to buy options on TD ameritrade so it will be set up to order options on TD ameritrade using json order placer and webhook it fills in the area in the json under symbol i suggest manually adding the year it should look like this is an example of an order to buy 10 call options using json through td ameritrade api
"complexOrderStrategyType": "NONE",
"orderType": "LIMIT",
"session": "NORMAL",
"price": "6.45",
"duration": "DAY",
"orderStrategyType": "SINGLE",
"orderLegCollection":
}
DiscordWebhookFunctionLibrary "DiscordWebhookFunction"
discordMarkdown(_str, _italic, _bold, _code, _strike, _under) Convert string to markdown formatting User can combine any function at the same time.
Parameters:
_str : String input
_italic : Italic
_bold : Bold
_code : Code markdown
_strike : Strikethrough
_under : Underline
Returns: string Markdown formatted string.
discordWebhookJSON(_username, _avatarImgUrl, _contentText, _bodyTitle, _descText, _bodyUrl, _embedCol, _timestamp, _authorName, _authorUrl, _authorIconUrl, _footerText, _footerIconUrl, _thumbImgUrl, _imageUrl) Convert data to JSON format for Discord Webhook Integration.
Parameters:
_username : Override bot (webhook) username string / name,
_avatarImgUrl : Override bot (webhook) avatar by image URL,
_contentText : Main content page message,
_bodyTitle : Custom Webhook's embed message body title,
_descText : Webhook's embed message body description,
_bodyUrl : Webhook's embed body direct link URL,
_embedCol : Webhook's embed color,
_timestamp : Timestamp,
_authorName : Webhook's embed author name / title,
_authorUrl : Webhook's embed author direct link URL,
_authorIconUrl : Webhook's embed author icon by image URL,
_footerText : Webhook's embed footer text / title,
_footerIconUrl : Webhook's embed footer icon by image URL,
_thumbImgUrl : Webhook's embed thumbnail image URL,
_imageUrl : Webhook's embed body image URL.
Returns: string Single-line JSON format
Algomojo V1.0Library "Algomojo"
This library brings faster access to Automate trades. It simplifies the execution rules and helps
traders to implement faster algo trading strategies.
algomodule()
Simple Watchlist with % Change Screener & AlertsHi fellow traders..
TV has generously increased the number of alerts!!
A Simple Watchlist with heatmap based on % change on daily timeframe.
Gives % change and RSI
you can set the percentage in the input box and then set alerts on your favorite watchlist.
Alerts also include days high and low..
Simple Table and array based code.
set for scrip close >10 can be easily changed in line 43..
Hope you Like it!
Light BalanceThe script is simple, going for a color scheme logic which tenderly avoids rigorous signals processing.
For the script to remain simple, logical derivatives are also out; as such, there are no secondary relations built off of primary ones. And it also ignores (unless you do this yourself) the logic in a varying order of lines.
Coloring has been done according to a limited set of relations between the four (4) plotted lines.
Quite a bit of information is capture, as you'll see when looking at line order, crossings, and transparency transitions and their patterns.
The approach makes the relations ones which can be learned over time; you become the algorithm to sort out signals. Ha ha. I know that sounds like a cop out doesn't it. Did I mention it's a simple script?
One thing you might want to play with right away are fills having red and green, and lime and fuchsia. It would be cool to reduce it all down to two (2) colors, but all the boolean relations might have to be listed, and it also may not be possible to cumulatively combine transparency overlays of the same value. Visually, that approach may not result to awaken a useful feature anyway. Also, fill() has its limitations in that it cannot be in a local scope; this includes function wrapped calls to fill(), or calls made using branching logic statements if/elseif, iff(), and var = (cond) ? t_val/exp : f_val/exp. So, to my knowledge, a fill() can not be made to be logically on/off.
Please, enjoy getting some use out of it.
Volume Records + AlertContents
Overall Introduction
Settings menu parameters
Usage
How to use alerts
Limits
Overall Introduction
This indicator is a "volume analysis" tool for confirming the direction and strength of price trend and spotting trend reversals. This tool consists of two parts:
1- The colored graph is a custom volume oscillator which shows the relative changes in volume.
The darkening of the color of the bars is a sign of increasing volume.
2- Triangular labels that show trading volume records over different time periods based on the absolute values of the volume.
By creating an alert, you can be notified of new trading volume records. These records are:
Highest / lowest volume in one year,
Highest / lowest volume in six month
Highest / lowest volume in three month
Highest / lowest volume in one month
Highest / lowest volume in one week
Settings menu parameters
{Short Length} =>
The fast volume MA of the Volume Oscillator.
{Long Length} =>
The slow volume MA of the Volume Oscillator.
{Visual Parameters} =>
Parameters to personalize the appearance of the indicator.
{Alert Conditions Part 01: Highest Records ⏰ } =>
Parameters to customize the alert.
{Alert Conditions Part 02: Lowest Records ⏰ } =>
Parameters to customize the alert.
Usage
This indicator is a "volume analysis" tool for confirming the direction and strength of price trend and spotting trend reversals.
What Is Volume Analysis?
Volume analysis involves examining relative or absolute changes in an asset's trading volume in order to make inferences about future price movements.
A significant price increase along with a significant volume increase, for example, could be a credible sign of a continued bullish trend or a bullish reversal.
The gradual darkening of the bars is a sign of the strength of the trend.
Volume can be an indicator of market strength, as rising markets on increasing volume are typically viewed as strong and healthy.
How to use alerts
Note that by creating an alert, an instance of the indicator, with all your settings, will be activated on the site's server and alerts will be triggered by it.
After that, changing the indicator settings on the chart will no longer affect the alert.
Open the settings window and select the alert conditions as you wish
Click the Create Alert button (or press the A key while holding down the ALT key)
In the Condition section, select the name of the indicator.
Make the rest of the settings as you wish.
Finally, click on the Create button.
It's finished. After a few moments, your alert will be added to the Alerts menu.
Limits
The labels are displayed after the bars close.
Labels are displayed for the last 10,000 bars.
Alert(), alertcondition() or strategy alerts?Variety of possibilities offered by PineScript, especially thanks to recent additions, created some confusion. Especially one question repeats quite often - which method to use to trigger alerts?
I'm posting this to clarify and give some syntax examples. I'll discuss these 3 methods in chronological order, meaning - in the order they were introduced to PineScript.
ALERTCONDITION() - it is a function call, which can be used only in study-type script. Since years ago, you could create 2 types of a script: strategy and study. First one enables creating a backtest of a strategy. Second was to develop scripts which didn't require backtesting and could trigger alerts. alertcondition() calls in strategy-type scripts were rejected by Pine compiler. On the other hand compiling study-type scripts rejected all strategy...() calls. That created difficulties, because once you had a nice and backtested strategy, you had to rip it off from all strategy...() function calls to convert your script to study-type so you could produce alerts. Maintenance of two versions of each script was necessary and it was painful.
"STRATEGY ALERTS" were introduced because of alertcondition() pains. To create strategy alert, you need to click "Add alert" button inside Strategy Tester (backtester) and only there. Alerts set-up this way are bound with the backtester - whenever backtester triggers an order, which is visible on the chart, alert is also fired. And you can customize alert message using some placeholders like {{strategy.order.contracts}} or {{ticker}}.
ALERT() was added last. This is an alerts-triggering function call, which can be run from strategy-type script. Finally it is doable! You can connect it to any event coded in PineScript and generate any alert message you want, thanks to concatenation of strings and wrapping variables into tostring() function.
Out of these three alertcondition() is obviously archaic and probably will be discontinued. There is a chance this makes strategy/study distinction not making sense anymore, so I wouldn't be surprised if "studies" are deprecated at some point.
But what are the differences between "Strategy alerts" and alert()? "Strategy alerts" seem easier to set-up with just a few clicks and probably easier to understand and verify, because they go in sync with the backtester and on-chart trade markers. It is especially important to understand how they work if you're building strategy based on pending orders (stop and limit) - events in your code might trigger placing pending order, but alert will be triggered only (and when) such order is executed.
But "Strategy Alerts" have some limitations - not every variable you'd like to include in alert message is available from PineScript. And maybe you don't need the alert fired when the trade hit a stop-loss or take-profit, because you have already forwarded info about closing conditions in entry alert to your broker/exchange.
Alert() was added to PineScript to fill all these gaps. Is allows concatenating any alert message you want, with any variable you want inside it and you can attach alert() function at any event in your PineScript code. For example - when placing orders, crossing variables, exiting trades, but not explicitly at pending orders execution.
The Verdict
"Strategy Alerts" might seem a better fit - easier to set-up and verify, flexible and they fire only when a trade really happens, not producing unnecessary mess when each pending order is placed. But these advantages are illusionary, because they don't give you the full-control which is needed when trading with real money. Especially when using pending orders. If an alert is fired when price actually hit a stop-order or limit-order level, and even if you are executing such alert within 1 second thanks to a tool like TradingConnector, you might already be late and you are making entry at a market price. Slippage will play a great role here. You need to send ordering alert when logical conditions are met - then it will be executed at the price you want. Even if you need to cancel all the pending orders which were not executed. Because of that I strongly recommend sticking to ALERT() when building your alerts system.
Below is an example strategy, showing syntax to manage placing the orders and cancelling them. Yes, this is another spin-off from my TradingView Alerts to MT4 MT5 . As usual, please don't pay attention to backtest results, as this is educational script only.
P.S. For the last time - farewell alertcondition(). You served us well.
Distance Oscillator - Support and Resistance by DGT
Prices high above the Moving Average (MA) or low below it are likely to be remedied in the future by a reverse price movement as stated in the article by Denis Alajbeg, Zoran Bubas and Dina Vasic published in International Journal of Economics, Commerce and Management
This study is the third variant that aims to present this idea, and the output of the study is presented as lines that serve as possible support and resistance levels in the future.
1st variant of the idea is presented as an centered oscillator, link to Price Distance to its MA Study , within its description you may find more about the idea and some statistical observations. Also some derivatives with MACD-X, More Than MACD and P-MACD
2nd variant of the idea are presented as colored triangle line (Volatility Colored Price/MA Line), using the same calculation methods and presented in the bottom of price chart.
Link to studies where it is included : Colored Directional Movement and Bollinger Band's Cloud , SuperTrendRange and Pivot Points vX
3rd variant (this study) as stated earlier aims to present the same idea as support and resistance levels.
Options
The users can adjust source and length of the moving average that is used as base for the distance oscillator
Signal triggering options includes length for the deviation bands, multiplier as well as smoothing of the oscillator
Line customization settings
Additionally an alert can be configured to be warned earlier to watch out for probable pullbacks or reversals
Technical details for whom interested
Calculating the price distance to the MA results in a centered oscillator lets call it Distance Oscillator (quite similar to the RSI), as shown in the blow chart
Unlike RSI, oscillations with the distance oscillator are not limited within a specific range, hence identifying overbought and oversold is not as straight forward as it is with RSI. To determine overbought and oversold levels, standard deviation of distance oscillator is calculated and bands generated with the same approach applied with Bollinger Bands.
Once we have the threshold bands then crossing those bands we may assume as important levels and draw a line, if oscillator values keeps above the threshold bands (deviation bands) the logic behind the code will update the line drawing accordingly.
To reduce noise a smoothing can be applied
Alerts :
Please note that the implementation applied here can be applied to any oscillator such as RSI, Stochastic, MFI etc even Volume (if bear candle volumes are multiplied by -1)
Disclaimer :
Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely
The script is for informational and educational purposes only. Use of the script does not constitute professional and/or financial advice. You alone have the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script