Portfolio Laboratory [Kioseff Trading]Hello!
This script looks to experiment with historical portfolio performance. However, a hypothetical cash balance is not used; weighted percentage increases and decreases are used.
You can select up to 10 assets to include in the portfolio. Long and short positions are possible.
Show in the image are the portfolio's weight, the total return of the portfolio and the total return of the asset on the chart over the selected timeframe.
Shown in the image above are the constituents of the portfolio, which can include any asset, the weighted percentage gain/loss of the constituents in addition to 10 major indices and their respective total percentage gain/loss over the timeframe.
Shown in the image above are the dividend yield % of the portfolio and relevant portfolio metrics - ex-post calculations are applied and are predicated on simple returns.
Shown in the image above is a portfolio of all short positions; portfolio calculations adjusted to the modifications.
Also shown is a change in the index the portfolio is calculated against. I have been asked a few times to include NIFTY 50 in my scripts - I made sure this was achieved, lol!
Show in the image is a performance line of performance of percentage increases/decreases for the index calculated against, the asset on the chart, and the portfolio.
All lines start simultaneously on the selected start date at the close price of the session for the asset on your chart.
However, the right-hand scale, whether displaying price or percent, cannot be used to assess the performance of each line - they are useful for visualization only and can extend below zero on a low-priced asset. Calculations will not execute correctly when selecting a start date prior to any asset in the portfolio's first trading session; calculations do not begin on the first bar of the asset on your chart.
I decided to code the script this way so statistics remain fixed when moving from asset to asset!
To compensate for this limitation, I included a label plot and background color change at the first session in which all assets in the portfolio had at least one bar of price data. You can adjust the calculation start date to the date portrayed on the label to test al possible price data!
The statistics table, and the performance lines, can be hidden in the user input section.
I plan on putting a bit more work into this script. I have some ideas on what to include; however, any input is greatly appreciated! If there's something you would like me to include please let me know.
@scheplick mentioned me in a script he recently coded:
My inspiration came from his script! I thank him for that!
Search in scripts for "nifty"
Long WickIt will work on Bank Nifty future only with 2 min time frame. GO Long above candle if the lower wick is more than 50 points and go short below the candle if upper wick is more than 50 points. It will work better with price action.(demand and supply zone)
BLSHBuy Low Sell High Strategy for Top Market Cap Stocks from Nifty 50. Buy only after price recovery of 5% from it's 25 Days Lowest price for a small target of 5%. It confirms the trend reversal
Short & Long Relative StrengthRelative Strength (RS) is a method of identifying stocks which are relatively stronger or weaker as compared the market as a whole or to a relevant benchmark.
To calculate the relative strength of a particular stock, divide the percentage change over some time period by the percentage change of a particular index over the same time period.
The value of RS Indicator oscillates around zero. If value of RS is above ZERO then security is outperforming the benchmark and if value of RS is below ZERO then security is outperforming the benchmark.
Here i have used two RS indicator lines in one indicator - Short Term RS (default value is 65) and Long Term RS (default value is 123).
I have set default benchmark index as Nifty 50 (NSE:NIFTY)
Candle ClassifierThis indicator uses allows its users to locate classifications of candles based on user defined input.
Using a % of candle range the user can specify,
High Wick %
Candle Body %
Low Wick %
The user can also search for candles within a (user defined) variance range.
A nifty feature of this indicator is the display of your criteria, so that you can be reminded while you're looking through your chart!
R-Smart - Relative Strength On observing the market for years I learned that Relative Strength will help us in staying invested in strong bullish stocks (relative to primary indices of your country, in my case it's Nifty 50 for India). Once you identify a strong stock, it's important to know if the stock is trending and is in momentum. To identify, trends and momentum, I used ADX and MACD indicators respectively as part of the R-Smart.
In R-Smart, I used Relative Strength primarily to plot the chart, if the Histogram is positive (greater than 0) then the security is bullish. But then how do we know that it's in trend and having momentum. Well the below color code will help you identify them
1. Histogram in Green : Strong Bullish
2. Histogram in Blue : Weak Bullish
3. Histogram in Orange: Bearish
Apart from the above indicator, I would like to use Super Trend to know the immediate support/resistances on the chart.
# StayInvested
# StayProfitable
# ManageYourRisk
Nareshraju CPRHi friends this is Cpr indicator which means central pivot range. it contains supports and resistances to take perfect entry.
FII and DII Data
Greetings to All of you.
The script is plotting FII & DII activity of buying or selling on Daily TimeFrame of Nifty Spot.
Will display only on Nifty 50 Spot on Daily TimeFrame . Codes are hardcoded because novice to PineScripting.
Data is collected from NSE website on daily basis, it's an manual process.
Observation:
Start date of observation is 16th Nov., 2021. FII bought worth 14,240 & kept buying for next 2 days & bought stocks worth 17,760 crores. But market kept falling as we can see in the chart.
Now FII's started selling & in next 5 days they sold stocks worth 18,698 crores. What makes sense from this is might have cut their losses early. FII's kept selling & Nifty made an low of 16410.
FII had sold stocks worth -21,954 crores.
FII are negative & the top green box which you see is FII & DII activity from 19th Oct 2021 when Nifty Spot made an High of 18604.45.
As of 14th Jan.,2022 they are still Negative & DII are extremely positive.
NOTE: DII have not sold any thing yet. They are PLUS +74,428 Crore . Now if they start selling we need to take care of our portfolio.
Hope the information might help in someway.
Take Care & Stay Safe why because Health is Wealth.
PS: If you have any better way to improve the hard coded codes please enlighten. Thank you in advance
CPR_Previous Day Ranges_Initial BalanceHello Traders,
This script best works on Indian Index (Tested on BANKNIFTY & NIFTY)
This indicator can be used only for day trading (intraday: ex: 5min, 15min Timeframes) on indices.
This script helps to plot
1. Central Pivot Range(CPR)
2. Previous Day Ranges (PDH & PDL)
3. Initial Balance(IB)
brief description of indicators:
1. CPR: Central Pivot Range --> This indicator helps to identify key price points to set up trades. CPR is beneficial for intraday trading.
2.Previous Day Ranges: These ranges will help to understand the current day market.
PDH: Previous Day High value on current day
PDL: Previous Day Low value on current day
3.Initial Balance(IB):This indicator will help in day trading. IB will plot current day first 1hr high, low & mid values.
Disclaimer: This indicator can be used as refrence only. This has been tested on Banknifty and Nifty indices on day trading 5 minutes and 15 minutes timeframe. Understand yourself to knowledge of different trading methods.
StableF-MainIt is combination of Built in Super trend and Adx with take profit
uptrend is considered when +dmi is above -dmi and +dmi is above 25 and adx is above 25 and supertrend gives Buy
downtrend is considered when -dmi is above +dmi and -dmi is above 25 and adx is above 25 and supertrend give sell
use fibo for target by taking as previous swing high and swing low
-supertrend crossover is referred as buy plotshape
-supertrend cross under is referred as Sell plotshape
-keep stoploss at dot line of supertrend
-adx-dmi crossover (+dmi crossed above -dmi) is shown by Triangle Up symbol
-adx-dmi crossunder( -dmi crosses below +dmi) is shown by Triangle down symbol
--Cross symbol with blue line with linewidth 2 is referred as Take profit
--combine this with adx -dmi setting with 7 and 14
----disclaimer-----
used free built in supertrend and adx so u can use same setting in other broker or in trading view
not responsible for any loss or gain
-only for educational purpose
StableF-AdxThe script is ADX-DMI modified verison
-Adx is labeled as Weak trend Below 25 and strong Trend above 25
-Hline is drawn at 25 for better clarification of crossover above 25
-Wait for crossover in +dmi and -dmi and to cross above 25 for any trend clarifcation
-crossover i.e upside cross of +dmi over -dmi is shown buy UP shape
-crossunder i.e downside cross of +dmi over -dmi is Shown buy DN shape
--disclaimer --This is just modified version of Bulit in ADX_DMI indicatior \ NOT advised for buy / Sell purpose
Day ClueDay Clue Indicator
live Market Information
Day Clue Indicator plots days information like " Initial Balance and Range ", " Day Range ", " Current Day Volume (for NIFTY and BANKNIFTY it takes the future volume) ", " ATR ", if the scrip is NIFTY or BANKNIFTY then it shows the difference between SPOT and Future price so that trader will come to know future is trading at premium or discount,it shows current day name at bottom right corner, and it plots the Ema-20 and Ema-200. These information will update during live market.
Information for Next Trading Session
Day Clue Indicator plots " Previous Day High" , " Previous Day Low ", " Central Pivot Range-CPR with S1 and R1 ","It indicate tomorrow is Trading Day or Trading Holiday(other than Weekend Holidays)" these are information used for next day that will be plot today itself once market closed
Limitations of Day Clue Indicator
Day Clue Indicator only work in Indian Market(NSE and BSE)
Day Clue Indicator only work in " 1-mins, 5-mins, 15-mins " Timeframes, if you switch to other timeframe like 30-mins,1-Hour, Daily then information will hide
Thank You
Dip Volume V1the very simple and very effective script, the script fetching the data from future contract data so that you can easily understand what is going inside the future data volume . and this is very important for Nifty and Bank Nifty traders
Pluto Star - Bollinger Band Trap//DESCRIPTION
//Pluto star appears on a chart when price goes in the in the extreme price range territory, i.e. beyond 2 standard deviation from the mean (or mid Bollinger Band).
//What makes a Pluto Star appear on a chart:
//1. Check if the candle 's' high and low, both are completely outside of the Bollinger Bands (close, 20, 2) - Lets call it Pluto Star Candle
//2. Pluto Star Candle must not be a result of sudden price movement. Hence the previous candle must give a BB Blast.
// In other words, the candle must have it's either open or close outside of Bollinger Bands, to confirm a BB Blast before the Pluto Star
//3. Candle, following the Pluto Star must not break the high (in case of upper BB i.e. short call) or low (in case of lower BB, i.e. long call), to confirm the reversal to the mean
// This implies that Pluto Star appears on chart, above/below the next candle of actual Pluto Star Candle
//----- The above 3 conditions make a Pluto Star appear on a chart. But one must wait for a trade signal. Read the following conditions
//4. There is a signal line, which is nothing but ema(close,5)
//5. The red dotted line is the signal range (and also acts as Stop Loss). The price must close above/below the signal line within the signal range
//6. For a red Pluto Star (short call), the price must close below the signal line, within next 6 candles (signal range). Else there is no trigger for a trade
//7. For a green Pluto Star (long call), the price must close above the signal line, within next 6 candles (signal range). Else there is no trigger for a trade
//8. If any of the candle crosses the Stop Loss line within signal range, there is no trigger for a trade
//9. In a normal scenario, the price must return to the mean, i.e. mid Bollinger Band. In best case scenario, it must go to the opposite side Bollinger Band.
//Recommendation: Test it with Nifty and Bank Nifty charts on 30 mins and 1 hour timeframes
BANK NIFTY Constituents Technical Rating [tanayroy]Banknifty comprises 12 companies listed on the National Stock Exchange of India (NSE). Movement of Banknifty depends on these stocks. The script depicts Technical rating and price change stats of Banknifty constituents.
I have calculated the weight factor using annual floating stock stats available in Tradingview. So, it may differ considerably from the actual weight. It is just for reference.
I have found this useful in my trading.
Please like, share, and comment.
The M Score - Ultimate v5.0The M Score - Ultimate v5.0
*Introducing M score version 5.0*
Additions to the indicator:
1. 200 EMA Band (High-Low) added
2. Bottom left table - Shows All Time High/Lows (52 weeks) and % away we are from both. The values will not change in this table even if you change the timeframe.
3. Bottom center table - Performance matrix and a quick glance comparison with Nifty with different days of return. This will show if there outperformance or underperformance in the scripts and in which duration.
4. Top Right table - This indicator plots a table off to the right of the chart to help with determining timeframe continuity. A great edge is only taking trades where full timeframe continuity is in place (i.e. if you are going long, make sure other timeframes are also green).
Green candles have green colored boxes, red candles have red colored boxes.
Inside bars are represented by a circle - ⬤
Outside bars are represented by a tall rectangle - ▮
2-up bars are indicated by an up arrow - ▲
2-down bars are indicated by a down arrow - ▼
User defined options:
Pick any timeframe for the 4 boxes
Hope you will will like the efforts.
Jigga - Relative Strength - SectorsHi All !!
I came across relative strength concept from below indicator.
Indicator Name: (Relative-Strength by modhelius)
Note: Sorry !! Could not add indicator url here.
Formula:
RelativeStrength = (sectorValue / sectorValue ) / (indexValue / indexValue ) - 1 * 100
I used same concept and combine all sector's relative strength against Nifty50 index.
How to use:
You can change length based on your convenience and show/hide sectors.
Indicator will show strength line for that sector.
you can use this to identify momentum stocks.
Fibonaci Opening Range Candle
Fibonacci Opening Range it is 50% and 0.61% of 5 min or 30min or 1 hour opening candle
search buying opportunities below 0.61
and selling opportunities above 0.50
Also acts as good support and resistance in intraday
BEST RESULTS IN INDEXES
Thanks & Best Regards
Marella Ganesh
[CP]Pivot Boss Candlestick Scanner - No Repainting This indicator is based on the high probability candlestick patterns described in the ’Secrets of a Pivot Boss’ book.
The indicator does not suffer from repainting.
I have kept this indicator open source, so that you can take this indicator and design a complete trading system around it.
Although the patterns have some statistical edge in the markets, blindly using them as Buy/Sell Indicators will certainly result in a heavy loss.
I like some of these setups more than others, and I have listed them in the order of my likeness.
The first one I like the most, the last one, I like the least.
The patterns are universal and work well in both intraday, daily and even larger timeframes.
Signals in the example charts are manually marked by,
Hammer - profitable short signal
Rocket - profitable long signal
X - unprofitable long or short signal
GENERAL USER INPUTS:
These settings exist as the indicator uses ‘Labels’ to mark the patterns and Pine Script limits a maximum of 500 labels on a chart.
If you want to go back in the past and check how the indicator was doing, set the Start and End dates both and check the ’Use the date range above to mark the Candlestick Setups?’ option.
EXTREME REVERSAL SETUP:
This is by far my favorite setup in the lot. Classic Mean Reversion setup.
The logic, as explained in the book, goes like this,
1. The first bar of the pattern is about two times larger than the average size of the candles in the lookback period.
2. The body of the first bar of the pattern should encompass more than 50 percent of the bar’s total range, but usually not more than 85 percent.
3. The second bar of the pattern opposes the first.
The setup works extremely well in high beta stocks like Vedanta VEDL.
Feel free to play with the settings in order to better align this pattern with your favorite stock.
Check out the examples below,
No indicator is perfect, failed patterns are marked with an X.
OUTSIDE REVERSAL SETUP:
My second favorite setup, it is quite good at catching intraday trends.
Here’s the logic,
1. The engulfing bar of a bullish outside reversal setup has a low that is below the prior bar’s low and a close that is above the prior bar’s high. Reverse the conditions for bearish outside reversal.
2. The engulfing bar is usually 5 to 25 percent larger than the size of the average bar in the lookback period.
Settings for this pattern simply reflect these conditions. Feel free to modify them as you wish.
The pattern is pretty powerful and will sometimes help you catch literally all the highs and lows of the market, as shown in the examples of Vedanta VEDL and RELIANCE stocks below.
As usual, this pattern is not PERFECT either.
DOJI REVERSAL SETUP:
Doji candles signify market indecision and this pattern tries to profit off these market conditions.
Logic:
1. The open and close price of the doji should fall within 10 percent of each other, as measured by the total range of the candlestick.
2. For a bullish doji, the high of the doji candlestick should be below the ten-period simple moving average. Vice-versa for bearish.
3. For a bullish doji setup, one of the two bars following the doji must close above the high of the doji. Vice-versa for bearish.
Feel free to modify the settings and optimize according to the stock you are trading.
Don't optimize too much :)
This pattern works brilliantly well on larger intraday timeframes, like 15m/30m/60m.
This pattern also has a higher propensity to give false indications than the two described above.
Doji reversal typically helps to catch larger trend reversals. Check out the examples below from RELIANCE and NIFTY charts,
Note that the RELIANCE chart below is the same as shown for the Outside Reversal Setup above, notice the confluence of Outside
Reversal and Doji Reversal on the 31st August.
Confluence of patterns usually increases the probability of success.
RELIANCE 15m Chart - Pattern can catch nice trends on higher timeframes
NIFTY 15m Chart
WICK REVERSAL SETUP:
This pattern tries to capture candlesticks with large wick sizes, as they often indicate trend reversal when coupled with significant support and resistance levels.
Logic:
1. The body is used to determine the size of the reversal wick. A wick that is between 2.5 to 3.5 times larger than the size of the body is ideal.
2. For a bullish reversal wick to exist, the close of the bar should fall within the top 35 percent of the overall range of the candle.
3. For a bearish reversal wick to exist, the close of the bar should fall within the bottom 35 percent of the overall range of the candle.
This pattern must always be coupled with important support resistance levels, else there will be a lot of false signals.
The chart below is the same NIFTY chart as above with the Wick Reversal candles marked as well.
You can see that there are a lot of false signals, but the price also indicates ’pausing’ at important levels by printing a wick reversal setup.
You can use this information to your advantage when riding a trend.
FINAL WORDS:
Settings for various patterns simply reflect the logic described.
You will probably need to tweak and optimize the pattern settings for the stock that you are trading.
Higher Beta/Higher Volatility stocks are a great choice for these patterns.
Using these patterns at critical support and resistance levels will result in dramatically high accuracy.
Be creative and try to develop a proper system around this indicator, with rules for position sizing, stop loss etc.
You do not have to trade all the patterns. Even trading just one pattern with a proper system is good enough.
DO NOT USE THIS INDICATOR AS A BUY/SELL SYSTEM, YOU WILL LOSE MONEY.
Feel free to drop any feedback in the comments section below, or if you have any unique candlestick patterns that you would like me to code.
QuantAnna: Relative Strength Plus (RS+)NSE:TATAMOTORS
Relative strength indicator which shows ratio between two stocks/assets .. usually between stock & its indices
features of indicator is as following.
1. Values oscillates around zero, it is bullish when above zero & bearish when below zero.
1. Weighted smoothing which removes unwanted whipsaws but keeps trend curve intact.
3. In-Built list of Nifty sector indices to show stocks comparison with its sector
please do send your feedback and suggestions.
BANK NIFTY list of stocks with their multi timeframe EMA trend This script gives you an overview of banknifty and its underlying heavy weight stocks.
You can view the trend in single chart in 3 different time frames.
Color indication green for bullish and red for bearish trend
Symbol name shows green if the current day change is positive. Else red color
Scalping Screener - 15minSCALPING SCREENER - 15 mins (Indicator Tool)
TIME FRAME to use - 15 mins
DURATION OF TRADE - Using this indicator, Trade must be taken only during market hours and must be closed before market close (must not be carried forrward for next day).
SCALPING - This is a scalping strategy that is intended to make small profits in intraday trading
ENTRY CONCEPT -
- There must be 2 bulish candles and the 2nd candle's high should be greater than first candle's high.
- And If the latest candle high breaks high of the 2nd candle (prev candle), BUY signal is generated.
- Additional filters are added to reduce non-performaing trades.
- visa versa for SHORT signal
EXIT CONCEPT -
- 2nd candles low is the stop loss.
- Difference between 2nd candle high and 2nd candle low is target.
- The script will indicate when to BUY / SHORT and when to EXIT the trade.
INSTRUMENTS TO TRADE -
- High volatility instruments are best to be traded
- Nifty 50 stocks have been added to this indicator for the sake of screener. User can change these stocks with high volatility ones
- There is a limitation to add upto 40 scripts.
SCREENER FUNCTION -
- Right side of the chart has screener section which shows the list of stocks that qualify as per the BUY / SELL signal
NOTE -
The purpose of the scipt is for self learning / improvement and analysis.
Trading is a risky business and a trader must take any trade at their own RISK.
The author shall not be held responsible for Losses / Profits