CosmoSetContains widely use indicators
This contains below indicators
RSI
WMA
SMA
EMA
Colored Vwap
Super Trend
All the above indicators are customizable.
Pine utilities
Under09_01Parametros de entradas
Activo->btc xbtusd (Bitmex)
Temporalidad->2h
SL-> 0.2
TP->12.2
Angulo->4.2
p->2
longitud->27
//@version=4
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
//Ultima version underground09
strategy(title = " underground09",
shorttitle = "Under09",
overlay = true,
precision = 8,
calc_on_order_fills = true,
calc_on_every_tick = true,
backtest_fill_limits_assumption = 0,
default_qty_type = strategy.fixed,
default_qty_value = 2,
initial_capital = 10000,
pyramiding=5,
currency = currency.USD,
linktoseries = true)
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
var sl = 0.0
var tp = 0.0
var acumaldor_vxp = 0.0
var acomuldor_vol = 0.0
//stop_loss = input(defval=0.2, title="Porcentaje Stop Loss", type=input.float, step=0.2)
stop_loss = input(defval=1.4, title="Porcentaje Stop Loss", type=input.float, step=0.2)
//take_profit = input(defval=4.4, title="Porcentaje Take Profit", type=input.float, step=0.2)
take_profit = input(defval=5.6, title="Porcentaje Take Profit", type=input.float, step=0.2)
//pintar_trade = input(defval=false, title="Pintar trade TP SL")
angulo_permitido = input(defval=26.8, title="Angulo permitido", type=input.float, step=0.2)
backTestSectionFrom = input(title = "═══════════════ From ═══════════════", defval = true, type = input.bool)
FromMonth = input(defval = 1, title = "Month", minval = 1)
FromDay = input(defval = 1, title = "Day", minval = 1)
FromYear = input(defval = 2019, title = "Year", minval = 2014)
backTestSectionTo = input(title = "════════════════ To ════════════════", defval = true, type = input.bool)
ToMonth = input(defval = 31, title = "Month", minval = 1)
ToDay = input(defval = 12, title = "Day", minval = 1)
ToYear = input(defval = 9999, title = "Year", minval = 2014)
Config = input(title = "══════════════ Config ══════════════", defval = true, type = input.bool)
//p = input(6)
p = input(4)
//length = input(30)
length = input(26)
//
backTestPeriod() => (time > timestamp(FromYear, FromMonth, FromDay, 00, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, 23, 59))
//
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
x1 = bar_index
x2 = sqrt(x1)
y = high
//
S11 = sum(x2,length) - sqrt(sum(x1,length)) / length
S12 = sum(x1*x2,length) - (sum(x1,length) * sum(x2,length)) / length
S22 = sum(sqrt(x2),length) - sqrt(sum(x2,length)) / length
Sy1 = sum (y*x1,length) - (sum(y,length) * sum(x1,length)) / length
Sy2 = sum (y*x2,length) - (sum(y,length) * sum(x2,length)) / length
//
max1 = sma(x1,length)
max2 = sma(x2,length)
may = sma(y,length)
b2 = ((Sy1 * S22) - (Sy2*S12))/(S22*S11 - sqrt(S12))
b3 = ((Sy2 * S11) - (Sy1 * S12))/(S22 * S11 - sqrt(S12))
b1 = may - b2*max1 - b3*max2
qr = b1 + b2*x1 + b3*x2
//
yl = low
//
Sy1l = sum(yl*x1,length) - (sum(yl,length) * sum(x1,length)) / length
Sy2l = sum(yl*x2,length) - (sum(yl,length) * sum(x2,length)) / length
//
mayl = sma(yl,length)
b2l = ((Sy1l * S22) - (Sy2l*S12))/(S22*S11 - sqrt(S12))
b3l = ((Sy2l * S11) - (Sy1l * S12))/(S22 * S11 - sqrt(S12))
b1l = mayl - b2l*max1 - b3l*max2
qrl = b1l + b2l*x1 + b3l*x2
//
period = round(p/2)+1
hh = qr
ll = qrl
countH = 0
countL = 0
buy=0
sell=0
//
for i = 1 to period-1
if qr ll
countL:=countL+1
for i = period+1 to p+1
if qr ll
countL:=countL+1
if countH==p
pivotH = high
buy := 1
if countL==p
pivotL = low
sell := 1
//
Angulo(_serie) =>
atan( _serie - _serie ) * 180 / acos(-1)
//calcular elvwap
vxp = volume*hlc3
//:= signo de acumulador
acumaldor_vxp := acumaldor_vxp + vxp
acomuldor_vol := acomuldor_vol + volume
vwap2 = acumaldor_vxp / acomuldor_vol
pendiente = Angulo(vwap2)
//
plotshape(buy == 1 , text='⬆️', style=shape.arrowup, location=location.belowbar, color=#32CD32, textcolor=color.white, offset=0, transp=0,size=size.auto)
if buy == 1
alert("Posible long",alert.freq_all )
plotshape(sell == 1 , text='⬇️', style=shape.arrowdown, location=location.abovebar, color=#FF0000, textcolor=color.white, offset=0, transp=0,size=size.auto)
if sell == 1
alert("Posible short",alert.freq_all )
//
//if (backTestPeriod())
//strategy.entry("long", true, 1, when = buy == 1)
// strategy.entry("short", false, 1, when = sell == 1)
if buy == 1 and pendiente > angulo_permitido
//if buy == 1
cantidad = round(strategy.equity / close )
strategy.entry("long", true, cantidad, comment = "Compra")
sl := close * ( 1 - (stop_loss/100))
tp := close * ( 1 + (take_profit/100))
if sell == 1 and pendiente > angulo_permitido
//if sell == 1
cantidad = round(strategy.equity / close )
strategy.entry("short", false, cantidad, comment = "Venta")
sl := close * ( 1 + (stop_loss/100))
tp := close * ( 1 - (take_profit/100))
//Validaciones
comprado = strategy.position_size > 0 //true si es positivo
vendido = strategy.position_size < 0 //true si es negativo
if comprado
//Salir sl
if close >= tp
//plotshape(close >= tp, style=shape.xcross)
strategy.close("long", comment="TP")
//Salir tp
if close <= sl
strategy.close("long", comment="SL")
if vendido
//Salir sl
if close <= tp
strategy.close("short", comment="TP")
//Salir tp
if close >= sl
strategy.close("short", comment="SL")
//sl tp
plot( sl , color =color.red, style=plot.style_cross)
plot( tp , color= color.green , style=plot.style_circles)
//color
//bgcolor (comprado ? color.green: na)
//bgcolor (vendido ? color.red: na)
//if pintar_trade
//bgcolor (close >= tp ? color.green : na, transp=80)
//bgcolor (close >= sl ? color.red : na, transp=80)
Market MonitorThe script can be used to send a JSON message to the webhook once per time. For example, to store market conditions in an external database. The latter is make sense for smaller timeframes due to TradingView limitations on the number of available bars. The interval between messages can be set in the settings. To set up transmitted market metrics, you will probably need to modify the script code to add metrics that are important to you.
RaenonX - Manual PnL TrackerChange the "ticker" field in the settings to the ticker to track (for example, "SQQQ") before use.
Manually track the PnL of a single ticker.
The current PnL will be shown at the right bottom of the chart.
Candle Fill % MeterFor use with Hollow Candles
Fills Candles based on either the value of the RSI or coppock scaled to fit properly between the open and close. Makes for a compact visual with lot's of information given. Toggle bells and whistles in settings such as arrows to indicate the direction of the value being measured, dividing levels, fill from candle open all the time instead of the bottom up and more.
Weighted percentile nearest rankYo, posting it for the whole internet, took the whole day to find / to design the actual working solution for weighted percentile 'nearest rank' algorithm, almost no reliable info online and a lot of library-style/textbook-style solutions that don't provide on real world production level.
The principle:
0) initial data
data = 22, 33, 11, 44, 55
weights = 5 , 3 , 2 , 1 , 4
array(s) size = 5
1) sort data array, apply the sorting pattern to the weights array, resulting:
data = 11, 22, 33, 44, 55
weights = 2 , 5 , 3 , 1 , 4
2) get weights cumsum and sum:
weights = 2, 5, 3 , 1 , 4
weights_cum = 2, 7, 10, 11, 15
weights_sum = 15
3) say we wanna find 50th percentile, get a threshold value:
n = 50
thres = weights_sum / 100 * n
7.5 = 15 / 100 * 50
4) iterate through weights_cum until you find a value that >= the threshold:
for i = 0 to size - 1
2 >= 7.5 ? nah
7 >= 7.5 ? nah
10 >= 7.5 ? aye
5) take the iteration index that resulted "aye", and find the data value with the same index, that's gonna be the resulting percentile.
i = 2
data = 33
This one is not an approximation, not an estimator, it's the actual weighted percentile nearest rank as it is.
I tested the thing extensively and it works perfectly.
For the skeptics, check lines 40, 41, 69 in the code, you can comment/uncomment dem to switch for unit (1) weights, resulting in the usual non-weighted percentile nearest rank that ideally matches the TV's built-in function.
Shoutout for @wallneradam for the sorting function mane
...
Live Long and Prosper
Sovereign Gold Hodlers Script for comparing nations and their gold, with options including:
Default Comparing the Price of Gold
Use Relative Valuations price / prior price
Measure Reserves/Price
GDP/Gold Price
GDP/Gold Reserves
Given the state of the world I thought it'd be good do see where countries stand, how much real money they hold. I think gold is going to play an increased role in trade between economies in the near future.
FUNCTION: Limited Historical Data WorkaroundFUNCTION: Limited Historical Data Workaround
If you are working with bitcoin weekly charts, or any other ticker with a low amount of price history this function may help you out. For example you want to apply indicators to some shitcoin that just launched? This can help you.
It can be frustrating to use certain built-ins since they will only give an output once the full lookback length is available. This function allows you to avoid that situation and start plotting things with almost no history whatsoever!
In this example code we do it by utilizing a replacement for the built in pine SMA function. This function allows us to pass a series instead of just a simple int to the length variable of the SMA. This can be achieved with all the pine built ins and I believe @pinecoders has a publication already detailing many of them with full coded examples.
Then we replace the length of the SMA with the custom history function. It checks to see if the current bar index is less than the length of the function. Then if it is, it changes the length to the bar index allowing us to get plots and series earlier than otherwise possible.
Sessionshighlight background of charts when withing trading sessions
Timezone: string: can put GMT+8 etc , for all options , check timeframe.time docs, under Timezone variable
Symbol InfoFor those who likes clean chart:
Adjustable Symbol ticker and timeframe( AKA watermark) script is here.
1: You can place Symbol ticker and timeframe info anywhere on the chart.
Also you can hide one of them or both.
Position:
Horizontal options: Left Center Right
Vertical options: Top Middle Bottom
Size: Tiny Smal Normal Large Huge Auto
Color is adjustable. Background is optional too.
2: Even more cool part is you can add 2 different custom texts that can switch. (Idea from Pinecoders original script)
You don't have to use text function and reposition it everytime, your message will always stays at one place.
Let the chart deliver your message.
I put my favourite trading slangs there:
1. Do Your Own Research (DYOR)
2. Not a Financial Advice ( NFA)
VIPThis indicator is using the modified "SSS".
This strategy uses combined indicators to create LONG entry points, the strategy was first found by saudALThaidy.
How to use: Open your asset and pick a timeframe between 5min and 2hours (recommended: 30min, 45min), the strategy will give entry points itself, you can monitor and take profit manually(recommended), or you can use the exit setup.
exit setup:
Take Profit : close the trade and take profit after the specified percentage from the entry point gets hit.
Use Stop Percentage : if false, trade will be closed if it gets below MA line, if true it will use the next set up.
StopLose Percentage : specify a percentage to close the trade if the asset price goes below it.
Important Notes:
As saudALThaidy states that the strategy must be used with -heiken ashi- candles for the best result.
for best use of the strategy, use (Take Profit = 1,Use Stop Percentage=false) to get every trade, and take profit manually when ever you see the best.
For any notes on the strategy to be edited, or for another strategies ideas please comment.
Option Calculator [elio27]Option Calculator is a simple tool to help people visualize their option positions directly on the chart, it also gives some useful numbers about the position, such as the Break Even point or the net return for example.
Be careful what you do with options, you can easily make mistakes as it is not as easy as spot or futures trading for beginners.
R:R Trading System FrameworkFirst off, huge thanks to @fikira! He was able to adapt what I built to work much more efficiently, allowing for more strategies to be used simultaneously. Simply put, I could not have gotten to this point without you. Thanks for what you do for the TV community. Second, I am fairly new to pinescript writing, so I welcome criticism, thoughtful input and improvement suggestions. I would love to grow this concept into something even better, if possible. So please let me know if you have any ideas for improvement. However I do juggle a lot of different things outside of TV, so implementations may be delayed.
I have decided, at this time, not to add alerts. First, because I feel most people looking to adapt this framework can add their own pretty easily. Also, given how customized the framework is currently, while also attempting to account for all the possible ways in which people may want alerts to function after they customize it, it seems best to leave them out as it doesn't exactly fit the idea of a framework.
For best viewing, I recommend hovering over the script's name > ... > Visual order > Bring to front. Also I found hollow candles with mono-toned colors (like pictured) are more visually appealing for me personally. I HIGHLY RECOMMEND USING WITH BAR REPLAY TO BETTER UNDERSTAND THE FRAMEWORK'S FUNCTIONALITY.
▶️ WHAT THIS FRAMEWORK IS
- A huge collection of concepts and capabilities for those trying to better understand, learn, or teach pinescript.
- A system designed to showcase Risk:Reward concepts more holistically by providing all of the most popular components of retail trading to include backtesting, trade visual plotting, position tracking, market condition shifts, and useful info while positioned to help highlight changes in your risk:reward based decision-making processes.
- A system that can showcase individual strategies regardless of trade direction, allowing you to develop hedging strategies without having multiple indicators that do not correlate with each other.
- Designed around the idea that you trade less numbers of assets but manage your positions and risk based on multiple concurrently running strategies to manage your risk exposure and reward potential.
- An attempt to combine all the things you need to execute with an active trading management style.
- A framework that uses backtested results (in this case the number of averaged bars it takes to hit key levels) in real-time to inform your risk:reward decision-making while in-trade (in this case in your Trade Tracking Table using dynamic color to show how you might be early, on-time, or late compared to the average amount of backtested time it normally takes to hit that specific key level).
▶️ WHAT THIS FRAMEWORK IS NOT
- A complete trading product. DO NOT USE as-is. It is a FRAMEWORK for you to generate ideas of your own and fairly easily implement your own triggering conditions in the appropriate sections of the script.
▶️ USE CASES
- If you decide you like the Stop, Target, Trailing Stop, and Risk:Reward components as-is, then just understanding how to plug in your Entry and Bullish / Bearish conditions (Triangles) and adjust the input texts to match your custom naming will be all you need to make it your own!
- If you want to adapt certain components, then this system gives you a great starting point to adapt your different concepts and ideas from.
▶️ SYSTEM COMPONENTS
- Each of the system's components are described via tooltips both in the input menu and in the tables' cells.
- Each label on the chart displays the corresponding price at those triggered conditions on hover with tooltips.
- The Trailing Stop only becomes active once it is above the Entry Price for that trade, and brightens to show it is active. The STOP line (right of price) moves once it takes over for the Entry Stop representing the level of the Trailing Stop at that time for that trade.
- The Lines / Labels to the right of price will brighten once price is above for Longs or below for Shorts. The Trade Tracking Table cells will add ☑️ once price is above for Longs or below for Shorts.
- The brighter boxes on the chart show the trades that occurred based on your criteria and are color coded for all components of each trade type to ensure your references are consistent. (Defaults are TV built-in strategies)
- The lighter boxes on the chart show the highest and lowest price levels reached during those trades, to highlight areas where improvements can be made or additional considerations can be accounted for by either adjusting Entry triggers or Bullish / Bearish triggers.
- Default Green and Red Triangles (Bullish / Bearish) default to having the same triggering condition as the Entry it corresponds to. This is to highlight either a pyramiding concept, early exit, or you can change to account for other things occurring during your trades which could help you with Stop and Target management/considerations.
TradingView and many of its community members have done a lot for me, so this is my attempt to give back.
BINANCE_Minimum_qty_for_tradingWe can not buy just 0.001ETH in Binance on 2022.8.8
Why? Binance have trading role about the minimum qty of coins.
Until now, we can not find the info in TradingView.
I hope Our TradingView give us this updating info easily oneday.
I am not a good English speaker.
Sorry about my short explanation.
reference: www.binance.com
OHL Screener by KiranScript is intended to scan Open = High and Open = Low (OHL) stocks for selected Opening Range in minutes.
I have added NSE NIFTY 50 stocks as default input for the script. Hopefully it will work with other stocks and exchanges.
Opening Range time is limited to the "1 min, 3 min, 5 min, 15 min, 30 min and 60 min" as OHL generally required for Intraday.
Stock qualified criteria OPEN = LOW (in selected Opening Range timeframe) will be listed in the table at TOP RIGHT corner of the chart screen in a green background.
Stock qualified criteria OPEN = HIGH (in selected Opening Range timeframe) will be listed in the table at BOTTOM LEFT corner of the chart screen in a red background.
Script scans stocks irrespective of current chart symbol and current time frame on the chart.
Limitations:
- Maximum 40 stocks can be scanned.
- request.security can't be placed under loop hence repeat call to request.security should be placed on separate line
CLOCKDISXLAIMER
Please use this on 1 minute chart, (m1 chart has least amount of bugs, verify that your timeframe do not* Sync to layouts)
With this clock indicator you can set an alert to any time you choose when opening settings, also it will fit if you like dark theme or light theme.
There are more visualization settings that can be altered inside settings for better fitting in other resolutions / monitors, like tablets, laptops, TVs, etc.
Cheers, Green pips to everybody :):)
[TH] IMF(In Market Forever)If you want to be in market forever , Set Entry/Profit/Loss in advance.
This strategy is a profit and loss strategy indicating P&L Ratio on chart.
You can use webhook for auto-trade using my opensource webhook server(TradingHook).
Manual
add to chart
set entry price using mouse click on your chart
set profit price using mouse click on your chart
set loss price using mouse click on your chart
set nums of trades(default 1)
set alert for webhook if you have TradingHook webhook server
Future Risk CalculatorCreated out of revenge against the difficulty of controlling psychology, greed, and risk management. Designed for cryptocurrency futures trading by following the risk management principles from Kevin Sailly. Very welcome if there are suggestions and input to improve the quality of this "indicator". Please use wisely.
How to use:
1. Open indicator settings.
2. Fill out all the forms. (Note: I make Max Loss Risk only has 5 options. Because, you know, to control the greed. You can choose by considering your risk profiles and market condition)
3. All of the information and calculation will appear on the label (right side of the bar chart) and top-right box.
4. You can adjust the three prices (target, entry, and stop) by clicking any part of the indicator. There will be three dots in the middle of the chart window (align with three prices). Click that dots and drag them up/down to customize according to your wishes. The price order must be correct, for LONG direction the price order from the top is target-entry-stop. Vice versa for SHORT direction. There will be "SETUP ERROR" text in the top-right box if the price order is not correct.
"Never, ever argue with your trading system." (by Michael Covel)
Regards,
Ircham
Strategy Backtesting Template [MYN]A few people have been asking me to share my backtesting template. Currently I use this as my starting point for validating existing strategies and developing new ones.
Features:
Trading Date Range
Trade Direction
4 progressive take profits with target percents and percentage of position to take profit on (Thanks adolgo)
Variable percentage Stop Loss
Automatic ProfitView Alert Syntax builder for Longs and Shorts
ADX checkbox to automatically add conditional logic to your strategy
Strategy BackTest Display Statistics - TraderHalaiThis script was born out of my quest to be able to display strategy back test statistics on charts to allow for easier backtesting on devices that do not natively support backtest engine (such as mobile phones, when I am backtesting from away from my computer). There are already a few good ones on TradingView, but most / many are too complicated for my needs.
Found an excellent display backtest engine by 'The Art of Trading'. This script is a snippet of his hard work, with some very minor tweaks and changes. Much respect to the original author.
Full credit to the original author of this script. It can be found here: www.tradingview.com
I decided to modify the script by simplifying it down and make it easier to integrate into existing strategies, using simple copy and paste, by relying on existing tradingview strategy backtester inputs. I have also added 3 additional performance metrics:
- Max Run Up
- Average Win per trade
- Average Loss per trade
As this is a work in progress, I will look to add in more performance metrics in future, as I further develop this script.
Feel free to use this display panel in your scripts and strategies.
Thanks and enjoy :)
Average Price LineThis was published in substitute of the original AVG price line that was already implemented into TradingVIew.
Get the average price in the desired range you want.