position size for short selling-Roy LeeThis script enable you to dynamically calculate your position size or amount of shares you should use, based off your dollar risk level.
The script is set up for short seller.
e.g. if you would like to risk $100.00 what is the shares you should trade based off that.
If you wanted to risk $100.00 and you enter current price at 2.00 and your stop lost is 1.90.
the script will dynamically tell you the shares you should use if 1,000.
There is other function like look back period where you could specify how many candles you wish the risk level to hold at that level.
The script will be able to help in calculating the shares based on your current average shares of your current position.
Example, based on the above you have short 500 shares at 1.90 risk 2.00, you maybe enter the average shares and current position,
The script will help you calculate the amount of remaining shares you can trade netting of your initial trade.
the above the trader has risked $50.00 so there is a remainder of $50.00.
If the price is currently at 1.80 and risk off 2.00 the script will show 250 shares.
Educational
PIVOT STRATEGY [INDIAN MARKET TIMING]
A Back-tested Profitable Strategy for Free!!
A PIVOT INTRADAY STRATEGY for 5 minute Time-Frame , that also explains the time condition for Indian Markets
The Timing can be changed to fit other markets, scroll down to "TIME CONDITION" to know more.
The commission is also included in the strategy .
The basic idea is when ,
1) Price crosses above ema1 ,indicated by pivot highest line in green color .
2) Price crosses below ema1 ,indicated by pivot lowest line in red color .
3) Candle high crosses above pivot highest , is the Long condition .
4) Candle low crosses below pivot lowest , is the Short condition .
5) Maximum Risk per trade for the intraday trade can be changed .
6) Default_qty_size is set to 60 contracts , which can be changed under settings → properties → order size .
7) ATR is used for trailing after entry, as mentioned in the inputs below.
// ═════════════════════════//
// ————————> INPUTS <————————— //
// ═════════════════════════//
Leftbars —————> Length of pivot highs and lows
Rightbars —————> Length of pivot highs and lows
Price Cross Ema —————> Added condition
ATR LONG —————> ATR stoploss trail for Long positions
ATR SHORT —————> ATR stoploss trail for Short positions
RISK —————> Maximum Risk per trade for the day
The strategy was back-tested on RELIANCE ,the input values and the results are mentioned under "BACKTEST RESULTS" below .
// ═════════════════════════ //
// ————————> PROPERTIES<——————— //
// ═════════════════════════ //
Default_qty_size ————> 60 contracts , which can be changed under settings
↓
properties
↓
order size
// ═══════════════════════════════//
// ————————> TIME CONDITION <————————— //
// ═══════════════════════════════//
The time can be changed in the script , Add it → click on ' { } ' → Pine editor→ making it a copy [right top corner} → Edit the line 25 .
The Indian Markets open at 9:15am and closes at 3:30pm .
The 'time_cond' specifies the time at which Entries should happen .
"Close All" function closes all the trades at 3pm, at the open of the next candle.
To change the time to close all trades , Go to Pine Editor → Edit the line 103 .
All open trades get closed at 3pm , because some brokers don't allow you to place fresh intraday orders after 3pm .
NSE:RELIANCE
// ═══════════════════════════════════════════════ //
// ————————> BACKTEST RESULTS ( 128 CLOSED TRADES )<————————— //
// ═══════════════════════════════════════════════ //
INPUTS can be changed for better back-test results.
The strategy applied to NIFTY ( 5 min Time-Frame and contract size 60 ) gives us 60% profitability y , as shown below
It was tested for a period a 6 months with a Profit Factor of 1.45 ,net Profit of 21,500Rs profit .
Sharpe Ratio : 0.311
Sortino Ratio : 0.727
The graph has a Linear Curve with consistent profits .
The INPUTS are as follows,
1) Leftbars ————————> 3
2) Rightbars ————————> 5
3) Price Cross Ema ——————> 150
4) ATR LONG ————————> 2.7
5) ATR SHORT ———————> 2.9
6) RISK —————————> 2500
7) Default qty size ——————> 60
NSE:RELIANCE
Save it to favorites.
Apply it to your charts Now !!
↓
FOLLOW US FOR MORE !
Thank me later ;)
Exchange sessionsThe Exchange sessions indicator allows you to show world trading sessions on the chart, taking into account working hours in the corresponding time zone .
>> For traders:
The settings set the working hours of the exchange, and the indicator itself automatically binds it to the time zone of the selected exchange location - this allows you not to get confused about the correctness of the entered time ranges for any type of chart - stock, futures, index, forex or crypto. By default, the valid working hours are set and no further configuration is required.
In addition, you can select those zones that you want to highlight (using the marker to the left of the session name), and you can also highlight the beginning of each trading session - the start marker.
>> For encoders:
In the code, you can see how to set the session time and bind its control to the time zone from the IANA time zone database.
Also, in the code you will find a way to align the description of input parameters using Unicode Spaces.
I hope that my script will benefit the community and provide a quality result in my work!
All profit!
=========================================================================================
Индикатор Exchange sessions позволяет показать на графике мировые торговые сесси с учётом рабочего времени в соответствующм часовом поясе .
>> Для трейдеров:
В настройках выставляется рабочее время биржи, а индикатор сам автоматически привязывает его к часовому поясу выбранной локации биржи - это позволяет не путаться в корректности введённых временных диапазонов при любом типе графика - stock, futures, index, forex или crypto. По умолчанию задано действующее рабочее время и дополнительная настройка не требуется.
Кроме этого - можно выбирать те зоны, которые нужно подсветить (с помощью маркера слева от названия сессии), а также можно выделить начало каждой торговой сессии - маркер start.
>> Для кодеров:
В коде Вы можете посмотреть как задавать время сессии и привязать его контроль к временной зоне из базы данных часовых поясов IANA.
Также, в коде Вы найдёте способ выравнивания описания входных параметров с помощью Unicode Spaces.
Я надеюсь, что мой скрипт принесёт пользу сообществу и предоставит качественный результат в своей работе!
Всем профита!
Variety N-Tuple Moving Averages w/ Variety Stepping [Loxx]Variety N-Tuple Moving Averages w/ Variety Stepping is a moving average indicator that allows you to create 1- 30 tuple moving average types; i.e., Double-MA, Triple-MA, Quadruple-MA, Quintuple-MA, ... N-tuple-MA. This version contains 2 different moving average types. For example, using "50" as the depth will give you Quinquagintuple Moving Average. If you'd like to find the name of the moving average type you create with the depth input with this indicator, you can find a list of tuples here: Tuples extrapolated
Due to the coding required to adapt a moving average to fit into this indicator, additional moving average types will be added as they are created to fit into this unique use case. Since this is a work in process, there will be many future updates of this indicator. For now, you can choose from either EMA or RMA.
This indicator is also considered one of the top 10 forex indicators. See details here: forex-station.com
Additionally, this indicator is a computationally faster, more streamlined version of the following indicators with the addition of 6 stepping functions and 6 different bands/channels types.
STD-Stepped, Variety N-Tuple Moving Averages
STD-Stepped, Variety N-Tuple Moving Averages is the standard deviation stepped/filtered indicator of the following indicator
Last but not least, a big shoutout to @lejmer for his help in formulating a looping solution for this streamlined version. this indicator is speedy even at 50 orders deep. You can find his scripts here: www.tradingview.com
How this works
Step 1: Run factorial calculation on the depth value,
Step 2: Calculate weights of nested moving averages
factorial(depth) / (factorial(depth - k) * factorial(k); where depth is the depth and k is the weight position
Examples of coefficient outputs:
6 Depth: 6 15 20 15 6
7 Depth: 7 21 35 35 21 7
8 Depth: 8 28 56 70 56 28 8
9 Depth: 9 36 34 84 126 126 84 36 9
10 Depth: 10 45 120 210 252 210 120 45 10
11 Depth: 11 55 165 330 462 462 330 165 55 11
12 Depth: 12 66 220 495 792 924 792 495 220 66 12
13 Depth: 13 78 286 715 1287 1716 1716 1287 715 286 78 13
Step 3: Apply coefficient to each moving average
For QEMA, which is 5 depth EMA , the calculation is as follows
ema1 = ta. ema ( src , length)
ema2 = ta. ema (ema1, length)
ema3 = ta. ema (ema2, length)
ema4 = ta. ema (ema3, length)
ema5 = ta. ema (ema4, length)
In this new streamlined version, these MA calculations are packed into an array inside loop so Pine doesn't have to keep all possible series information in memory. This is handled with the following code:
temp = array.get(workarr, k + 1) + alpha * (array.get(workarr, k) - array.get(workarr, k + 1))
array.set(workarr, k + 1, temp)
After we pack the array, we apply the coefficients to derive the NTMA:
qema = 5 * ema1 - 10 * ema2 + 10 * ema3 - 5 * ema4 + ema5
Stepping calculations
First off, you can filter by both price and/or MA output. Both price and MA output can be filtered/stepped in their own way. You'll see two selectors in the input settings. Default is ATR ATR. Here's how stepping works in simple terms: if the price/MA output doesn't move by X deviations, then revert to the price/MA output one bar back.
ATR
The average true range (ATR) is a technical analysis indicator, introduced by market technician J. Welles Wilder Jr. in his book New Concepts in Technical Trading Systems, that measures market volatility by decomposing the entire range of an asset price for that period.
Standard Deviation
Standard deviation is a statistic that measures the dispersion of a dataset relative to its mean and is calculated as the square root of the variance. The standard deviation is calculated as the square root of variance by determining each data point's deviation relative to the mean. If the data points are further from the mean, there is a higher deviation within the data set; thus, the more spread out the data, the higher the standard deviation.
Adaptive Deviation
By definition, the Standard Deviation (STD, also represented by the Greek letter sigma σ or the Latin letter s) is a measure that is used to quantify the amount of variation or dispersion of a set of data values. In technical analysis we usually use it to measure the level of current volatility .
Standard Deviation is based on Simple Moving Average calculation for mean value. This version of standard deviation uses the properties of EMA to calculate what can be called a new type of deviation, and since it is based on EMA , we can call it EMA deviation. And added to that, Perry Kaufman's efficiency ratio is used to make it adaptive (since all EMA type calculations are nearly perfect for adapting).
The difference when compared to standard is significant--not just because of EMA usage, but the efficiency ratio makes it a "bit more logical" in very volatile market conditions.
See how this compares to Standard Devaition here:
Adaptive Deviation
Median Absolute Deviation
The median absolute deviation is a measure of statistical dispersion. Moreover, the MAD is a robust statistic, being more resilient to outliers in a data set than the standard deviation. In the standard deviation, the distances from the mean are squared, so large deviations are weighted more heavily, and thus outliers can heavily influence it. In the MAD, the deviations of a small number of outliers are irrelevant.
Because the MAD is a more robust estimator of scale than the sample variance or standard deviation, it works better with distributions without a mean or variance, such as the Cauchy distribution.
For this indicator, I used a manual recreation of the quantile function in Pine Script. This is so users have a full inside view into how this is calculated.
Efficiency-Ratio Adaptive ATR
Average True Range (ATR) is widely used indicator in many occasions for technical analysis . It is calculated as the RMA of true range. This version adds a "twist": it uses Perry Kaufman's Efficiency Ratio to calculate adaptive true range
See how this compares to ATR here:
ER-Adaptive ATR
Mean Absolute Deviation
The mean absolute deviation (MAD) is a measure of variability that indicates the average distance between observations and their mean. MAD uses the original units of the data, which simplifies interpretation. Larger values signify that the data points spread out further from the average. Conversely, lower values correspond to data points bunching closer to it. The mean absolute deviation is also known as the mean deviation and average absolute deviation.
This definition of the mean absolute deviation sounds similar to the standard deviation (SD). While both measure variability, they have different calculations. In recent years, some proponents of MAD have suggested that it replace the SD as the primary measure because it is a simpler concept that better fits real life.
For Pine Coders, this is equivalent of using ta.dev()
Bands/Channels
See the information above for how bands/channels are calculated. After the one of the above deviations is calculated, the channels are calculated as output +/- deviation * multiplier
Signals
Green is uptrend, red is downtrend, yellow "L" signal is Long, fuchsia "S" signal is short.
Included:
Alerts
Loxx's Expanded Source Types
Bar coloring
Signals
6 bands/channels types
6 stepping types
Related indicators
3-Pole Super Smoother w/ EMA-Deviation-Corrected Stepping
STD-Stepped Fast Cosine Transform Moving Average
ATR-Stepped PDF MA
Diamonds✋ Experimental script where a diamond shape is created by making 4 lines around each bar which touches the edge of the bar.
𒀸 Example of how it works:
Create the left upper line:
A) Calculate middle of the bar
B) Calculate which one is highest -> close or open
'Draw' imaginary line from A to B (A starts 1 bar back)
Adjust height of A by adding 2/3 of the difference between A & B
𒓕 That's it!
𒀸 This technique can be developed further by anyone who's inspired.
• For now, I've just added an option where you can extend 2 lines of 1 specific bar
𒓕 Settings ➺ extend lines ➺ toggle on/off ➺ type ➺ which bar back
𒀸 X bars back sets the max bars in history
• Since this script uses line.new() , this results in maximum 500 lines to be drawn.
Each Diamand Bar contains 4 lines, resulting in maximum 125 Diamond Bars .
𒀸 Standard Candles ~ Diamond Bars
Cheers!
BTMM R.NOODLEThis script aims to encompass the style of Traders Reality, Steve M (BTTM), and Stacey Burke (youtube)
yesterday and last wk high and low
Custom watermark with examples (good for fullscreen multicharts)
can set it to show the year and week x of year
Colored candles for ays of week.
The theory behind these colors are that monday and tuesday set your initial balance for the week . having color seperation helps identify the balance
mon-tues = initial balance :green
wed +thu : blue
friday: red
Session boxes and daily initial balance
displays the asian and european trading session as one
displays the ny session first 3 hrs
how to combine sessions, weekly ib, daily ib, and sessions
will add pip lines 00/.50 increments at a later date
Tallrye AlertsThis is just a script to see the usage of volume from another source, i.e. US100 while using alerts in Renko chartview.
EMA + Bullish Engulfing Candle Pattern StrategyHello Guys! Nice to meet you all!
This is my first open source script!
### Long Condition
1. Bullish Engulfing Candle
2. No doge Candle
3. Present volume should be bigger than the previous volume (20%)
4. Trend filter (with 2 EMAs)
### Close Condition
1. When trend Changes
2. When Bearish Engulfing Candle appears
###
No stop loss and take profit.
Shadow Compact Volume BETAThis indicator will give you an overview of the trading volume of 1 candle, useful for new traders (This indicator will be updated more in the future). The current calculation method does not give any any trading signals!If you find it interesting or want to support the development of this indicator ,You can support me a cup of tea via the following link:
paypal.me/paulslim
Enjoy new good days!
Market Sessions Day & Candles JRA V2.0Market Sessions Day & Candles JRA V2.0
This indicator will allow you to:
- Create boxes for the Market Hours for:
'♯1 SESSION TOKYO'
'♯2 SESSION LONDON'
'♯3 SESSION NEW YORK'
You will be able to change the Hours depending your TimeFrame
You will be able to extend the boxes for the Market Hours and Have Fibonacci Levels on it.
- With every one of it you can change the style of Box for the Market Hours
- You can show Labels for the Market hours as well other options like Price or Pips
- Show the Candles for the TimeFrames depending your settings
- You can change the Candles settings to be Candle or Bar
- Candle Resolution on Timeframe
-Maximum candles to Display
-Show or Unshown Timeframes Candles
-Change colors on candles
Every option has a Tip to understand the function to it
Adaptive Deviation [Loxx]Adaptive Deviation is an educational/conceptual indicator that is a new spin on the regular old standard deviation. By definition, the Standard Deviation (STD, also represented by the Greek letter sigma σ or the Latin letter s) is a measure that is used to quantify the amount of variation or dispersion of a set of data values. In technical analysis we usually use it to measure the level of current volatility.
Standard Deviation is based on Simple Moving Average calculation for mean value. This version of standard deviation uses the properties of EMA to calculate what can be called a new type of deviation, and since it is based on EMA, we can call it EMA deviation. And added to that, Perry Kaufman's efficiency ratio is used to make it adaptive (since all EMA type calculations are nearly perfect for adapting).
The difference when compared to standard is significant--not just because of EMA usage, but the efficiency ratio makes it a "bit more logical" in very volatile market conditions.
The green line is the Adaptive Deviation, the white line is regular Standard Deviation. This concept will be used in future indicators to further reduce noise and adapt to price volatility.
Included
Loxx's Expanded Source Types
Dollar Index (DXY) Candles [Loxx]Dollar Index (DXY) Candles is an educational/experimental indicator that attempts to recreate the Dollar Index DXY: TVC:DXY .This is useful so others traders can see how the DXY is calculated.
The U.S. Dollar Index (USDX, DXY, DX) is an index (or measure) of the value of the United States dollar relative to a basket of foreign currencies, often referred to as a basket of U.S. trade partners' currencies. The Index goes up when the U.S. dollar gains "strength" (value) when compared to other currencies.
The index is maintained and published by ICE (Intercontinental Exchange, Inc.), with the name "U.S. Dollar Index" a registered trademark.
It is a weighted geometric mean of the dollar's value relative to following select currencies:
Euro (EUR), 57.6% weight.
Japanese yen (JPY) 13.6% weight.
Pound sterling (GBP), 11.9% weight.
Canadian dollar (CAD), 9.1% weight.
Swedish krona (SEK), 4.2% weight.
Swiss franc (CHF) 3.6% weight.
USDX = 50.14348112 × EURUSD^-0.576 × USDJPY^0.136 × GBPUSD^-0.119 × USDCAD^0.091 × USDSEK^0.042 × USDCHF^0.036
These candles won't match the ticker DXY dollar for dollar, but it comes very close. Either way, the general trend and volatility of this synthetic recreation is the same as the DXY.
Read more here: en.wikipedia.org
My StrategyThis is for educational purpose. Strategy is a test strategy to take long and short position
FALGUN INDICATOR WITH SAR V1.0This script is a trend-following system that uses a long-term and Short-term Moving Average to spot the trend.
Default Settings and Calculation:
- The trend is detected using the Simple Moving Average on 200 periods and 30 Periods.
- The Market is considered an Uptrend when the price closes above the 30 and 200 Moving Averages.
- The Market is considered in a Downtrend when the price closes below the 30 and 200 Moving Averages.
This script is best suited for all timeframes.
The options allow for modification of the type of moving average to use.
Forex Midpoint Stratejisi For Nasdaq English Knowledge:
Midpoint Strategy;
The general calculation method is a strategy that helps determine direction by the intersection of a MA line and the value obtained by dividing the lowest and highest price in the specified length range.
Başlangıç Periyodu: The data length of the Midpoint Line.
Kaydırma Seviyesi: The number of steps forward or backward of the Midpoint Line.
Yüzde Seviyesi: the amount of vertical scrolling.
Uzunluk: The length of the MA line
represents.
This strategy is prepared for the Nasdaq 5-minute period. It needs to be optimized for use on other instruments.
There are take profit and stop loss levels within the codes. Friends who want to use it can remove the invisibility from the relevant sections. Also, I removed the midpoint and the MA line so that it does not crowd the image, you can add it if you want.
Thank you.
Turkish Knowledge:
Midpoint Stratejisi;
Genel hesaplama yöntemi, belirlenen uzunluk aralığındaki en düşük ve en yüksek fiyatın ikiye bölümü ile elde edilen değer ve bir ortalama çizgisinin kesişimleriyle yön belirlemeye yardımcı bir stratejidir.
Başlangıç Period: Midpoint Çizgisinin veri uzunluğunu.
Kaydırma Seviyesi: Midpoint Çizgisinin ileri veya geri adım sayısını.
Yüzde Seviyesi: dikey kaydırma miktarını.
Uzunluk: Ortalama çizgisinin uzunluğunu
temsil etmektedir.
Bu strateji Nasdaq 5 dakikalık periot için hazırlanmıştır. Diğer enstrümanlarda kullanılması için optimize edilmesi gerekir.
Kodların içinde Kar alma , zarar durdurma seviyeleri mevcuttur. Kullanmak isteyen arkadaşlar ilgili bölümlerden görünmezliği kaldırabilirler. ayrıca midpoint ve ortalama çizgisinide görüntü kalabalığı yapmaması için ben kaldırdım isterseniz siz ekleyebilirsiniz.
Teşekkürler.
ABGALGOABGALGO IS AN INDICATOR MADE BY ABG
the indicator has some cool features:
-Candle sticks
-Buy/Sell signals
and more!!
Price based ATR%This script shows upto two lines that represent a deviation from the price based on a multiple of the ATR%
close + ( (close / 100) * ( atr * upperMultiplier) )
and
close - ( (close / 100) * ( atr * lowerMultiplier) )
Multi TF Trend Indicator
...Mark Douglas in his book Trading in the Zone wrote
The longer the time frame, the more significant the trend, so a trending market on a daily bar chart is more significant than a trending market on a 30-minute bar chart. Therefore, the trend on the daily bar chart would take precedence over the trend on the 30-minute bar chart and would be considered the major trend. To determine the direction of the major trend, look at what is happening on a daily bar chart. If the trend is up on the daily, you are only going to look for a sell-off or retracement down to what your edge defines as support on the 30-minute chart. That's where you will become a buyer. On the other hand, if the trend is down on the daily, you are only going to look for a rally up to what your edge defines as a resistance level to be a seller on the 30-minute chart. Your objective is to determine, in a downtrending market, how far it can rally on an intraday basis and still not violate the symmetry of the longer trend. In an up-trending market, your objective is to determine how far it can sell off on an intraday basis without violating the symmetry of the longer trend. There's usually very little risk associated with these intraday support and resistance points, because you don't have to let the market go very far beyond them to tell you the trade isn't working.
The purpose of this indicator to show both the major and minor trend on the same chart with no need to switch between timeframes
Script includes
timeframe to determine the major trend
price curve, close price is default, but you can pick MA you want
type of coloring, either curve color or the background color
Implementation details
major trend is determined by the slope of the price curve
Further improvements
a variation of techniques for determining the major trend (crossing MA, pivot points etc.)
major trend change alerts
Thanks @loxx for pullData helper function
Simple LevelsSimple Level provides a (you guessed it) simple user to user level sharing experience, with less boxes, less formatting, and less hassle.
Simply insert your levels into the input box, separated by commas. That's it.
Example: 1,2,3,4,5
The Simple Levels indicator will automatically color your lines based on their position to the current close price.
If the level is crossed, the level line will change color.
This indicator is intended for those who just want to skip filling out boxes or typing in a tricky format, and cut to the chase.
There are additional, nice-to-have settings as well for the "more" technically inclined; however, nothing too complicated.
Enjoy!