Fed and ECB Calendar by KziHello traders,
Here is a script that i've done for testing the timestamp and the input.time fonction.
You can see verticals lines blue and yellow.
The blue are the ECB meeting date (7 dates)
The yellow are the FED meeting date. (10 Dates)
// In the parameter you can enter the next rolling month date for ECB and FED
// I don't figure out how to add label / Txt on the lines
// And be carreful i don't put the real hours of the meeting.
Pine utilities
positionsize calculatorHow to use:
Use the cursor to select the time, entry, stop loss, and target position. Enter the trading fee to calculate the reward/risk ratio and the actual reward/risk ratio (including the commission) according to the price you selected.
Known error:
Settings of this script can't be saved as default might due to the interactive price selection function. If anyone knows how to fix it, please let me know.
feature:
The visual Risk/Reward box, have three price labels on the right hand of the box.
Calculate the actual reward/risk ratio based on the trading fee.
The visual Risk/Reward box will extend automatically.
Syminfo [Epi]Hello! This little script tells you everything TradingView lets you access in a ticker's syminfo in Pine Script:
- description
- type: crypto, economic, forex, fund, futures, index, spread, stock
- tickerid, such as AMEX:BLOK
- prefix, such as AMEX
- Ticker, such as BLOK
- root: for derivatives such as futures contracts
- currency, such as USD
- base currency: returns 'BTC' for the ticker 'BTCUSD'
- mintick
- point value
- session: regular, extended
- timezone
Some surprises I found in my development:
- there are some more types than mentioned in the documentation,
- the tickerid takes on additional information if you adjust for dividends or show extended session,
- the prefix contains "_DL" additions depending on your data subscriptions, .e.g. "CME_MINI_DL:ES1!",
- with futures, TV will show session.regular both for the 'regular' and the 'electronic' session.
- Unfortunately, syminfo does not contain the 'sector', although TV has the information in the database (the sector is shown in the screener but not accessed in Pine Script).
I use this little utility in my development and hope it's useful for the community. I see such a great number of contributions from the community and would like to give back, even if it's not much.
Moon Launch Alerts Template [Indicator]I created this indicator/study script because i ran into the issue that the same Alerts would fire multiple times. For example it would trigger a Long signal when already being in a Long. I guess there would be no issue with a very basic strategy but with a larger script and many variables, it seemed to create complications.
This is resolved by a TradingLine oscillator and only when it switches to a new and different position from previous, will it trigger an Alert.
If you are in a Long and it signals Long again, then this is seen as a "Continuation Long" in the Alerts settings. You can use this condition to add to your existing position (Optional). Continuation signals are plotted as bright green/red dots.
You will notice there's an option to uncheck "Trade Shorts" and "Trade Exits" signals.
Lets say you choose not to trade Short and Exits, then your Long would only Exit once a Short signal is detected.
This could prove useful for Back-testing purposes.
This quick example script uses the EMA 10, EMA 200, emaPlus1Atr and emaMinus1Atr.
To use in your script, you will need to modify and add your own BUY/SELL/EXIT signals in the box where it says:
//// INPUT YOUR BUY/SELL/EXIT SIGNALS HERE: ////
//////////////////////////////////////////////////
Hope someone will find this useful, or even just as an additional visual confirmation for your own trading strategy and script.
Multi Asset + Correlation OverlayFrom time to time, you may want to overlay multiple assets on the same chart instead of using multi-chart views. This can be a much cleaner way of viewing and comparing multiple assets. There is some functionality built into TradingView that lets you do this to a certain extent, but I wanted additional options, correlation labeling and ways to adjust the overlay location. So, today I am releasing to the community my Multi-Asset + Correlation Overlay script / indicator.
What is does: This script allows you to overlay the price of any ticker onto your chart. It also labels the line with the ticker name, and calculates / labels the correlation coefficient of your newly overlayed asset.
How to use it: Add the indicator to your chart. Then, go into the indicator settings to set the ticker of the asset you want to pull in along with how you want to "offset" it. Your 2 tickers may not be priced near each-other, so the offset setting allows you to pull the ticker you added up/down to better visually align with your chart's price range/layout. For instance, if the asset you added is priced $400 higher than the underlying chart price, you may want to set the offset to -400.
If you would like to add multiple tickers and multiple overlays, you can do that by just adding the indicator to your chart more than once. The color is adjustable, and the ticker of the asset will print to the right of the line representing the asset price. The script also calculates the correlation coefficient between the ticker overlay and the underlying chart asset. The correlation coefficient prints to the right of the ticker.
Fusion: Big Arty CandlesAnyone who follows Arty knows about his "Big A** Candle" strategies.
I didn't like the BAC indicators that had code available so I wrote this one that has some decent flexibility and display options.
You can use this to enter a trade immediately after a BAC, probably in the opposite direction and ride the pullback that usually occurs or just use it to avoid trading until things settle down. I use it to avoid trading for a few bars on the 15 minute timeframe on bitcoin.
The settings are certainly not optimized so set them to whatever suits your needs as the defaults will probably be wrong for you.
The code is structured to easily drop into a bigger system so use it as a lone indicator or add the code to some bigger project you are creating. If you do integrate it into something else then send me a note as it would be nice to know it's being well used.
Finally, if you find value please do make a comment, give a thumbs up etc.
Enjoy and good luck!
Backtesting- IndicatorFor anyone interested, Here is an example of how to put backtesting results into an Indicator. This calculates the same values as you find in the Summary Screen of the built in Strategy backtester. This will use the same result size as the standard backtester i.e. 5 minute chart grabs roughly 1 month of data, 1 minute chart grabs 1 week of data, etc... I tried to keep this as self-contained as possible so I put most of the code for the results in the bottom of the Indicator. The results stop at the last completed trade signal i.e. a Buy has a Sell to it. This is the same indicator I posted earlier with the PCT Trailing StopLoss so you will see that code in here as well. As said in my previous posting, the indicator is just a simple EMA crossover to give it something to do and I would not recommend using this indicator on its own, but instead copy the code to your own indicator if you find it useful. I also left the code in so that you can switch back to a Strategy if you want to verify the results.
Additional Notes:
- The results are within an acceptable margin of error due to the fact that the Indicator is having to calculate based on when the Buy and Sell Signal occur as opposed to when actual trades occur like in the Strategy Backtester
- I was trying to find a way to set the number of Buy Signals to use i.e. show me the results from the past 100 trades but couldn't sort out the logic. I am open to suggestions. Also keep in mind I am not a coder by profession so if you have any ideas on that front, please explain it to me as though I am a 5 year old child and provide code examples if possible :)
- I included the Strategy results in the Screen Shots so that you can see where the results line up.
Additional Additional Note:
This is not financial advice. Use at your own risk.
Study forloop Star Diamond'Study forloop' pinescript Program to print star diamond
The Program Logic
I've taken the previous script and added a footer to it. instantly transformed into a diamond shape.
Study forloop Star Triangle'Study forloop' pinescript Program to print star Triangle
The Program Logic
For example, the following Pinescript programme will need two nested for loops. The outer forloop is for rows and the inner forloop is for columns or stars. to create a triangle shape.
Feature scalerFeature scaler | Pine Utilities series, ready to be used in "study-on-study" fashion |
Includes min-max, normalization, standardization and unit length scaling.
One and only source: en.wikipedia.org
Endpoint inputs allow to set an interval of interest for min-max scaler.
Can be (and should be) applied to other studies, or to the chart itself. In this example, I applied min-max scaling to weighted linear regression's slope values.
Unfortunately, "All data" is still "experimental" and works only on charts where less than 5000 bars are available. max_bars_back() didn't help.
Sup TV
High-pass filterHigh-pass filter | Pine Utilities series, ready to be used in "study-on-study" fashion |
Represents the difference between the filter and the original unfiltered data.
How to use:
1) Add a filter to your chart (in this particular case it was 4-pole Gaussian filter implemented by @everget, ty man);
2) Tap ... on your's filter status line and choose "Add study/strategy on ...", then choose High-pass filter. Alternatively, add high-pass filter directly to your chart, then High-pass filter's settings -> Basis -> choose the filter you've applied during the step 1;
3) Choose the source (op2 and hlcc4 are available as well);
4) See the difference (literally).
Peace TV
Pareto DistributionBasic Pareto distribution!
This is a simple exponential curve set on the 1 minute timeframe.
Three different gradients are used in the example image.
[TEMPLATE] Code Block Comments█ OVERVIEW
Here I present to the community at large a collection of code comment blocks that I think will be useful, especially for larger script projects bordering on 2,000 lines or above of code.
█ PLANNED FUTURE UPDATES
Work with the community to expand this template to be even more useful with the inclusion of useful global colour sets, variables, tooltips, groups, etc.
better script thumbnail.
full-screen table or label outlining the script's use-cases.
make lead signalAdd derivative of a signal for leading behaviour
formula: sig = (lambda/100)*source + (1-lambda/100)**momentum )
it has a multiplier and an offset for adjustment of result.
final formula: sig = multiplier*( (lambda/100)*src + (1-lambda/100)*mom_coef*mom ) + offset
PnL and Buy & Hold TrackerIn this script I use a simple, not necessarily profitable, strategy of a cross of MAs to teach how to calculate and plot the PnL of each trade made by the indicator. I also show how to calculate the cumulative PnL of all trades and the Buy and Hold of the same period.
These calculations which are natively available in any strategy script, require a bit of resourcefulness to work in an indicator script.
It can be very useful to optimize parameters for the best performance of an indicator-based strategy.
I use variables to store the price of the asset at each buy signal to calculate the PnL with the closing price of that particular trade and another variable to store the price value of the first trade, which calculates the Buy and Hold percentage with the current price of the asset.
I plot the values of the trades in labels and the accumulated values in a table.
I also show how to calculate and plot the unrealized PnL of open trades.
MACD-X Overlay, More Than MACD by DGTMoving Average Convergence Divergence – MACD
The most popular indicator used in technical analysis , the moving average convergence divergence ( MACD ), created by Gerald Appel. MACD is a trend-following momentum indicator , designed to reveal changes in the strength, direction, momentum, and duration of a trend in a financial instrument’s price
Historical evolution of MACD ,
- Gerald Appel created the MACD line,
- Thomas Aspray added the histogram feature to MACD
- Giorgos E. Siligardos created a leader of MACD
MACD employs two Moving Averages of varying lengths (which are lagging indicators) to identify trend direction and duration. Then, MACD takes the difference in values between those two Moving Averages (MACD Line) and an EMA of those Moving Averages (Signal Line) and plots that difference between the two lines as a histogram which oscillates above and below a center Zero Line. The histogram is used as a good indication of a security's momentum.
The MACD indicator is typically good for identifying three types of basic signals;
Signal Line Crossovers
A Signal Line Crossover is the most common signal produced by the MACD . On the occasions where the MACD Line crosses above or below the Signal Line, that can signify a potentially strong move. The standard interpretation of such an event is a recommendation to buy if the MACD line crosses up through the Signal Line (a "bullish" crossover), or to sell if it crosses down through the Signal Line (a "bearish" crossover). These events are taken as indications that the trend in the financial instrument is about to accelerate in the direction of the crossover.
Zero Line Crossovers
Zero Line Crossovers occur when the MACD Line crossed the Zero Line and either becomes positive (above 0) or negative (below 0). A change from positive to negative MACD is interpreted as "bearish", and from negative to positive as "bullish". Zero crossovers provide evidence of a change in the direction of a trend but less confirmation of its momentum than a signal line crossover
Divergence
Divergence is another signal created by the MACD . Simply, divergence occurs when the MACD and actual price are not in agreement. A "positive divergence" or "bullish divergence" occurs when the price makes a new low but the MACD does not confirm with a new low of its own. A "negative divergence" or "bearish divergence" occurs when the price makes a new high but the MACD does not confirm with a new high of its own. A divergence with respect to price may occur on the MACD line and/or the MACD Histogram
Moving Average Crossovers , another hidden signal that MACD Indicator identifies
Many traders will watch for a short-term moving average to cross above a longer-term moving average and use this to signal increasing upward momentum. This bullish crossover suggests that the price has recently been rising at a faster rate than it has in the past, so it is a common technical buy sign. Conversely, a short-term moving average crossing below a longer-term average is used to illustrate that the asset's price has been moving downward at a faster rate and that it may be a good time to sell.
Moving Average Crossovers in reality is Zero Line Crossovers, the value of the MACD indicator is equal to zero each time the two moving averages cross over each other. For easy interpretation by trades, Zero Line Crossovers are simply described as positive or negative MACD
False signals
Like any forecasting algorithm, the MACD can generate false signals. A false positive, for example, would be a bullish crossover followed by a sudden decline in a financial instrument. A false negative would be a situation where there is bearish crossover, yet the financial instrument accelerated suddenly upwards
What is “MACD-X” and Why it is “More Than MACD”
In its simples form, MACD-X implements variety of different calculation techniques applied to obtain MACD Line. Different calculation techniques lead to different values for MACD Line, as will further discuss below, and as a consequence the signal line and the histogram values will differentiate accordingly.
Main features of MACD-X ;
1- Plotting of the Oscillator presented on top of the price chart (main chart) and applicable on both log and linear scale. Maximum plotting length is limited to 250 bars
2- Introduces different proven techniques applied on MACD calculation, such as MACD-AS (Histogram), MACD-Leader and MACD-Source, besides the traditional MACD (MACD-TRADITIONAL)
• MACD-Traditional, by Gerald Appel
It is the MACD that we know, stated as traditional just to avoid confusion with other techniques used with this study
• MACD-Histogram, by Thomas Aspray
The MACD-Histogram measures the distance between MACD and its signal line (the 9-day EMA of MACD ). Aspray developed the MACD-Histogram to anticipate signal line crossovers in MACD . Because MACD uses moving averages and moving averages lag price, signal line crossovers can come late and affect the reward-to-risk ratio of a trade. Bullish or bearish divergences in the MACD-Histogram can alert chartists to an imminent signal line crossover in MACD
Aspray's contribution served as a way to anticipate (and therefore cut down on lag) possible MACD crossovers which are a fundamental part of the indicator.
• MACD-Leader, by Giorgos E. Siligardos, PhD
MACD Leader has the ability to lead MACD at critical situations. Almost all smoothing methods encounter in technical analysis are based on a relative-weighted sum of past prices, and the Leader is no exception. The concealed weights of MACD Leader are such that more relative weight is used in the more recent prices than the respective weights used by the components of MACD . In effect, the Leader expresses more changes in average price dynamics for the recent price movement than MACD , thus eventually leading MACD , especially when significant trend changes are about to take place.
• MACD-Source, a custom experimental interpretation of mine,
MACD Source, presents an application of MACD that evaluates Source/MA Ratio, relatively with less lag, as a basis for MACD Line, also can be expressed as source convergence/divergence to its moving average. Among the various techniques for removing the lag between price and moving average (MA) of the price, one in particular stands out: the addition to the moving average of a portion of the difference between the price and MA. MACD Source, is based on signal length mean of the difference between Source and average value of shot length and long length moving average of the source (Source/MA Ratio), where the source is actual value and hence no lag and relatively less lag with the average value of moving average of the source .
MACD Source provides relatively early crossovers comparing to MACD and better momentum direction indications, assuming the lengths are set to same values
3- Alerts presented for MACD and Signal Line Crosses both for Early Warning and Confirmed Crossovers
For more, You are kindly invited to have a look to other MACD or similar studies presented on separate pane
MACD-X, More Than MACD by DGT , P-MACD by DGT and Price Distance to its MA by DGT
Disclaimer : Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely
The script is for informational and educational purposes only. Use of the script does not constitutes professional and/or financial advice. You alone the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script
Countdown Interval TimerCountdown Interval Timer calculates the time remaining (in seconds) until bar close and 5 custom intervals (minutes).
Given the execution model of Pine Script is ticked-based, alerts based on this indicator will only trigger if there is a tick at the right time.
Specifically, a tick would be required between the event target (close of bar time, end of minute/s interval), less the Trigger Threshold (default = 5 seconds before).
Alert instructions:
1. Create new alert
2. Select Condition options as:
a) This indicator & desired plot (Ti_Cl, Ti_01, Ti_02, Ti_03, Ti_04 or Ti_05)
b) 'Crossing Down'
c) This indicator & 'Trigger'
3. Set Options to 'Once Per Minute'
Note that if you change the input values of this indicator you will need to recreate the alert as it will not pick up the changes.
For example if you change 'Time interval 01' from 1 to 3, the alert will remain at 1
MM Chop Filter Range BoxesMatch with the MM Chop Filter
This draw Non repainting range boxes when the oscillator see a range.
-Breakout Buy/Sell Signals and Exit signals when prices enters a range just in case you did get into a trade. .
-Alarms to match the signals
How to use
Match with the oscillator and always trade the trend with your strategy confirmation and the breakout this indicator provides
Ultimate Time Filter V1The only time filter that you will ever need.
Easily filter for:
--> Start/End Dates
--> Weekdays
--> 1 or 2 Daily Trade Sessions.
This is open source on purpose so you can enjoy ease of use on your own codes. Simply copy the code and use the variable "inTime" to filter bars that fit your time constraints.
I spent a lot more time on this than I'd like to admit but so be it. Any comments for improvements, or questions on how to use the script is appreciated. Or if you wanna chat about trading / pine script hit me up on Discord.
Cheers
Nifty_Price_Movement_BuildUPDashboard to see Price Momentum Build-Up at Nifty.
It cumulates all prices and their respective weightage.
During initial of a candle, we are not aware of volume is High or Not, we only get it in later buildup. But Price buildup will display it at the same instant that what is going with the price of all stocks.
The logic used here is that
1) If a stock close > open at a particular instant it will add that stock multiplied with its weightage in Nifty to the list of stocks that are positive.
2) If a stock close < open at a particular instant it will add that stock multiplied with its weightage in Nifty to the list of stocks that are negative.
3) Above two will give you data that how many of them are positive and are negative at a particular instant and how they are going to affect Nifty.
In one of the many possible ways, it is superior than that of Volume buildup is that, to determine volume is higher than previous volume, we have to wait for first few seconds/minutes/hours (depending on timeframe you are in) to see volume buildup. The Volume buildup function based indicator is kind of lagging, though volume itself being instant.
Close Combination Lock Style - Visual AppealThis creates a combination style closing price change on each tick.
It has two theme options, one as silver dials for Dark Theme and the other as black dials for White Theme.
We get fixated to watching closing prices on charts and it gets visually daunting. This creates a combination style price change which updates on each tick, which is quite pleasing to the eye.
When new price is above current center line, it shift the above prices showing ▲ arrow, and if new price is lower, it will shift the bottom prices showing ▼ arrow. If there is no change in price between the ticks, it will show =.
Candles HTF on Heikin Ashi ChartThis script enables calling and/or plotting of traditional Candles sources while loaded on Heikin Ashi charts.
Thanks to @PineCoders for rounding method: www.pinecoders.com
Thanks to @BeeHolder for method to regex normalize syminfo.tickerid.
NOTICE: While this script is meant to be utilized on Heikin Ashi charts it does NOT enable ability to backtest!
NOTICE: For more info on why non standard charts cannot be reliably backtested please see:
NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!