Crypto Base TickerAn example of using str.replace_all() function to extract a crypto ticker without its pair.
It can be useful if you didn't know syminfo.basecurrency existed.
I didn't know syminfo.basecurrency exists. Lol
Label
Position Size CalculatorThis is a script to make calculating position size easier. It calculates position size as a percentage of account balance and Risk/Reward based on input values of entry, exit, stoploss and shows the R/R box similar to tradingview's R/R tool. There is an option to toggle showing label and choosing of label text color.
Have to enter the following inputs in order for it to work properly
1. Account Balance : Account balance in either whatever is base currency of account
2. Risk % : Percentage of account balance to lose if stop is hit.
3. Entry
4. Stoploss
5. Target Price
Notes:
- Target Price is required for calculating R/R but is not necessary to calculate position size.
- Formula to calculate position size is : Balance * Risk % / SL %
- Formula to calculate R/R is : TP % / SL %
- SL % = ( Entry - SL ) / Entry * 100
- TP % = (TP - Entry ) / Entry * 100
Thanks to u/Chonky_ for help with feedback.
Hull MA Scanner / Screener LabelThis screens for Hull MA trend reversal's in 10 different securities. If the label color is not visible due to the text in it being white colored, then choose a different color from settings. Also added a simple HullMA to it. If want can increase it upto 40 securities in the code which is upto user to decide.
This was requested by soderstromkenan in comments and looked like a nice idea so decided to make it.
The Hull MA logic is from "Hull50" by u/RafaelZioni with his permission. Screener logic from u/Quantnomad with his permission.
Supertrend Screener LABELThis screens for Supertrend reversal's in 10 different securities. The main logic for the screener is taken from "Simple Custom Screener in Pinescript" by QuantNomad with his permission. If the label color is not visible due to the text in it being white colored, then choose a different color from settings. Also added a simple supertrend to it.
Terminology explanation:
Confirmed Reversal: Supertrend reversal that happened in the last bar and cannot be repainted.
Potential Reversal: Supertrend reversal that might happen in the current bar but can also not happen depending upon the timeframe closing price.
Uptrend/Downtrend : Shows all the tickers that are either currently in uptrend or downtrend.
Key price levelsFunction: labelling recent highs and lows automatically. Easy and clean.
In this example, we can see the previous low of the ticker is around 105.5, the previous high is around 120.
We can set up our entries and exits by referring to the last lows and highs.
Users can adjust the searching bar range by themselves.
Time Range StatisticsA good amount of users requested a text box showing various price statistics, the following script returns various of these stats in a user-selected range, and include classical ones such as a central tendency measurement (mean), dispersion (normalized range) and percent change, but also include less common statistics such as average traded volume and number of gaps. The script also calculates the correlation between the closing price and another user-selected instrument.
The script is currently the longest one I ever made and took some efforts, as I wasn't satisfied with the statistics to be originally included. Big thx to Gael for the enormous feedback and the idea of the normalized range, to user @Cookiecrush for the feedback ( without ya I would have posted something bad you know umu ? ), and Lulidolce for the support, friendship is magic!
Selected Range
The setting Start determine the bar at which the range starts, while End determine at which bar the range end. To help you select these values, the current bar number (bar index) is displayed at the right of the indicator title in blue.
The setting evaluate to last bar will use a range starting at Start and ending at the last bar, as such you can use a full range by using Start = 0 and select evaluate to last bar
The range is highlighted by an area on the chart. By default Start = 9000 and End = 10000, you might not have this amount of data in your chart, as such use the displayed bar index to select Start and End, then set the settings as default.
Displayed Statistics
The statistics panel is displayed on the right side of the last bar, the panel has 3 sections, a title section who shows the symbol ticker, timeframe, and overall trends represented by a chart emoji, the overall trends are determined by comparing the number of higher highs with the number of lower low.
Below are displayed the date ranges with time format: year/month/day/hour:minute.
The second section shows the general statistics. The first one is the mean, also represented by the orange line in the chart, the blue line displayed represent the highest price value in the range, while the red one represents the lowest price value.
The second stat is the normalized range, and determine how spread is the price in the user-selected range, why not the standard deviation? Because the standard deviation might return results varying widely depending on the scale of the closing price, you could get measures such as 0.0156 or 16 or even 56 depending on the instrument, as such using a normalized range can be more appropriate as it lays in a range of (0,1). Lower values indicate a low degree of price variation. Note that I still want to find another measure in the future.
The percentage change (or relative change) indicates at which percentage the price has increased or decreased, and is calculated by subtracting the closing at bar Start with the price at bar End , divided by the price at bar End , the result is then multiplied by 100.
The average traded volume calculate the mean of the volume in the selected range, I used the same format used by the original volume indicator for clarity.
Finally, the last stats of the section is the number of gaps, this stat is by default hidden. An up gap is detected when the open price is superior to the previous high, while a down gap is detected when the open price is inferior to the previous low, this allow to only retain significant gaps.
The last section of the indicator panel shows the correlation between the closing price and another instrument, by default GOOG, this correlation is also calculated within the user-selected range. Positive values indicate a positive relationship, that is the two instruments tend to move in the same direction. Negative values indicate a negative relationship, both instruments tend to move in a direction opposite to each other. Values closer to 1 or -1 indicate a stronger relationship, while values closer to 0 indicate no relationship.
In Summary
The script shows various stats, each calculated within a user-selected range, in general one would be more interested in how these stats might evolve with time, but checking them in a custom range can be quite interesting.
Thx for reading. umu
Marubozu Scanner v1Some code for detecting the very rare occurrences of the Marubozu candle. This candle occurs when the High = Close, and Low = Open, or vice versa. They are continuation candles, so if you see a bullish Marubozu during an uptrend its possible that the uptrend will continue.
RSI Call-outs [BigBitsIO]This is a simple RSI indicator that overlays the current chart to show labels for specified oversold and overbought areas defined with inputs.
It will delete any labels of the same kind within the last 3 candles so you don't see as many labels as you would otherwise.
Red labels with white text represent overbought RSI levels as defined by the user.
Green labels with black test represent oversold RSI levels as defined by the user.
This RSI overlay help easily call-out overbought and oversold candles on a chart without sacrificing screen space for a traditional RSI indicator that is not overlayed on the chart.
Candle OpenerIllustrates open and close of the superior candles; the timeframe is choosable from pulldown menu.
Label shows the price of the open and indicate chosen superior candle's status (bull/bear) according to the current close.
インジケーターの設定ドロップダウンメニューから上位足の始値と終値をスイッチングできるので、タイムフレームを跨がずに現在足からラインを引くことができます。表示した上位足の始値を示すラベルは、当該足が陽線か陰線かによって色が反転します。
ライントレードの補助用インジケータとしてご利用ください。
TFs Golden Cross - Status BoxThis simple strategy demonstrates the use of Pine Script version 4 "label" feature to show status box.
This box can display anything, in this case it shows current market position, current profit and close price. It renders the box in green if profit is positive, red if negative and blue if neutral.
BEST Trend Direction Helper (Strategy Edition)Hello traders
A follower asked me to convert my Trend Direction Helper into a strategy
So blessed this indicator reached the 1400+ likes milestone - I can't believe how many people are trading with it
I based the setup as follow:
- Entries on those green/red labels
- exit whenever a Simple Moving Averages cross in the opposite direction happen
- possibility to filter only Longs/Shorts or both
Also...
The strategy includes the Zig Zag/Pivots high/low and other options from the indicator version. I only added a quick strategy component with a hard exit concept based on SMA cross
All the best fam and... HAPPY NEW YEAR !!!!!!!!!!!
Dave
[PX] M/W/D LevelHey guys,
this script shows monthly, weekly and daily OHLC data represented as horizontal level.
I tried to make it as user-friendly as possible. Therefore, you can add different colors and styles for each level, as well as turn them on and off.
With the "Label Offset" -parameter you are in control where the label text should appear. You can shift it from left to right and vice-versa. To shift it to the left choose a negative value. To shift it to the right use a positive one.
This best setting for me personally is the "Candle Selection" -dropdown. This allows you to decide wether you want to show the previous candles OHLC-data or the current live OHLC-data.
!!CAUTION!! If you use the "Current Month/Week/Day" -selection be aware that values shown are "live"-data of the current candle. Therefore, values will change the same way your chart keeps changing on live data.
The "Previous Month/Week/Day" -selection on the other hand is historical data and therefore only changes once we reached a new month/week/day.
If you like my work, consider leaving a like :)
Happy trading!
BEST Multicolor Supertrend InfoPanelHello traders
Today is a Pinescript hack to display multiple colors in one label.
I used that panel to show the Supertrend Long Term values (weekly, monthly, quarterly, yearly)
What is a Supertrend?
Definition : SuperTrend is an indicator that works on all timeframes and all instruments (stocks, futures, forex, ...). It is a great tool to follow market trends and optimizes your profits.
SuperTrend evolves below or above the prices depending on the trend. You can use it as an exit position indicator when its direction changes. You can also use it to place your stops.
So.... the hack is?
The hack is about creating a new label for each line - versus creating just one label containing the whole text
Best regards,
Dave
[TK] Just a labelThis script puts a simple label with a customizable text on the chart.
I use this to label my different chart layouts, as tradingview unfortunately has removed the current layout name from the main user interface.
High Low of Custom Timeframes by Theoris Normal indicator for show
High - Low of Custom timeframe ( default is Day timeframe )
show label with custom Color text
and show the value of High, low.
#HOD #LOD
Scripting Tutorial 8 - Triple Many Moving Averages RibbonsThis script is for a triple moving average indicator where the user can select from different types of moving averages, price sources, lookback periods and resolutions.
Features:
- 3 Moving Averages with variable MA types, periods, price sources, resolutions and the ability to disable each individually
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish, bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter. Twitter should be linked to my profile.
- Ribbons added and on by default. Optional setting to disable the ribbons. 5 ribbons between MA1 and MA2 and another 5 between MA2 and MA3.
- Ribbons are alpha-color coded based on their relation to their default MAs.
- Ribbons are only visible between MAs if the MAs being compared share the same Type, Resolution, and Source because there is no way to consolidate those three in a simple manner.
- Ribbon values are calculated based on calculated MA Periods between the MAs.
This script is meant as an educational script with well-formatted styling, and references for specific functions.
Pivot Prices - ExampleA simple example script showing how to use label.new() to plot pivot prices on the chart.
A full tutorial and commentary is available on the backtest-rookies website.
Your CRYPTO Screener - MACD 0 LAG editionHello traders
What's good?
1 - Quick introduction
This script is to demonstrate a proof-of-concept - showing you again what you thought wasn't possible might become (with some tricks) in the realm of possibles !!!.
I get requests for people who want a custom screener because the native TradingView Stocks/Forex/Crypto screeners don't allow to plug external indicators. (example: www.tradingview.com
This is entirely true and I have also good news for you, we can hack the system one more time. As Hackerman would say, "IT"S HACKING TIME !!!" (ref : KUNG FURY . (#geek #reference #done #for #today)
What if you could build your own personalized screener based on your custom indicator? "No Dave stop smoking, that's not possible, go back to eating your baguette". Say no more, let me present you my new script called YOUR CRYPTO Screener (MACD 0 LAG)
2 - What is a MACD ZERO LAG?
We'll all agree this indicator is NOT in the TradingView screeners so I'm not cheating here :)
A MACD ZERO LAG is a MACD that .... suspens.... wait for it.... DOES NOT lag.
The traditional MACD is based on exponential moving averages and as moving averages are lagging, then the MACD is lagging also. I'll spare you all the maths behind the MACD ZERO LAG but in short, this is a way more reactive indicator than the traditional MACD
I shared before the version that I personally use for my own trading : MACD 0 LAG nTREND coloring
3 - Crypto Screener specifications
If I could do a screener as complete as the native one, this would be wonderful but ... we cannot and this is due to technical reasons. To call indicators from different timeframes, I have to use the security function. And we're limited to 40 security calls per indicator.
That explains why I selected 4 crypto assets and 5 timeframes and the MACD zero lag output for each asset/timeframe - which gives a total of 4 * 5 * 2 = 40
You'll be able to select from the interface the 5 timeframes that you want for your screener
In this script, you'll get a :
- BUY whenever the MACD ZERO LAG for your asset/timeframe is green.
- SELL whenever the MACD ZERO LAG for your asset/timeframe is red.
4 - Can you hack it even more?
If you want to add other timeframes or assets, you can either, change the code or add the indicator on another chart.
I made the source code generic enough so that you can update it yourself easily
Example:
Chart 1 will list BTCUSD, ETHUSD, LTCUSD, and XRPUSD in m5/m15/m30/H1/H4 and Chart2 could list BTCUSD, ETHUSD, LTCUSD and XRPUSD in H6/H8/H12/Daily, etc...
Once again the sky (and your computer RAM capacity) is the limit
5 - Can you super hack it even more?
1/ This script is only a proof-of-concept that you can build your own custom screener. Imagine having the Algorithm Builder and being able to connect it in a single click to a custom screener using your own configuration :)
How coooooooooooooooool would that be!!!
This screener version will be available on my website in a few weeks along with all the tools I'm spamming you about since the beginning of July (#shameless #self-advertising)
2/ For a nicer scripter, let's keep in mind that TradingView just enabled Webhooks this week. This will allow my company to offer custom screeners design and hosted on your own website. Those screeners will be for sure nicer than the indicator version
That's it for today and for this week
I won't even touch the laptop this weekend and will enjoy life a bit
Love you all
Dave
____________________________________________________________
Be sure to hit the thumbs up. Building those indicators take a lot of time and likes are always rewarding for me :) (tips are accepted too)
- If you want to suggest some indicators that I can develop and share with the community, please use my personal TRELLO board
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Supertrend MTF Heatmap V2Hello traders and aspiring Pinescripters
You might remember this script Supertrend-Heatmap-Multi-timeframes/ ?
A follower, asked me in a comment to do a version where YOU guys can select the timeframes
Well... what follower asks, follower (sometimes) gets. I'm not Santa Claus but this is Christmas with a few months in advance (#oh #oh #oh)
Customizable Trend Direction (Open-Source)Hello everyone
I received a ton of requests for this script so I decided to share it
I did it for a client who didn't want to pay (you can all blame... or even thank him for this script) in the end and I don't want to sell it on my website.
Not because it's not interesting but because my website will be a place to showcase and rent the Algorithm Builders mostly
What is it about?
Basically, it shows how you could convert a plotshape into a label.new object. Very interesting if you want someday to convert your V3 script into V4
With this script, it shows that you can in V4 ( but couldn't do in V3 ) do the followings :
- change dynamically the size (from tiny to huge) of any object
- change dynamically the text (from whatever to whatever) of any object
Screenshot of the user interface
imgur.com
Other use cases
I did it with the Trend Direction but could work with anything really.
- Any indicator with a visual signal. You can know personalized from a user interface the text, size and also the vertical shift. I didn't do it for that one but label.new takes a (x,y) coordinates so playing with y is fairly easy to achieve a dynamic vertical shift
- Even with this script Plotchar-How-to-draw-external-symbols-on-a-chart/ but would require to be updated with a label.new object and with a shape.none parameter so that we'll only see the icon/symbol displayed
- The colors also can be change dynamically using presets Presets-Selector-FRIDAY-NIGHT-CHALLENGE/ . If you have an indicator showing a BULLISH and a BEARISH signal, then you could, for instance, configure colors presets according to the timeframe of the chart or the indicator input, etc (sky is the limit ^^)
Be sure to hit the thumbs up at it motivates me to research what Pinescript can offer and share with the community
Dave
____________________________________________________________
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
Current Price Label by Westy_A simple Indicator to display the current price of the asset above the current bar. It shows a green label if the close is equal or greater than the open, red otherwise.
Current Price Bar LabelA simple Indicator to display the current price of the asset above the current bar. It shows a green label if the close is equal or greater than the open, red otherwise.
Customizable Trend DirectionHi everyone
Publishing this as a few clients want to try it out
It's basically a proof-of-concept to show that size and text can be manipulated :)
Size and text and label vertical position are udpatable
Will publish an open-source script today or tomorrow hopefully
Dave