Expert studio strategy 1 - GBPUSDThis is part of a series of strategies developed automatically by a online software.
I cannot share the site url, which is not related to me in any way, because it is against the TV reules.
This strategy was optimized for GBPUSD, timeframe 1D, fixed lots 0.1, initial balance 1000€.
LOGIC:
- LONG ENTRY when previous candle is bear
- LONG EXIT: RVI > signal line
- SHORT ENTRY when previous candle is bull
- SHORT EXIT: RVI < signal line
NOTE: I considered the open of actual candle instead of close otherwise there will be a back shift of 1 candle in pine script
Take profit = no
Stop loss = no
I have also a study with alarms.
Please use comment section for any feedback.
Forex
Syminfo.TypeHello traders
Earlier this week I discovered a new built-in variable called syminfo.type
What is it for?
This variable returns the type of the current symbol. Possible values are cfd, stock, futures, indices, forex, crypto, fund.
Cool bro but... should we care?
Well... we all should. Imagine you have a generic script and you want a different configuration whether you're trading FOREX or Crypto .
I designed a dummy example in that script that will preset the inputs according to the asset type from the chart.
Here I want 12/26/9 for forex and 20/50/50 for crypto - 30/60/90 otherwise
Quick caveat
It seems that for any crypto asset, syminfo.type returns "bitcoin". TradingView will fix it at some point but wanted to give you the heads-up regardless
Enjoy and all the BEST ^^
--
Dave
BEST Currency Strength Indicator DivergenceHello traders
Hope you had a great Thanksgiving
Now it's my turn to give and all I ask in return is you to be thankful (did I get the "Thanksgiving" thing right?)
The Currency Strength Indicator plots an average of the selected FX pairs in the indicator.
Someone asked me if I could develop an alternative of that script adding a divergence component.
The script evaluates the divergences between the average of the selected RSI(FOREX pairs) and the RSI(FOREX pair) displayed on the chart.
This version includes new features such as:
- the RSI length can now be selected
- we can select the 6 pairs used for the divergence calculations
All the BEST my aspiring traders and quants
See you tomorrow for another script
Dave
Mirror MACD by Trader JayThis is my take on the metatrader indicator, the mirror macd. Works pretty good on Forex, haven't tested on anything else
Enter long after the Blue Line Cross Up the Red Line and EXIT after the Green line Cross Up the Red Line (above the Blue Line).
For the opposite position : ENTER SELL after the Red Line Cross Down.
TradingView Alerts to MT4 MT5 + dynamic variables NON-REPAINTINGAccidentally, I’m sharing open-source profitable Forex strategy. Accidentally, because this was aimed to be purely educational material. A few days ago TradingView released a very powerful feature of dynamic values from PineScript now being allowed to be passed in Alerts. And thanks to TradingConnector, they could be instantly executed in MT4 or MT5 platform of any broker in the world. So yeah - TradingConnector works with indices and commodities, too.
The logic of this EURUSD 6h strategy is very simple - it is based on Stochastic crossovers with stop-loss set under most recent pivot point. Setting stop-loss with surgical precision is possible exactly thanks to allowance of dynamic values in alerts. TradingConnector has been also upgraded to take advantage of these dynamic values and it now enables executing trades with pre-calculated stop-loss, take-profit, as well as stop and limit orders.
Another fresh feature of TradingConnector, is closing positions only partly - provided that the broker allows it, of course. A position needs to have trade_id specified at entry, referred to in further alerts with partial closing. Detailed spec of alerts syntax and functionalities can be found at TradingConnector website. How to include dynamic variables in alert messages can be seen at the very end of the script in alertcondition() calls.
The strategy also takes commission into consideration.
Slippage is intentionally left at 0. Due to shorter than 1 second delivery time of TradingConnector, slippage is practically non-existing. This can be achieved especially if you’re using VPS server, hosted in the same datacenter as your brokers’ servers. I am using such setup, it is doable. Small slippage and spread is already included in commission value.
This strategy is NON-REPAINTING and uses NO TRAILING-STOP or any other feature known to be faulty in TradingView backtester. Does it make this strategy bulletproof and 100% success-guaranteed? Hell no! Remember the no.1 rule of backtesting - no matter how profitable and good looking a script is, it only tells about the past. There is zero guarantee the same strategy will get similar results in the future.
To turn this script into study so that alerts can be produced, do 2 things:
1. comment “strategy” line at the beginning and uncomment “study” line
2. comment lines 54-59 and uncomment lines 62-65.
Then add script to the chart and configure alerts.
This script was build for educational purposes only.
Certainly this is not financial advice. Anybody using this script or any of its parts in any way, must be aware of high risks connected with trading.
Thanks @LucF and @a.tesla2018 for helping me with code fixes :)
Session P4L MTFCorrected indicator for better support of smaller time frames. version 3.0 with better interface. thank you
Session P4L SNIPERSsession separator only for the operation of the academy. by its time margin. added the asian range for a power of three
DAY separator P4L FOREX
day separator for better orientation of neutralizations in the graph. with the possibility of choosing day and color to show in the graph
Extreme ScalpingThis is a test of an easy scalping method: buy if actual close is below forecast close and sell if actual close is above forecast close. Take profit and stop loss shall be very small (few pips) as in most of scalping strategies.
No filter is used for only long or only short positions, but you can select buy only or sell only based on other indicators or whatever you feel is the direction of trading.
NOTE: you can add this strategy to your chart but you should modify the backtest day otherwise you will get an error due to calculation limits of pine script. For example, on one minute chart, you should set the backtest day from today only. For past days, set both start day and and day.
I have also a study with alarms.
Please use comment section for any feedback.
InfoPanel Divergence IndicatorThis panel spots divergences of some well knonw indicators. It may be usefull because you have all indicators in one panel only.
Also, you can check on chart which indicator gives better results of each pair on stock or index or crypto.
TO DO: to add custom indicators.
thanks to: RicardoSantos for his script of panel coding
Tradingview scripts
Other members of TV community (I cannot remember the source and inspiration of all snipets)
Please use comment section for any feedback.
Strategy based on the principles of Price ActionIt is considered the percentage of candles with low and high closure for a certain period. Then, a moving average is built from these values. When the moving average of the ratio of tall candles to low candles is greater than the ratio of low candles to high, then long (that is, when the green line crosses the red). And vice versa - a condition for short. It also works on crypto with other settings. Idea for improvement: you can make partial exit by taking, at certain profit levels, the chart will be more stable. Result with a commission of 0.004% You can create an optimizer, and use this strategy on any liquid asset. (Sorry for google translator)
Tenkan Kijun Cross AlertTenkan Kijun cross alert, best used alongside a Volume indicator to help aid with finding those trend continuation patterns.
I prefer to use the Chaikin Money Flow, when it indicates and holds above the 0 line then you will bias Longs, and when below then you will Bias shorts
If you like this then please donate
BTC: 1LRbUgrkvFLQ5Mt7C62EJRD9aMvhDNT22K
ETH: 0xa509b89bccb788234278eFE63470c10946E26F3c
LTC: LV7MUr6arvCffS5N6pbTWgav5S3Yi1Eejp
AntiRekt Trend OscillatorWhen the indicator value is above the horizon line the trend is up, below the trend is down. Watch out for ranging markets.
FOREX EMAsPretty simple here - this is the base EMAs I suggest most traders use in the FOREX market for swings and scalp trading. Works well on 5m, 15m, 1H, 4H, and daily trading if you design an edge to interpret the relationship these averages of price are telling you.
The 9EMA is not as valuable on the 1HR timeframe.
Foreign Currency Psychological ResistanceThought it would be interesting to look into psychological barriers (round numbers) denominated in foreign currencies and see where those barriers show up on a USD chart.
I did a couple of quick and superficial Internet searches to get an idea of which USD pairs are being used the most to trade Bitcoin. My conclusion is that the most relevant currencies are the Chinese Renminbi and the Brazilian Real.
Based on that, I wrote this little indicator that uses the exchange rate from the USD pairs (USDCNY, USDBLR) and the round number targets to come up with the corresponding USD price levels.
FX Meter ScriptA while ago, we wrote* about the usefulness of using a currency strength meter and how you can build one from scratch.
See here: www.globalprime.com.au
Now we've taken this little project to the next level by visually spotting, via color signals in a dashboard and alerts, when a potential new trend might be developing in a currency pair.
*It's critical that you first read that article before you jump into reading this one or else you could get easily lost.
The script gives a trigger every time two currencies show diverging flows via opposing moving average slopes.
The signals originate from a first chart where currency indexes can be found, calculated through a formula, in various thin lines. Then a moving average to each currency index is applied so that it can smooth out the lines (what I call Micro moving averages – thicker lines -) and is usually a 4-5 period MA, with the key input to pay attention being the slope. One can perform their own tests on what works best for their particular trading style. The smaller the period in the moving average, the more responsive to changes in biases but the downside is that you will get a greater number of false moves. In the windows below the 1st chart, the stochRSI is calculated for each currency index (these values originate from the currency index and not from the applied MA). By default, a 25-period is applied to both RSI and Stoch length.
A 2nd chart that looks at the same logic is also accounted for to build this script, but instead of checking the micro trend, it applies a 25MA to the currency index, so it looks at what I call the slope of the macro trend. In this case, by default, a 125-period is applied to both RSI and Stoch length.
We had in mind to transition from just eye-balling and monitoring these charts manually to build a script via Tradingview that makes calculations real time (whenever the change in the moving average slope first occurs, and not when the bar/line closes), so that one can decide whether or not its a signal worth trading as part of a new trend emerging. Note, this is not so much a signal-triggering indicator but rather a tool to constantly be on the lookout monitoring what currencies might start to develop trends.
The actual script consists of a dashboard with different colored rectangles being triggered depending on the quality of the signal.
We will be happy to discuss it further with anyone who is interested in exploiting all the benefits that it can offer.
The way you add the script into your Tradingview chart is by first copy everything in the txt file. Then go to Pine editor (bottom middle-left) in your tradingview chart, delete everything there, then Paste the script. Then click Add to Chart (top right of the pine editor).
Note, you should add via the Anchored Text function the following list of pairs below, in this alphabetic order, on the right-hand side of the chart, as demonstrated above:
AUDCAD
AUDJPY
AUDNZD
AUDUSD
CADJPY
EURAUD
EURJPY
EURCAD
EURNZD
EURGBP
EURUSD
GBPAUD
GBPCAD
GBPJPY
GBPNZD
GBPUSD
NZDCAD
NZDJPY
NZDUSD
USDCAD
USDJPY
There are only 2 rules for the script to trigger a signal (see below). However, as I will elaborate further down, there are up to 6 different colors we can grade a signal
RULE 1 -> 2 moving averages, which are a calculation applied to a currency index as shown in the micro trend above, exhibit slopes in the opposite direction.
RULE 2 -> The Stoch RSI cannot be in overbought conditions if the slope of the moving average points higher or in oversold if the slope points lower.
Note 1: Even if the chart is a 60m timeframe by default (can be changed to any timeframe(, one gets the signal the moment the change of slope is identified, which means the indicator monitors changes in price tick by tick, and not on a candle close, otherwise one would get the trigger too late.
As an example of the highest-graded signal triggering (in green), a few hours ago we were given the visual cue that GBPCAD was experiencing a change of behavior. If we crosscheck the time the green-colored trigger was given with the actual GBPCAD chart, this is what we can observe. The pair is 30p higher since the trigger.
HOW TO SETUP ALERTS
One can easily setup a notification window each time the above rules are met, for example, if the EUR MA slope changes to bullish, and the AUD MA slope changes to bearish, and none of the 2 currency index values corresponding to these 2 moving averages (EUR and AUD) show a stoch RSI in overbought (above 80) in the case of the EUR, or oversold (below 20) in the case of the AUD, then the notification pop up would show a customized line: Long EURAUD
Note 1: Recording the slope of the macro moving average, which is usually a 25period MA applied to the currency index, is not included as part of the rules to trigger a signal, but it is taken into account to grade the quality of each signal.
Note 2: I recommend each signal to be triggered once or if you prefer, simply monitor the chart visually on the change of colors via the dashboard. The calculation resets and can appear again the moment that the slope changes to the opposite direction, so it’s a very dynamic indicator that will alert you the second a pair of currencies starts trending.
Note 3: When the signal is triggered, the indicator draws a colored rectangle. Each signal notification should be colored based on the following logic below.
LOGIC TO QUALIFY SIGNALS
-> Any long micro position with Macro MA in full agreement (ie/ Long EURAUD, Macro EUR up, Macro AUD down) is highlighted with green color
-> Any long micro position with macro moving averages in partial agreement (for example Long EURAUD, Macro EUR up AUD up) is highlighted with blue color
-> Any long micro position with macro moving averages in full disagreement (for example Long EURAUD, Macro EUR down AUD up) is highlighted with magenta color
-> Any short micro position with macro moving averages in full agreement (for example Short EURAUD, Macro EUR down AUD up) is highlighted with red color
-> Any short micro position with macro moving averages in partial agreement (for example Short EURAUD, Macro EUR up AUD up) is highlighted with orange color
-> Any short micro position with macro moving averages in full disagreement (for example Short EURAUD, Macro EUR up AUD down) is highlighted with purple color
PARAMETERS IN THE SCRIPT SETTINGS
Overbought/oversold: One can modify the stoch RSI level from which the indicator considers the value to be in overbought or oversold conditions. As a rule of thumb, consider 20/30 for oversold and 70/80 for oversold.
Slopes micro/macro MAs: One can edit the slope of the micro MA period (rule of thumb 4-5) and the macro MA (by default 25).
Value StochRSI: The default inputs are K 3, D 3, RSI Length 25, Stoch Length 25 for the micro and 125 period for the macro.
Change colors: One can edit the assigned colors in the signals dashboard.
Timeframe applied: The indicator has the flexibility to be applied to any timeframe, not just the 60m by default. Simply change the timeframe temporality.
CURRENCY INDEXES FORMULAS
It is the responsibility of the user to keep the values of the indexes updated. Find a recent sample below, as per values in early April. What this means is that at least once a week, in order to not let the values outdated, you should update the script with the latest valuations in the denominator.
NZD INDEX -> FX_IDC:NZDAUD/0.96+FX:NZDJPY/75.81+FX:NZDUSD/0.68+FX_IDC:NZDEUR/0.6+FX_IDC:NZDGBP/0.52+FX:NZDCHF/0.69+FX:NZDCAD/0.9
EUR INDEX -> FX:EURUSD/1.13+FX:EURJPY/125.5+FX:EURGBP/0.87+FX:EURCHF/1.135+FX:EURCAD/1.49+FX:EURNZD/1.655+FX:EURAUD/1.59
JPY INDEX -> 1/(FX:USDJPY/110.5+FX:EURJPY/125.5+FX:AUDJPY/79+FX:NZDJPY/75.5+FX:GBPJPY/144.5+FX:CHFJPY/110.5+FX:CADJPY/84)
USD INDEX -> FX_IDC:USDEUR/0.88+FX:USDJPY/110.5+FX_IDC:USDGBP/0.77+FX:USDCHF+FX:USDCAD/1.315+FX_IDC:USDNZD/1.46+FX_IDC:USDAUD/1.4
CAD INDEX-> FX_IDC:CADAUD/1.07+FX_IDC:CADNZD/1.11+FX:CADJPY/84.27+FX_IDC:CADUSD/0.76+FX_IDC:CADEUR/0.67+FX:CADCHF/0.76+FX_IDC:CADGBP/0.58
GBP INDEX -> FX:GBPAUD/1.83+FX:GBPNZD/1.91+FX:GBPJPY/144.5+FX_IDC:GBPEUR/1.15+FX:GBPCHF/1.31+FX:GBPUSD/1.31+FX:GBPCAD/1.71
Remember, I have provided a manual on how to build a currency strength meter. That’s what you will need to do first if you want to obtain the actual currency indexes other than just the indicator, which is just the visual cue to get you alerted when the slopes turn.
Once you’ve created your indexes via tradingview, you then apply a moving average to each index. Then apply the stochrsi 25 period to each index. For the macro trend, I make the same calculations, but the period of the MA is 25 instead of 4, while the stoch rsi is 125 periods vs 25 periods.
FINAL NOTE
This is a tool that should be interpreted as visual assistance, via the dashboard, to get that first cue when opposing micro slopes via the FX meter occur. However, you still need to check the technical context of the pair (levels marked, proj reached, etc.) but that first cue is a major time saver to constantly spot what's trending in FX. The permutations u can play with, as part of this script, are significant. You can tweak the timeframes you use, the periods of the moving averages, etc. I find the micro and macro trend combos when either a green or red signals is triggered the most reliable, with positions to be exploited via 15m and hourly under the right technical context.
Fake-Out IndicatorThe signal comes from the "RailRoad" candlestick pattern breaking a support/resistance level, which typically indicates price will respect that level.
How consistent is the pattern? Hard to say considering candlestick patterns vary wildly by % change between different securities.
I didn't implement any kind of "fuzzy logic" for this strategy, though it would benefit greatly from it.
There are many instances where a fixed% simply doesn't catch a winning trade from a "bounce" off a S/R level.
Adaptive Zero Lag EMA [STUDY]A user has asked for the Study/Indicator version of this Strategy .
If you encounter the error "loop....>100ms" simply toggle the eye icon to hide and unhide the indicator
The following is simply quoted from my previous post for your convenience: (obviously there won't be risk, Stop Loss, or Take profit parameters!)
OPERATING PRINCIPLE
The strategy is based on Ehlers idea that any indicator can be turned into a signal-producing trade system through smoothing and other filtering processes.
In fact, I'm using his Zero Lag EMA ( ZLEMA ) as a baseline indicator as well as some code snippets he has made public (1). God bless open source!
Next, I've provided the option to use an Instantaneous Frequency Measurement (IFM) method, which will adaptively choose the best period for the ZLEMA (2)
I've written other studies that use the differential calculus approximations for IFM, so it was only natural to include them in this strategy.
The primary two are Cosine IFM (3) and In-phase Quadrature IFM (4). You can also find an indicator with both plotted and the ability to average them together, as one IFM prefers long periods and the other short. (5)
BEFORE WE BEGIN
1. This strategy only runs on "normal" FX pairs ( EURUSD , GBPJPY , AUDUSD ...) and will fail on Metals or Commodities.
Cryptos are largely untested.
2. Please run it on these time frames: M15 to D.
Anything outside this range will likely fail.
HOW TO USE AND SUCCEED
1. If the Default settings don't produce good results right off the bat, then lower gain limit to 1 or 2 and threshold to 0.01.
2. Test each setting under adaptive method. If you want to leave it Off, then I'd recommend using some kind of IFM (see my links below) to
discover the most efficient period to use.
3. Once you have the best adaptive method chosen, begin incrementing gain limit until you find a nice balance between profit factor ( PF ) and drawdown.
4. Now, begin incrementing threshold. The goal is to have PF above 2 and a drawdown as low as possible.
5. Finally, change the source! Typically, close is the best option, but I have run into cases where high
yielded the highest returns and win rate.
6. Sit back, relax, and tweak the risk until you're happy with the return and drawdown amounts.
ADVANCED
You may need to adjust take profit (TP) points and stop loss (SL) points to create the best entry possible. Don't be greedy! You'll likely have poor
results if the TP is set to 300 and SL is 50.
If you are trading a pair that has a long Dominant Cycle Period, then you may increase Max Period to allow the IFM
to accept longer periods. Any period above the Max Period will be rejected. This may increase lag time!
Cheers and good luck trading!
-DasanC
(1)www.mesasoftware.com
(2)www.jamesgoulding.com
(3) Cosine IFM
(4) I-Q IFM
(5) Averaging IFM
IFM stands for Instantaneous frequency measurement
Adaptive Zero Lag EMA v2This is my most successful strategy to date! Please enjoy and join the Open Source movement by sharing your code and ideas online!
OPERATING PRINCIPLE
The strategy is based on Ehlers idea that any indicator can be turned into a signal-producing trade system through smoothing and other filtering processes.
In fact, I'm using his Zero Lag EMA (ZLEMA) as a baseline indicator as well as some code snippets he has made public (1). God bless open source!
Next, I've provided the option to use an Instantaneous Frequency Measurement (IFM) method, which will adaptively choose the best period for the ZLEMA (2)
I've written other studies that use the differential calculus approximations for IFM, so it was only natural to include them in this strategy.
The primary two are Cosine IFM (3) and In-phase Quadrature IFM (4). You can also find an indicator with both plotted and the ability to average them together, as one IFM prefers long periods and the other short. (5)
BEFORE WE BEGIN
1. This strategy only runs on "normal" FX pairs (EURUSD, GBPJPY, AUDUSD ...) and will fail on Metals or Commodities.
Cryptos are largely untested.
2. Please run it on these time frames: M15 to D.
Anything outside this range will likely fail.
HOW TO USE AND SUCCEED
1. If the Default settings don't produce good results right off the bat, then lower gain limit to 1 or 2 and threshold to 0.01.
2. Test each setting under adaptive method . If you want to leave it Off , then I'd recommend using some kind of IFM (see my links below) to
discover the most efficient period to use.
3. Once you have the best adaptive method chosen, begin incrementing gain limit until you find a nice balance between profit factor (PF) and drawdown.
4. Now, begin incrementing threshold . The goal is to have PF above 2 and a drawdown as low as possible.
5. Finally, change the source ! Typically, close is the best option, but I have run into cases where high
yielded the highest returns and win rate.
6. Sit back, relax, and tweak the risk until you're happy with the return and drawdown amounts.
ADVANCED
You may need to adjust take profit (TP) points and stop loss (SL) points to create the best entry possible. Don't be greedy! You'll likely have poor
results if the TP is set to 300 and SL is 50.
If you are trading a pair that has a long Dominant Cycle Period , then you may increase Max Period to allow the IFM
to accept longer periods. Any period above the Max Period will be rejected. This may increase lag time!
Cheers and good luck trading!
-DasanC
PS - This code doesn't repaint or have future-leak, which was present in Pinescript v2.
PPS - Believe me! These returns are typical! Sometimes you must push aside the "if it's too good to be true..." mindset that society has ingrained in you.
Do you really believe the most successful pass up opportunities before investigating them? ;)
(1) Ehlers & Ric Zero Lag EMA
(2) Measuring Cycles by Ehlers
(3) Cosine IFM
(4) Inphase Quadrature IFM
(5) Averaging IFM