libcompressLibrary "libcompress"
numbers compressor for large output data compression
compress_fp24()
converts float to base64 (4 chars) | 24 bits: 1 sign + 5 exponent + 18 mantissa
Returns: 4-character base64_1/5/18 representation of x
compress_ufp18()
converts unsigned float to base64 (3 chars) | 18 bits: 5 exponent + 13 mantissa
Returns: 3-character base64_0/5/13 representation of x
compress_int()
converts int to base64
Cerca negli script per "alert"
PineHelperLibrary "PineHelper"
This library provides various functions to reduce your time.
recent_opentrade_entry_bar_index()
get a recent opentrade entry bar_index
Returns: (int) bar_index
recent_closedtrade_entry_bar_index()
get a recent closedtrade entry bar_index
Returns: (int) bar_index
recent_closedtrade_exit_bar_index()
get a recent closedtrade exit bar_index
Returns: (int) bar_index
all_opnetrades_roi()
get all aopentrades roi
Returns: (float) roi
bars_since_recent_opentrade_entry()
get bars since recent opentrade entry
Returns: (int) number of bars
bars_since_recent_closedtrade_entry()
get bars since recent closedtrade entry
Returns: (int) number of bars
bars_since_recent_closedtrade_exit()
get bars since recent closedtrade exit
Returns: (int) number of bars
recent_opentrade_entry_id()
get recent opentrade entry ID
Returns: (string) entry ID
recent_closedtrade_entry_id()
get recent closedtrade entry ID
Returns: (string) entry ID
recent_closedtrade_exit_id()
get recent closedtrade exit ID
Returns: (string) exit ID
recent_opentrade_entry_price()
get recent opentrade entry price
Returns: (float) price
recent_closedtrade_entry_price()
get recent closedtrade entry price
Returns: (float) price
recent_closedtrade_exit_price()
get recent closedtrade exit price
Returns: (float) price
recent_opentrade_entry_time()
get recent opentrade entry time
Returns: (int) time
recent_closedtrade_entry_time()
get recent closedtrade entry time
Returns: (int) time
recent_closedtrade_exit_time()
get recent closedtrade exit time
Returns: (int) time
time_since_recent_opentrade_entry()
get time since recent opentrade entry
Returns: (int) time
time_since_recent_closedtrade_entry()
get time since recent closedtrade entry
Returns: (int) time
time_since_recent_closedtrade_exit()
get time since recent closedtrade exit
Returns: (int) time
recent_opentrade_size()
get recent opentrade size
Returns: (float) size
recent_closedtrade_size()
get recent closedtrade size
Returns: (float) size
all_opentrades_size()
get all opentrades size
Returns: (float) size
recent_opentrade_profit()
get recent opentrade profit
Returns: (float) profit
all_opentrades_profit()
get all opentrades profit
Returns: (float) profit
recent_closedtrade_profit()
get recent closedtrade profit
Returns: (float) profit
recent_opentrade_max_runup()
get recent opentrade max runup
Returns: (float) runup
recent_closedtrade_max_runup()
get recent closedtrade max runup
Returns: (float) runup
recent_opentrade_max_drawdown()
get recent opentrade maxdrawdown
Returns: (float) mdd
recent_closedtrade_max_drawdown()
get recent closedtrade maxdrawdown
Returns: (float) mdd
max_open_trades_drawdown()
get max open trades drawdown
Returns: (float) mdd
recent_opentrade_commission()
get recent opentrade commission
Returns: (float) commission
recent_closedtrade_commission()
get recent closedtrade commission
Returns: (float) commission
qty_by_percent_of_equity(percent)
get qty by percent of equtiy
Parameters:
percent : (series float) percent that you want to set
Returns: (float) quantity
qty_by_percent_of_position_size(percent)
get size by percent of position size
Parameters:
percent : (series float) percent that you want to set
Returns: (float) size
is_day_change()
get bool change of day
Returns: (bool) day is change or not
is_in_trade()
get bool using number of bars
Returns: (bool) allowedToTrade
discord_message(name, message)
get json format discord message
Parameters:
name : (string) name of bot
message : (string) message that you want to send
Returns: (string) json format string
telegram_message(chat_id, message)
get json format telegram message
Parameters:
chat_id : (string) chatId of bot
message : (string) message that you want to send
Returns: (string) json format string
Binance_Min_Limit_Order_amount_libraryLibrary "Binance_Min_Limit_Order_amount_library"
TODO: This library give us the minimum Limit Order amount for the contract in Binance.
m_qty(n_v, m_fee, t_fee, cost, m_t)
TODO: it give us the Minimum Qty for the trading in Binance
Parameters:
n_v : TODO: min_notional_value. 5 dollar is the minimum notional amount in Binance at the moment.
m_fee : TODO: maker_fee %
t_fee : TODO: taker_fee %
cost : TODO: your investing money
m_t : TODO: if you want Limit_Order, put the "T", if you want Market_Order, put the "M" defval="M"
Returns: TODO: for the coin of binance on your chart,
Reference: www.binance.com
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.
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
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)
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.
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].
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
[ALERTS] MA Cross HildiIch habe nur einige Modifikationen vorgenommen, so dass es meinen Bedürfnissen gerecht wird. Das Skript dient lediglich dazu die gleiche Einstellungen auf mehreren Konten nutzen zu können. Allein die Farbe und die Symbole habe ich noch nicht Automatisiert übertragen.
mfg Hildi Channel
Alert WhiteBox ShiftMAStrategy
The blue line is SMA .
The lime line = SMA - the shift parameter (%).
Red line = SMA + shift parameter (%).
Strategy uses limit orders. For opening of positions and for closing of positions.
If the price is lower than the lime line - opens a long position.
If the price is higher than the red line - opens a short position.
The position is closed on the blue line ( SMA ). Long and short.
Customizable trailing Stop For Manual EntriesHere's how to create a trailing stop with a manual buy order, on an exchange that does not support native trailing stops. Code can easily be copy+pasted into your normal algos.
To set the entry price for your manual trade, specify the bar time when the trade was made. Note that the time you specify needs to correspond to an opening time on your chart--if it's a 3 hour chart, 6 pm or 9 pm will work, but 8 PM will not. It's not as bad as it sounds though, read on :)
Per usual I keep multiple options open.
Special features in this script:
Change time frame for trailing
Specify trailing parameter (high, close, hlc3, etc.)
Change time frame for stop loss trigger (use a shorter time frame for earlier exits!)
Specify trigger parameter (close, low, hlc3, etc.)
Remember that annoying issue where you might not be able to precisely specify entry price, because you want to use 3 hour closing prices for your trailing stop but you bought in at 7:41 pm? Add this indicator to a 1 minute chart and set your start time to 19:41, then set the trailing time frame to 3 hours!
Next stop is v2, where we take profits along the way before stop loss gets triggered.
BornInvestor MA CloudsBornInvestor MA Clouds
The BornInvestor MA Clouds script is a powerful, multi-layered moving average cloud system designed to help traders visualize market trends, momentum shifts, and crossover signals in a clear, intuitive way.
🔑 Features
Up to 5 customizable MA Clouds
Choose between SMA or EMA for each moving average.
Flexible input sources (Close, Open, High, Low, etc.).
Adjustable lengths for full control over short-, medium-, and long-term trend analysis.
Dynamic Cloud Coloring
Clouds automatically change color to reflect bullish or bearish momentum.
Customizable transparency and color schemes for each cloud.
Crossover Signals
Visual triangle markers appear when faster MAs cross above/below slower MAs.
Bullish crossovers are shown below bars, bearish crossovers above bars.
Alerts Ready 🚨
Built-in alert conditions for bullish and bearish crossovers (Cloud 1).
Alerts trigger once per bar for cleaner signals.
Clean Visuals
Option to show/hide individual MA lines.
Lightweight design optimized for clarity on any chart.
📊 How to Use
Clouds act as dynamic support/resistance zones. Price above the cloud signals bullish momentum, while price below the cloud signals bearish conditions.
Crossover signals help identify potential trend reversals or entry points.
Use multiple clouds (short, medium, long-term) for multi-timeframe confluence.
⚠️ Disclaimer
This script is for educational purposes only and not financial advice. Always combine with your own research and risk management before trading.
BE-Volume Footprint & Pressure Candles█ Overview:
BE-Volume Footprint & Pressure Candles, is an indicator which is preliminarily designed to analyze the supply and demand patterns based on Rally Base Rally (RBR), Drop Base Drop (DBD), Drop Base Rally (DBR) & Rally Base Drop (RBD) concepts in conjunction to volume pressure. Understanding these concepts are crucial. Let's break down why the "Base" is you Best friend in this context.
Commonness in RBR, DBD, DBR, RBD patterns ?
There is an impulse price movement at first, be it rally (price moving up) or the Drop (price moving down), followed by a period of consolidation which is referred as "BASE" and later with another impulse move of price (Rally or Drop).
Why is the Base Important
1. Market Balance: Base represents a balance between buyers and sellers. This is where decisions are made.
2. Confirmation: It confirms the strength of previous impulse move which has happened.
Base & the Liquidity Play:
Supply & Demand Zone predict the presence of all large orders within the limits of the Base Zone. Price is expected to return to the zone to fill the unfilled orders placed by large players.
For the price to move in the intended direction Liquidity plays the major role. hence indicator aims to help traders in identifying those zones where liquidity exists and the volume pressure helps in confirming that liquidity is making its play.
Bottom pane in the below snapshots is a visual representation of Buyers volume pressure (Green Line & the Green filled area) making the price move upwards vs Sellers volume pressure (Red Line & the Red filled area) making the price move downwards.
Top pane in the below snapshots is a visual representation on the pattern identification (Blue marked zone & the Blue line referred as Liquidity level)
Bullish Pressure On Buy Liquidity:
Bearish Pressure On Sell Liquidity:
█ How It Works:
1. Indicator computes technical & mathematical operations such as ATR, delta of Highs & Lows of the candle and Candle ranges to identify the patterns and marks the liquidity lines accordingly.
2. Indicator then waits for price to return to the liquidity levels and checks if Directional volume pressure to flow-in while the prices hover near the Liquidity zones.
3. Once the Volume pressure is evident, loop in to the ride.
█ When It wont Work:
When there no sufficient Liquidity or sustained Opposite volume pressure, trades are expected to fail.
█ Limitations:
Works only on the scripts which has volume info. Relays on LTF candles to determine intra-bar volumes. Hence, Use on TF greater than 1 min and lesser than 15 min.
█ Indicator Features:
1. StrictEntries: employs' tighter rules (rather most significant setups) on the directional volume pressure applied for the price to move. If unchecked, liberal rules applied on the directional volume pressure leading to more setups being identified.
2. Setup Confirmation period: Indicates Waiting period to analyze the directional volume pressure. Early (lesser wait period) is Risky and Late (longer wait period) is too late for the
ride. Find the quant based on the accuracy of the setup provided in the bottom right table.
3. Algo Enabled with Place Holders:
Indicator is equipped with algo alerts, supported with necessary placeholders to trade any instrument like stock, options etc.
Accepted PlaceHolders (Case Sensitive!!)
1. {{ticker}}-->InstrumentName
2. {{datetime}}-->Date & Time Of Order Placement
3. {{close}}-->LTP Price of Script
4. {{TD}}-->Current Level:
Note: Negative Numbers for Short Setup
5. {{EN}} {{SL}} {{TGT}} {{T1}} {{T2}} --> Trade Levels
6. {{Qty}} {{Qty*x}} --> Qty -> Trade Qty mapped in Settings. Replace x with actual number of your choice for the multiplier
7. {{BS}}-->Based on the Direction of Trade Output shall be with B or S (B == Long Trade & S == Short Trade)
8. {{BUYSELL}}-->Based on the Direction of Trade Output shall be with BUY or SELL (BUY == Long Trade & SELL == Short Trade)
9. {{IBUYSELL}}-->Based on the Direction of Trade Output shall be with BUY or SELL (BUY == SHORT Trade & SELL == LONG Trade)
Dynamic Alerts:
10. { {100R0} }-->Dynamic Place Holder 100 Refers to Strike Difference and Zero refers to ATM
11. { {100R-1} }-->Dynamic Place Holder 100 Refers to Strike Difference and -1 refers to
ATM - 100 strike
12. { {50R2} }-->Dynamic Place Holder 50 Refers to Strike Difference and 2 refers to
ATM + (2 * 50 = 100) strike
13. { {"ddMMyy", 0} }-->Dynamically Picks today date in the specified format.
14. { {"ddMMyy", n} }-->replace n with actual number of your choice to Pick date post today date in the specified format.
15. { {"ddMMyy", "MON"} }-->dynamically pick Monday date (coming Monday, if today is not Monday)
Note. for the 2nd Param-->you can choose to specify either Number OR any letter from =>
16. {{CEPE}} {{ICEPE}} {{CP}} {{ICP}} -> Dynamic Option Side CE or C refers to Calls and PE or P refers to Puts. If "I" is used in PlaceHolder text, On long entries PUTs shall be used
Indicator is equipped with customizable Trade & Risk management settings like multiple Take profit levels, Trailing SL.
Whale Fractal Levels (V1.0)What it does
This indicator plots Fractal Levels (Bill Williams pivots) as horizontal lines and prints clean signals for:
BO+ / BO− → Breakouts through the latest fractal high/low
SW↑ / SW↓ → Liquidity sweeps (wick pierces, close rejects)
RE+ / RE− → Retests of the broken level after a confirmed breakout
Cyan = support (fractal lows).
Lilac = resistance (fractal highs).
How it works
Detects fractals with Left/Right = lr. A pivot is confirmed after lr bars on the right → the level itself doesn’t repaint.
Each confirmed fractal spawns a horizontal line extended to the right. You can limit how many lines stay on chart and auto-expire old ones.
Signals reference the most recent fractal high/low only and are edge-triggered (crossover/crossunder) with a cooldown so you don’t get a marker on every bar near the level.
A small state machine remembers the last breakout to validate the next retest.
Inputs (Settings)
Fractals
Left/Right (BW fractal) — Sensitivity of pivots (lower = more reactive, higher = cleaner).
MAX number of levels to display — Keep only the most recent N lines.
Level lifetime (bars) — Auto-delete lines after N bars to declutter.
Signals
Cooldown between signals (bars) — Minimum spacing between markers (anti-spam).
Show Breakouts (BO±) — Toggle breakout markers.
Show Sweeps (SW↑/SW↓) — Toggle sweep markers.
Show Retests (RE±) — Toggle retest markers.
Display
Show fractal lines / Line width / Line transparency (0..100)
Alerts (ready to use)
BO+ (Fractal), BO- (Fractal)
SW↑ (Fractal), SW↓ (Fractal)
RE+ (Fractal), RE- (Fractal)
GRANDEMOMENTUMBIST100)“BIST100 Momentum & Trend Strength”
This indicator combines a trend filter (EMA) with momentum (RSI) to color candlesticks and highlight potential shifts in market conditions.
Green candles → Trend and momentum aligned upward (bullish).
Red candles → Trend and momentum aligned downward (bearish).
Gray candles → Mixed/neutral conditions.
It also marks the first bar where candles turn gray (“BUY”) or red (“SELL”), giving visual alerts directly on the chart.
MTF Squeeze Analyzer - [tradeviZion]MTF Squeeze Analyzer
Multi-Timeframe Squeeze Pro Analyzer Tool
Overview:
The MTF Squeeze Analyzer is a comprehensive tool designed to help traders monitor the TTM Squeeze indicator across multiple timeframes in a streamlined and efficient manner. Built with Pine Script™ version 5, this indicator enhances your market analysis by providing detailed insights into squeeze conditions and momentum shifts, enabling you to make more informed trading decisions.
Key Features:
1. Multi-Timeframe Monitoring:
Comprehensive Coverage: Track squeeze conditions across multiple timeframes, including 1-minute, 5-minute, 15-minute, 30-minute, 1-hour, 2-hour, 4-hour, and daily charts.
Squeeze Counts: Keep count of the number of consecutive bars the price has been within each squeeze level (low, mid, high), helping you assess the strength and duration of consolidation periods.
2. Dynamic Table Display:
Customizable Appearance: Adjust table position, text size, and colors to suit your preferences.
Color-Coded Indicators: Easily identify squeeze levels and momentum shifts with intuitive color schemes.
Message Integration: Features rotating messages to keep you engaged and informed.
3. Alerts for Key Market Events:
Squeeze Start and Fire Alerts: Receive notifications when a squeeze starts or fires on your selected timeframes.
Custom Squeeze Count Alerts: Set thresholds for squeeze counts and get alerted when these levels are reached, allowing you to anticipate potential breakouts.
Fully Customizable: Choose which alerts you want to receive and tailor them to your trading strategy.
4. Momentum Analysis:
Momentum Oscillator: Visualize momentum using a histogram that changes color based on momentum shifts.
Detailed Insights: Determine whether momentum is increasing or decreasing to make more strategic trading decisions.
How It Works:
The indicator is based on the TTM Squeeze concept, which identifies periods of low volatility where the market is "squeezing" before a potential breakout. It analyzes the relationship between Bollinger Bands and Keltner Channels to determine squeeze conditions and uses linear regression to calculate momentum.
1. Squeeze Levels:
No Squeeze (Green): Market is not in a squeeze.
Low Compression Squeeze (Gray): Mild consolidation, potential for a breakout.
Mid Compression Squeeze (Red): Moderate consolidation, higher breakout potential.
High Compression Squeeze (Orange): Strong consolidation, significant breakout potential.
2. Squeeze Counts:
Tracks the number of consecutive bars in each squeeze condition.
Helps identify how long the market has been consolidating, providing clues about potential breakout timing.
3. Momentum Histogram:
Upward Momentum: Shown in aqua or blue, indicating increasing or decreasing upward momentum.
Downward Momentum: Displayed in red or yellow, representing increasing or decreasing downward momentum.
Using Alerts:
Stay ahead of market movements with customizable alerts:
1. Enable Alerts in Settings:
Squeeze Start Alert: Get notified when a new squeeze begins.
Squeeze Fire Alert: Be alerted when a squeeze ends, signaling a potential breakout.
Squeeze Count Alert: Set a specific number of bars for a squeeze condition, and receive an alert when this count is reached.
2. Set Up Alerts on Your Chart:
Click on the indicator name and select " Add Alert on MTF Squeeze Analyzer ".
Choose your desired alert conditions and customize the notification settings.
Click " Create " to activate the alerts.
How to Set It Up:
1. Add the Indicator to Your Chart:
Search for " MTF Squeeze Analyzer " in the TradingView Indicators library.
Add it to your chart.
2. Customize Your Settings:
Table Display:
Choose whether to show the table and select its position on the chart.
Adjust text size and colors to enhance readability.
Timeframe Selection:
Select the timeframes you want to monitor.
Enable or disable specific timeframes based on your trading strategy.
Colors & Styles:
Customize colors for different squeeze levels and momentum shifts.
Adjust header and text colors to match your chart theme.
Alert Settings:
Enable alerts for squeeze start, squeeze fire, and squeeze counts.
Set your preferred squeeze type and count threshold for alerts.
3. Interpret the Data:
Table Information:
The table displays the squeeze status and counts for each selected timeframe.
Colors indicate the type of squeeze, making it easy to assess market conditions at a glance.
Momentum Histogram:
Use the histogram to gauge the strength and direction of market momentum.
Observe color changes to identify shifts in momentum.
Why Use MTF Squeeze Analyzer ?
Enhanced Market Insight:
Gain a deeper understanding of market dynamics by monitoring multiple timeframes simultaneously.
Identify potential breakout opportunities by analyzing squeeze durations and momentum shifts.
Customizable and User-Friendly:
Tailor the indicator to fit your trading style and preferences.
Easily adjust settings without needing to delve into the code.
Time-Efficient:
Save time by viewing all relevant squeeze information in one place.
Reduce the need to switch between different charts and timeframes.
Stay Informed with Alerts:
Never miss a critical market movement with fully customizable alerts.
Focus on other tasks while the indicator monitors the market for you.
Acknowledgment:
This tool builds upon the foundational work of John Carter , who developed the TTM Squeeze concept. It also incorporates enhancements from LazyBear and Makit0 , providing a more versatile and powerful indicator. MTF Squeeze Analyzer extends these concepts by adding multi-timeframe analysis, squeeze counting, and advanced alerting features, offering traders a comprehensive solution for market analysis.
Note: Always practice proper risk management and test the indicator thoroughly to ensure it aligns with your trading strategy. Past performance is not indicative of future results.
Trade smarter with TradeVizion—unlock your trading potential today!
Bjorgum Double Tap█ OVERVIEW
Double Tap is a pattern recognition script aimed at detecting Double Tops and Double Bottoms. Double Tap can be applied to the broker emulator to observe historical results, run as a trading bot for live trade alerts in real time with entry signals, take profit, and stop orders, or to simply detect patterns.
█ CONCEPTS
How Is A Pattern Defined?
Doubles are technical formations that are both reversal patterns and breakout patterns. These formations typically have a distinctive “M” or a “W” shape with price action breaking beyond the neckline formed by the center of the pattern. They can be recognized when a pivot fails to break when tested for a second time and the retracement that follows breaks beyond the key level opposite. This can trap entrants that were playing in the direction of the prior trend. Entries are made on the breakout with a target projected beyond the neckline equal to the height of the pattern.
Pattern Recognition
Patterns are recognized through the use of zig-zag; a method of filtering price action by connecting swing highs and lows in an alternating fashion to establish trend, support and resistance, or derive shapes from price action. The script looks for the highest or lowest point in a given number of bars and updates a list with the values as they form. If the levels are exceeded, the values are updated. If the direction changes and a new significant point is made, a new point is added to the list and the process starts again. Meanwhile, we scan the list of values looking for the distinctive shape to form as previously described.
█ STRATEGY RESULTS
Back Testing
Historical back testing is the most common method to test a strategy due in part to the general ease of gathering quick results. The underlying theory is that any strategy that worked well in the past is likely to work well in the future, and conversely, any strategy that performed poorly in the past is likely to perform poorly in the future. It is easy to poke holes in this theory, however, as for one to accept it as gospel, one would have to assume that future results will match what has come to pass. The randomness of markets may see to it otherwise, so it is important to scrutinize results. Some commonly used methods are to compare to other markets or benchmarks, perform statistical analysis on the results over many iterations and on differing datasets, walk-forward testing, out-of-sample analysis, or a variety of other techniques. There are many ways to interpret the results, so it is important to do research and gain knowledge in the field prior to taking meaningful conclusions from them.
👉 In short, it would be naive to place trust in one good backtest and expect positive results to continue. For this reason, results have been omitted from this publication.
Repainting
Repainting is simply the difference in behaviour of a strategy in real time vs the results calculated on the historical dataset. The strategy, by default, will wait for confirmed signals and is thus designed to not repaint. Waiting for bar close for entires aligns results in the real time data feed to those calculated on historical bars, which contain far less data. By doing this we align the behaviour of the strategy on the 2 data types, which brings significance to the calculated results. To override this behaviour and introduce repainting one can select "Recalculate on every tick" from the properties tab. It is important to note that by doing this alerts may not align with results seen in the strategy tester when the chart is reloaded, and thus to do so is to forgo backtesting and restricts a strategy to forward testing only.
👉 It is possible to use this script as an indicator as opposed to a full strategy by disabling "Use Strategy" in the "Inputs" tab. Basic alerts for detection will be sent when patterns are detected as opposed to complex order syntax. For alerts mid-bar enable "Recalculate on every tick" , and for confirmed signals ensure it is disabled.
█ EXIT ORDERS
Limit and Stop Orders
By default, the strategy will place a stop loss at the invalidation point of the pattern. This point is beyond the pattern high in the case of Double Tops, or beneath the pattern low in the case of Double Bottoms. The target or take profit point is an equal-legs measurement, or 100% of the pattern height in the direction of the pattern bias. Both the stop and the limit level can be adjusted from the user menu as a percentage of the pattern height.
Trailing Stops
Optional from the menu is the implementation of an ATR based trailing stop. The trailing stop is designed to begin when the target projection is reached. From there, the script looks back a user-defined number of bars for the highest or lowest point +/- the ATR value. For tighter stops the user can look back a lesser number of bars, or decrease the ATR multiple. When using either Alertatron or Trading Connector, each change in the trail value will trigger an alert to update the stop order on the exchange to reflect the new trail price. This reduces latency and slippage that can occur when relying on alerts only as real exchange orders fill faster and remain in place in the event of a disruption in communication between your strategy and the exchange, which ensures a higher level of safety.
👉 It is important to note that in the case the trailing stop is enabled, limit orders are excluded from the exit criteria. Rather, the point in time that the limit value is exceeded is the point that the trail begins. As such, this method will exit by stop loss only.
█ ALERTS
Five Built-in 3rd Party Destinations
The following are five options for delivering alerts from Double Tap to live trade execution via third party API solutions or chat bots to share your trades on social media. These destinations can be selected from the input menu and alert syntax will automatically configure in alerts appropriately to manage trades.
Custom JSON
JSON, or JavaScript Object Notation, is a readable format for structuring data. It is used primarily to transmit data between a server and a web application. In regards to this script, this may be a custom intermediary web application designed to catch alerts and interface with an exchange API. The JSON message is a trade map for an application to read equipped with where its been, where its going, targets, stops, quantity; a full diagnostic of the current state and its previous state. A web application could be configured to follow the messages sent in this format and conduct trades in sync with alerts running on the TV server.
Below is an example of a rendered JSON alert:
{
"passphrase": "1234",
"time": "2022-05-01T17:50:05Z",
"ticker": "ETHUSDTPERP",
"plot": {
"stop_price": 2600.15,
"limit_price": 3100.45
},
"strategy": {
"position_size": 0.1,
"order_action": "buy",
"market_position": "long",
"market_position_size": 0,
"prev_market_position": "flat",
"prev_market_position_size": 0
}
}
Trading Connector
Trading Connector is a third party fully autonomous Chrome extension designed to catch alert webhooks from TradingView and interface with MT4/MT5 to execute live trades from your machine. Alerts to Trading Connector are simple; just select the destination from the input drop down menu, set your ticker in the "TC Ticker" box in the "Alert Strings" section and enter your URL in the alert window when configuring your alert.
Alertatron
Alertatron is an automated algo platform for cryptocurrency trading that is designed to automate your trading strategies. Although the platform is currently restricted to crypto, it offers a versatile interface with high flexibility syntax for complex market orders and conditions. To direct alerts to Alertatron, select the platform from the 3rd party drop down, configure your API key in the ”Alertatron Key” box and add your URL in the alert message box when making alerts.
3 Commas
3 Commas is an easy and quick to use click-and-go third party crypto API solution. Alerts are simple without overly complex syntax. Messages are simply pasted into alerts and executed as alerts are triggered. There are 4 boxes at the bottom of the "Inputs" tab where the appropriate messages to be placed. These messages can be copied from 3 Commas after the bots are set up and pasted directly into the settings menu. Remember to select 3 Commas as a destination from the third party drop down and place the appropriate URL in the alert message window.
Discord
Some may wish to share their trades with their friends in a Discord chat via webhook chat bot. Messages are configured to notify of the pattern type with targets and stop values. A bot can be configured through the integration menu in a Discord chat to which you have appropriate access. Select Discord from the 3rd party drop down menu and place your chat bot URL in the alert message window when configuring alerts.
👉 For further information regarding alert setup, refer to the platform specific instructions given by the chosen third party provider.
█ IMPORTANT NOTES
Setting Alerts
For alert messages to be properly delivered on order fills it is necessary to place the following placeholder in the alert message box when creating an alert.
{{strategy.order.alert_message}}
This placeholder will auto-populate the alert message with the appropriate syntax that is designated for the 3rd party selected in the user menu.
Order Sizing and Commissions
The values that are sent in alert messages are populated from live metrics calculated by the strategy. This means that the actual values in the "Properties" tab are used and must be set by the user. The initial capital, order size, commission, etc. are all used in the calculations, so it is important to set these prior to executing live trades. Be sure to set the commission to the values used by the exchange as well.
👉 It is important to understand that the calculations on the account size take place from the beginning of the price history of the strategy. This means that if historical results have inflated or depleted the account size from the beginning of trade history until now, the values sent in alerts will reflect the calculated size based on the inputs in the "Properties" tab. To start fresh, the user must set the date in the "Inputs" tab to the current date as to remove trades from the trade history. Failure to follow this instruction can result in an unexpected order size being sent in the alert.
█ FOR PINECODERS
• With the recent introduction of matrices in Pine, the script utilizes a matrix to track pivot points with the bars they occurred on, while tracking if that pivot has been traded against to prevent duplicate detections after a trade is exited.
• Alert messages are populated with placeholders ; capability that previously was only possible in alertcondition() , but has recently been extended to `strategy.*()` functions for use in the `alert_message` argument. This allows delivery of live trade values to populate in strategy alert messages.
• New arguments have been added to strategy.exit() , which allow differentiated messages to be sent based on whether the exit occurred at the stop or the limit. The new arguments used in this script are `alert_profit` and `alert_loss` to send messages to Discord
FibonacciRetracementHi all!
This library will help you draw Fibonacci retracement levels (zones). The code is from my indicator "Fibonacci retracement" (). You can see that description for more information about the behaviour and example of how to use this library. The code is almost the same with the addition of alerts. If the alert frequency is 'alert.freq_once_per_bar_close' alert messages will be concatenated and have a header saying how many messages it contains (if it's more than 1).
Hope this is of help!
Library "FibonacciRetracement"
ConcateAlerts(context)
Concatenates all alerts from the bar to one string (separated by new lines) and clears alert messages on the current bar.
Parameters:
context (Context)
AddAlert(context, message, unshiftInsteadOfPush)
Parameters:
context (Context)
message (string)
unshiftInsteadOfPush (bool)
Range(context, structure, settings)
Will return values if new levels/zones should be drawn.
Parameters:
context (Context) : The 'Context' for the Fibonacci retracement.
structure (Structure type from mickes/PriceAction/1) : The current 'Structure' from the 'MarketStructure' library.
settings (Settings) : The 'Settings' object for the 'Context'.
Returns: A tuple with the start and end pivot if new zones should be drawn, ' ' otherwise.
DrawAll(context, settings, start, end)
Draws lines and labels for the zone. It will also set the 'Price' value that will be used for absolute positions.
Parameters:
context (Context) : The 'Context' for the Fibonacci retracement.
settings (Settings) : The 'Settings' object for the 'Context'.
start (Pivot type from mickes/PriceAction/1)
end (Pivot type from mickes/PriceAction/1)
AlertActive(context, settings)
Will alert for all zones that are active. If multiple alert messages are added they will be concatenated (separated by a new line) with a header saying how many messages the alert contains.
Parameters:
context (Context) : The 'Context' for the Fibonacci retracement. This contains the zones that will be alerted if price (wick or close according to the settings) enters it.
settings (Settings) : The 'Settings' object for the 'Context'.
TrendlineSettings
Holds all the values for 'TrendlineSettings'.
Fields:
Enabled (series bool) : If the trendline should be visible or not.
Color (series color) : The color of the trendline.
Style (series string) : The style of the trendline (as a string).
GenericZonesSettings
Holds all the values for 'GenericZonesSettings', that will be applicable to all drawn objects.
Fields:
ExtendRight (series bool) : If all lines should extend to the right or not.
Style (series string) : The style of all drawn lines
Reverse (series bool) : If true, all lines will be reversed.
Prices (series bool) : If price levels should be shown or not.
Levels (series bool) : If levels should be shown or not.
LevelsValue (series string) : Either 'Value' or 'Percent'. Defined if value or percentage should be shown.
FontSize (series int) : The for size of the text in labels drawn.
LabelsPosition (series string) : Coul be 'Left', 'Rigth' or 'Adapt'. 'Adapt' will try to adapt the labels position to the prices.
ZoneSettings
Holds all the values for 'ZoneSettings'.
Fields:
Enabled (series bool) : If this zone is enabled or not.
Level (series float) : The level of the zone.
Color (series color) : The color that will be displayed.
Price (series float) : The price of the level. Will be set internally.
Settings
Holds all the values for 'Settings'.
Fields:
PivotLeftLength (series int) : The left length used to find pivots through the 'MarketStructure' library.
PivotRightLength (series int) : The right length used to find pivots through the 'MarketStructure' library.
Trendline (TrendlineSettings) : The settings for the 'Trendline' object.
GenericZonesSettings (GenericZonesSettings) : The setting applicable to all zones.
AlertFrequency (series string) : The frequency for the alerts. If 'alert.freq_once_per_bar_close', alert messages will be concatenated and have a header saying how many messages it contains (if it's more than 1).
AlertPrice (series string) : The price that has to enter a zone. Can be 'Close' (the closing price) or 'Wick' (the whole candle needs to be in the zone).
Zone1 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone2 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone3 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone4 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone5 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone6 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone7 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone8 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone9 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone10 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone11 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone12 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone13 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone14 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone15 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone16 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone17 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone18 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone19 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone20 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone21 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone22 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone23 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Zone24 (ZoneSettings) : The 'ZoneSettings' that represents this zone.
Context
Holds all the values for 'Context'.
Fields:
Lines (array) : All the drawn lines for the current 'Context'.
Labels (array) : All the drawn labels for the current 'Context'.
Boxes (array) : All the drawn boxes for the current 'Context'.
Alerts (array) : All the alert messages on the current tick.
Start (series int) : The start bar index of the current 'Context'.