Light or Dark Mode Tutorial - Luminance DetectionAs a colorblind trader, I think accessibility is a big deal. This script auto detects the chart background color and optimizes text color based on luminance.
Luminance detection is based on pine script new chart.bg_color feature, allowing lines, tables, etc to be optimized. Thanks to TV team for releasing this in the latest update/blog post today! This makes it simple to optimize scripts based off the knowledge that max luminance = 765 (rgb 255 + 255 + 255), thus we know that lum <= 383 is "dark mode" and lum > 383 is "light mode".
Try changing the chart background color and see how this script changes the table printed on the chart. I hope more script authors will begin to utilize this concept and that even better contrast detection may be built future pine script iterations.
Сферы применения Pine
DeQuex AlgoHello everyone,
This indicator uses MACD and RSI, to show buy and sell signals.
Signal Features:
Buy Signal: Chart gives a buy signal when the MACD crosses above.
Sell Signal: Chart gives a sell signal when the MACD crosses down.
Strong Buy Signal: Chart gives a strong buy signal when the MACD and RSI cross above.
Storng Sell Signal: Chart gives a strong sell signal when the MACD and RSI cross down.
Highligh Price Bars: This option is enabled by default, it shows the trend colored for easy understanding of the trend. Green bars mean the trend is going up, Red bars means the trend is going down and, the last one is purple bars they are means that unknown trend so you can understand for example if the purple bar has happened on the green trend you can understand the trend power slowly decrease.
You can set up an alarm for each signal type.
Best regards,
BrandonJames1337
Listado CCL - price of the dollar in ArgentinaThis Script print different CCL values (Argentinian dolar).
Each value is based in a different Ticker and is calculated based in ADRs and local stocks using the corresponding formula.
The Script can be used regardless of the ticker used in the Design.
The values are calculated based on the close value of the last bar.
Was not taken into account the opperated volume, therefore it is important not to make investment decisions based on the information provided by this script.
Binance Futures Swap-Spot Basis LabelNote: This script will only work with Binance Futures Symbols
This script calculates the basis between the Binance Future and Binance Spot market for the coin you are currently viewing and paints a label on the chart which displays the percentage difference between future and spot. If the future is trading below the spot market the text will be red indicating backwardation and if the future is trading above spot, it will be green indicating contango. Please note this script will only work on Binance perps against Binance spot. The script will change based on what perp you are looking at, no inputs are required.
Future PreviewFuture Preview
Calculate real-time future order profit with open price, leverage and commission fee. Simple and straight forward. If you need any additional feature, please leave a comment below. I am glad to help.
Usage:
When adding Future Preview to chart, it will ask order open time and open price on the chart by clicking with left mouse on the desired value. These value can be changed lately, as well as the leverage and commission fee. Default leverage is 10 and default commission fee is 0.06% (taker).
There will be two horizontal lines. The solid longer line is the open price line, it shows the order open price. The shorter line moving with real-time price is the current price line, it shows the current price. There will be preview data shows on top or below the price line. Open price line is red for short order and green for long order. The current price line is red when the order is losing and it is green when it profiting. The back ground color follows the color of current price line. Background color transparency and gain/loss color can be changed in options.
There will be one horizontal line on the left if the option of showing open time is on (default is on). It shows the time stamp when current order opened.
After adding Future Preview to chart, there is option to add Taking Profit(TP) or Stop Loss(SL) to the chart.
Font size can be changed in option
average price calculatorthe "average price calculator" is a tool that calculate the brake-even price when trading with multiple entries
how it works?
just copy the the entry price and size of position
and the average price or brake-even price will appear on the chart
if trading in both directions (buy and sell) at the same time
mark the sell position as negative (-)
hope you find this tool useful
successful trading to you all
MPF EMA Cross Strategy (8~13~21) by Market Pip FactoryThis script is for a complete strategy to win maximum profit on trades whilst keeping losses at a minimum, using sound risk management at no greater than 1.5%
The 3x EMA Strategy uses the following parameters for trade activation and closure.
1/ Daily Time Frame for trend confirmation
2/ 4 Hourly Time Frame for trend confirmation
3/ 1 Hourly Time Frame for trend confirmation AND trade execution
4/ 3x EMAs (Exponential Moving Averages)
* EMA#1 = 8 EMA (Red Color)
* EMA#2 = 13 EMA (Blue Color)
* EMA#3 = 21 EMA (Orange Color)
5/ Fanning of all 3x EMAs and CrossOver/CrossUnder for Trend Confirmation
6/ Price Action touching an 8 EMA for trade activation
7/ Price Action touching a 21 EMA for trade cancellation BEFORE activation
* For LONG trades: 8 EMA would be ABOVE 21 EMA
* For SHORT trades: 8 EMA would be BELOW 21 EMA
* For trade Cancellation, price action would touch the 21 EMA before trade is activated
* For trade Entry, price action would touch 8 EMA
Once trigger parameter is identified, entry is found by:
a) Price action touches 8 EMA (Candle must Close for confirmed Trade preparation)
b) Trade preparation can be cancelled before trade is activated if price action touches 21 EMA
c) Trailing Stop Loss can be used (optional) by counting back 5 candles from current candle
CLOSURE of a Trade is identified by:
e) 8 EMA crossing the 21 EMA, then close trade, no matter LONG or SHORT
f) Trail Stop Loss
IMPORTANT:
g) No more than ONE activated trade per EMA crossover
h) No more than ONE active trade per pair
NOTE: This strategy is to be used in conjunction with Cipher Twister (my other indicator) to reduce trades on
sideways price action and market trends for super high win ratio.
NOTE: Enabling of LONGs and SHORTs Via Cipher Twister is done by using the previous
green or red dot made. Additionally, when the trend changes, so do the dot's validity based
on being above or below the 0 centerline.
----------------------------
Strategy and Bot Logic
----------------------------
.....::: FOR SHORT TRADES ONLY :::.....
The Robot must use the following logic to enable and activate the SHORT trades:
Parameters:
$(crossunder)=8EMA,21EMA=Bearish $(crossover)=8EMA,21EMA=Bullish $entry=SELL STOP ORDER (Short)
$EMA#1 = 8 EMA (Red Color) $EMA#2 = 13 EMA (Blue Color) $EMA#3 = 21 EMA (Orange Color)
Strategy Logic:
1/ Check Daily Time Frame for trend confirmation if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=daily and trend=$(crossunder) then goto 2/ *Means: crossunder = ema21 > ema8
$(chart)=daily and trend=$(crossover) then stop (No trades) *Means: crossover = ema8 > ema21
NOTE: This function is switchable. 0=off and 1=on(active). Default = 1 (on)
2/ Check 4 Hourly Time Frame for trend confirmation if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=4H and trend=$(crossunder) then goto 3/ *Means: crossunder = ema21 > ema8
$(chart)=4H and trend=$(crossover) then stop (No trades) *Means: crossover = ema8 > ema21
NOTE: This function is switchable. 0=off and 1=on(active). Default = 1 (on)
3/ 1 Hourly Time Frame for trend confirmation AND trade execution if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=1H and trend=$(crossunder) then goto 4/ *Means: crossunder = ema21 > ema8
$(chart)=1H and trend=$(crossover) then stop (No trades) *Means: crossover = ema8 > ema21
4/ Trade preparation:
* if Next (subsequent) candle touches 8EMA, then set STOP LOSS and ENTRY
* $stoploss=3 pips ABOVE current candle HIGH
* $entry=3 pips BELOW current candle LOW
5/ Trade waiting (ONLY BEFORE entry is hit and trade activated):
* if price action touches 21 EMA then cancel trade and goto 1/
Note: Once trade is active this function does not apply !
6/ Trade Activation:
* if price activates/hits ENTRY price, then bot activates trade SHORTs market
7/ Optional Trailing stop:
* if active, then trailing stop 3 pips ABOVE previous HIGH of previous 5th candle
or * Move Stop Loss to Break Even after $X number of pips
NOTE: This means count back and apply accordingly to the 5th previous candle from current candle.
NOTE: This function is switchable. 0=off and 1=on(active). Default = 0 (off)
8/ Trade Close ~ Take Profit:
* Only TP when
$(chart)=1H and trend=$(crossover) then close trade ~ Or obviously if Stop Loss is hit if 7/ is activated.
----------END FOR SHORT TRADES LOGIC----------
.....::: FOR LONG TRADES ONLY :::.....
The Robot must use the following logic to enable and activate the LONG trades:
Parameters:
$(crossunder)=8EMA,21EMA=Bearish $(crossover)=8EMA,21EMA=Bullish $entry=BUY STOP ORDER (Long)
$EMA#1 = 8 EMA (Red Color) $EMA#2 = 13 EMA (Blue Color) $EMA#3 = 21 EMA (Orange Color)
Strategy Logic:
1/ Check Daily Time Frame for trend confirmation if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=daily and trend=$(crossover) then goto 2/ *Means: crossover = ema8 > ema21
$(chart)=daily and trend=$(crossunder) then stop (No trades) *Means: crossunder = ema21 > ema8
NOTE: This function is switchable. 0=off and 1=on(active). Default = 1 (on)
2/ Check 4 Hourly Time Frame for trend confirmation if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=4H and trend=$(crossover) then goto 3/ *Means: crossover = ema8 > ema21
$(chart)=4H and trend=$(crossunder) then stop (No trades) *Means: crossunder = ema21 > ema8
NOTE: This function is switchable. 0=off and 1=on(active). Default = 1 (on)
3/ 1 Hourly Time Frame for trend confirmation AND trade execution if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=1H and trend=$(crossover) then goto 4/ *Means: crossover = ema8 > ema21
$(chart)=1H and trend=$(crossunder) then stop (No trades) *Means: crossunder = ema21 > ema8
4/ Trade preparation:
* if Next (subsequent) candle touches 8EMA, then set STOP LOSS and ENTRY
* $stoploss=3 pips BELOW current candle LOW
* $entry=3 pips ABOVE current candle HIGH
5/ Trade waiting (ONLY BEFORE entry is hit and trade activated):
* if price action touches 21 EMA then cancel trade and goto 1/
Note: Once trade is active this function does not apply !
6/ Trade Activation:
* if price activates/hits ENTRY price, then bot activates trade LONGs market
7/ Optional Trailing stop:
* if active, then trailing stop 3 pips BELOW previous LOW of previous 5th candle
or * Move Stop Loss to Break Even after $X number of pips
NOTE: This means count back and apply accordingly to the 5th previous candle from current candle.
NOTE: This function is switchable. 0=off and 1=on(active). Default = 0 (off)
8/ Trade Close ~ Take Profit:
* Only TP when
$(chart)=1H and trend=$(crossunder) then close trade ~ Or obviously if Stop Loss is hit if 7/ is activated.
----------END FOR LONG TRADES LOGIC----------
IMPORTANT:
* If an existing trade is already open for that same pair, & price action touches 8EMA, do NOT open a new trade..
* bot must continuously check if a trade is currently open on the pair that triggers
* New trades are to be only opened if there is no active trade opened on current pair.
* Only 1 trade per pair rule !
* 5 simultaneous open trades (not same pairs) default = 5 but value can be changed accordingly.
* Maximum risk management must not exceed 1.5% on lot size
*** Some features are not yet available autoated, they will be added in due course in subsequent version updates ***
Simple HashmapA very simple Hashmap in Pinescript version 4
It uses two arrays one to store indices and one to store values
currently this only supports keys of type int and values of type floats.
index array: (20, 30, 80, 90)
value array: (9.1,8.1,6.5,3.5)
You can access the value 9.1 by using the key 20.
No fancy hash functions were used just a very simple practical mechanism.
{QG}Spread CandelsticksThis indicator charts the spread between 2 instruments in a subwindow and it has a multiplier for calculating dollar value or volatility for those 2 instruments,
I have shown a sample spread between NQ and ES with multipliers representing the dollar value per point.
The indicator can then be applied to this spread candelsticks indicator.
RealTime Max LeverageEver wanted a script that could tell you what is the maximum reasonably safe leverage if you were to open a trade and hold it for a given number of candles? This is it!
Using rate of change based volatility and the maximum expected number of candles/periods you will hold your trade for, based on your risk profile this indicator will tell you what is the maximum reasonable leverage.
Stop losses / take profits or some other prudent exit strategy should not be avoided. The idea is effectively to prevent yourself from using leverage that is too risky for the current market conditions on whatever timeframe you are entering your trade based on.
If you have any suggestions on how to improve the indicator, please leave a comment below!
Streamer WatermarkThis unique indicator doesn’t help you trade but it makes your charts look super clean and professional in images and live streams! This indicator works by displaying two tables. The first table has day of the week, date, and free form text. The second table has ticker symbol and timeframe of the current chart.
Everything about the tables and the cells is completely controllable by the user! Here is a breakdown of how customizable the user can make this indicator:
Table:
Toggle each table to be displayed on or off
Move each table into 9 different locations around the chart
Move each table separately
Table background color and transparency
Table border color and transparency
Table border width
Table frame width
Cells:
Each cell can be individually toggled on or off (the table will resize dynamically)
Cell text color and transparency
Text size with 6 different options
Date format with 12 different formats
Input Text:
Text
Emoji
Text & emojis
ASCII characters
Symbols
Anything that can by copied and pasted
Any combination of the above
Notes
Use text size “Auto” if viewing the same chart on desktop and on smart phone (Auto makes the text scale based upon screen size)
Gallery
Disclaimer
Please read the TradingView House Rules carefully before using this indicator to add text, symbols, characters, or anything else to your charts and posting on TradingView Ideas or Scripts. This indicator and the author are not responsible for users not reading, fully understanding, and abiding by TradingView’s House Rules. Please watermark responsibly.
All-Time-High Drops and Bounces ScreenerThis screener tracks the following for up to 40 assets:
All-Time-High
Days since ATH
Percentage drop from ATH
Bounce off the low after ATH
Thanks to @QuantNomad and @MUQWISHI for building the base for this screener. I only adjusted it to show different data.
pineCalc- Calculator for PineHello and welcome to v1.00 of pineCalc - the calculator for Pine
A sleek, quick, and discrete calculator in a window pane in your chart!
Right now it supports basic math operation and series of two numbers but will try to update it and don't hesitate to comment any ideas
SOME FEATURES:
- Supports decimal numbers.
- Switch statement with option to choose Addition, Subtraction, Multiplication , or Division
- Choose any two numbers to use math on
- Inputs, Math Type and Result Output
Simple Percentage Change IndicatorFeatures:
- Shows % change per Bar.
- Shows countdown per bar.
- Shows Day, Month, and Yearly % Change in Bottom Right Corner.
Highlight last bar, work on all timeframe, v4 & v5 @magnummHighlight last bar only. No refresh needed.
Works on all time frame and for version 4 & 5.
Can be added in your own scripts copy/pasting just one line.
//DON'T FORGET TO HYDRATE
Old Buddy Old Pal... Color Scheme Pallet GeneratorFor the Tasteful Pine Coder, Find your inner rainbow.
Color pallet tool with 7 standard colors as per syntax highlighters typical scheme.
Hue, Sat, Lum adjustments, transparency, and 4 different modes.
Please Share in comments any Chart Captures showcasing your designs if his tool helped you.
a library version is in the works as of may 2022. will enable a 7 color standard output direct into script with floating color input shifting of the whole pallet or partials.
(( next level past gradients)
RaenonX - NQ 7 InfluenceShows the top 7 NASDAQ 100 component stock (AAPL, MSFT, GOOG, AMZN, TSLA, NVDA, FB) influence as plot.
RaenonX - NQ 7 DashboardPlaces a table at the bottom right side showing the top 7 stocks (AAPL, MSFT, GOOG, AMZN, TSLA, NVDA, FB) current position for the given MA and daily position.
The 2nd row shows the current position related to the prior day open/high/low. There are 4 possible values:
H+ : Higher than the prior day high - indicates bullish in daily timeframe.
O+ : Higher than the prior day open - indicates pro-bullish consolidation in daily timeframe.
L+ : Higher than the prior day low - indicates pro-bearish consolidation in daily timeframe.
L- : Lower than the prior day high - indicates bearish in daily timeframe.
The 3rd row shows the current position related to the given SMA parameters. The default period is 22 using 5 minutes timeframe. There are 4 possible values:
B+ : Higher than the SMA upper band - indicates bullish movement.
+ : Higher than the SMA - indicates pro-bullish movement, possibly consolidating.
- : Lower than the SMA - indicates pro-bearish movement, possibly consolidating.
B- : Lower than the SMA lower band - indicates bearish movement.
Template Signal IndicatorThis script is an example on how to create a custom indicator that produce start/end long/short deal signals based on configurable conditions from internal and external indicators.
This indicator can be used as an external indicator to other strategies like "Template Trailing Strategy" that will execute the deals and enter the desired positions based on the signals produced by this script.
Combining this script with the aforementioned strategy (or any other compatible) has the advantage that you can backrest the results of your custom deal conditions. Also additional functionality that is provided by the strategy can be utilized (e.g. Take Profit Targets, Trailing Stop Loss etc.).
In this particular example I combined the RSI and Stoch RSI indicators (internal) with the "Trend Explorer" indicator (external) so it produces buy and sell signals based on the logic I defined in the input tab of this indicator. To combine "indicators on indicators" you need Pro+ TV subscription.
The convention I use to communicate the signals is the following (2 -> enter long, 1 -> exit long, -2 -> enter short, -1 ->exit short). However, this convention is also configurable in the consumer/strategy script "Template Trailing Strategy" so make sure that both script "speak the same language" before procced.
No Active BarThis is probably the only script on TradingView that's clinically proven to lower your blood pressure!***
This script in conjunction with some chart settings changes can completely hide the active candle, only showing historic candles, thus, reducing risk of cardiac arrest and or panic attack.
What to do:
0. Make sure you are using a candlestick chart or this script won't work properly
1. Right click the chart and select "Settings..."
2. Select "Symbol" under the "Chart Settings" menu
3. Disable every item EXCEPT for the "Body"
4. Click on the boxes next to "Body" to access the color picker then change both box's transparency settings down to 0
(the script only colors closed bars, so the active bar will be present just transparent)
5. Right click on the price scale on the far left or far right side of the screen and hover the mouse over "Labels". If any selections have a check mark next to them click them to disable them (especially the "Ask & Bid" price setting since it tracks current price)
That's it! Instead of wicks the High & Low prices are plotted above and below the candles using a step line. It looks a bit strange at first but you'll get used to it. Check out the indicator settings to change the color and style of the High & Low lines.
***The statement could prove true for some but is mostly complete bullshit
Lunch-BreakThis script is only for Lunch breaks of London, NYSE and Tokyo session for those who don't want to trade between in these times.
Custom Multi-Timeframe IndicatorIt's a pretty simple example of a nice custom screener you can run for multiple timeframes. This is an RSI screener, but you can easily change the function for your own Indicator.
Screener displays:
Last value of the instrument
RSI value for up to 10 instruments / 4 timeframes.
In Parameters you can change:
4 timeframes
10 instruments
Parameters for RSI
Styling parameters for table
If the selected timeframe will be lower than the current one you will receive a warning message in a table.
Thanks to @MUQWISHI to help me code it.
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
TRADEMASTER 2.35Trade master Trend Finder This is a volatility tool designed to get the daily bottom and top values calculated using a daily ATR and IV values. ATR values can be calculated directly, however for IV I recommend to take the values from external sources for the asset that you want to