Sessioned EMA - Frozen EMA in post market hoursWhy I develop this indicator?
In future indices, post market data with little volume distort the moving average seriously. This indicator is to eliminate the distortion of data during low volume post market hours.
How to use?
There is a time session setting in the indicator, you can set the cash hour time, moving average outside the session will be frozen.
What this indicator gives you
This indicator give you a more make sense ema pattern, the ema lines are more respected by the prices when you set the session properly.
Setup
1. Session setting
In US indices, such as NQ, ES etc, when there was data release at 0830 hr, huge volume transaction order appears, that makes the 0830 price data important that should be included in your ema trend line calculating. If that is the case, I will set the session begin from 0830, otherwise, I start the session at 0930. Golden rule : Price with huge volume counts.
2. Time zone
The coding is decided for GMT+8 time zone, you may amend the code to fit your timezone.
Indices
Percent of U.S. Stocks Above VWAPThis indicator plots a line reflecting the percentage of all U.S. stocks above or below their VWAP for the given candle. Horizontal lines have been placed at 40% (oversold), 50% (mid-line), and 60% (overbought). I recommend using this indicator as a market breadth indicator when trading individual stocks. In my experience, this indicator is best utilized while trading the major indices (SPX, SPY, QQQ, IWM) or their futures (ES, NQ, RTY) in the following manner:
- When the line crosses 50%, a green or red triangle is plotted indicating the majority of market momentum has turned bullish or bearish based on price positioning vs. VWAP. Look for longs when the line is rising (green) or above 50%, or shorts when the line is falling (red) or below 50%.
- When the line is below 40%, indicator shows red shading; I would not be long anything during this period. When the line exits this level, I begin looking for long entries. This line is adjustable in the indicator settings if you prefer to use a tighter or looser oversold level.
- When the line is above 60%, indicator shows green shading; I would not be short anything during this period. When the line exits this level, I begin looking for short entries. This line is adjustable in the indicator settings if you prefer to use a tighter or looser overbought level.
This indicator uses the TradingView ticker “PCTABOVEVWAP.US”, thus it only updates during NY market hours. If trading futures, I recommend applying VWAP to your chart and using that as the level to trade against in a similar manner, along with your personal price action analysis and other indicators you find useful.
5 Minute TF 200 EMA Retest by Grantwww.tradingview.com
This indicator is a simple script meant to find retests on the 200 period moving average. It's current state is optimized for the 5 minute timeframe.
This works in all markets and all timeframes as long as you adjust certain rules for higher timeframes.
It's strengths and weaknesses
- Good at trend continuation in strong markets
- Bad in ranging markets (not surprising)
How does it work?
- It first identifies an overall trend by using the 200 ema.
- For long positions, it waits for price to close below the 200 ema, and then shortly closing back above the ema. For short positions its the opposite.
- For lower timeframes there are some other factors that help filter out bad signals that include:
- Makes sure that volume is increasing.
- Makes sure that volume is higher than average volume.
- For higher timeframes, the more specific factors aren't required.
How to use this indicator:
- Green triangles mean long positions
- Red triangles mean short positions
- Always trade with stoplosses and never risk too much of your account, please practice proper risk managment.
DISCLAIMER: Trading is inherently dangerous and carries lot's of risk. What you decide to do with my script has nothing to do with me. I am not responsible for any financial gains or losses made using this script. It is important to recognize other factors in the market to make better decisions.
Sort array alphabetically - educational🔶 OVERVIEW
• This educational script will sort an array of tickers alphabetically and place these values in an table , together with the according current price value next to each ticker .
🔶 SORT ALPHABETICALLY
🔹 I. We make a User Defined Type (UDT) obj , with:
· ticker - the string name of the ticker
· price - the current price (close)
• From this UDT we make an object obj.new() for each ticker
🔹 II. 2 array's are made:
• array of objects aObj , containing obj type obj.new() for every ticker
• array of strings sort , the ticker part of each object obj.new()
🔹 III. Now we make an object of each ticker with the createObject(sym ) function
object_1 = createObject("TICKER")
• the object object_1 consists off:
· ticker -> "TICKER"
· price -> current Daily close through request.security("TICKER") (non-repainting)
• object_1 will be added to the aObj array
• "TICKER" ( string ticker part of object ) will be added to the sort array
🔹 IV. The latter array is sorted alphabetically by using array.sort_indices()
EXAMPLE
originalArray = array.from("B", "A", "C")
indicesArray = // sorted indices
array.get(originalArray, 1) -> "A"
array.get(originalArray, 0) -> "B"
array.get(originalArray, 2) -> "C"
IMPORTANT
Alphabetically sorting is case sensitive , just like Java compareTo(String anotherString) !
• The comparison is based on the Unicode value of each character in the string, the lowest "Dec" values are sorted first in line.
• Comparing the "Dec" values at unicodelookup explains why default CAPITAL lettres will be sorted first,
• Default you would get this (A= 65, B= 66, a= 97, b= 98)
Aa
Ba
ab
bb
• Adding str.lower(string) in the toLowerCase() function will result to the following:
Aa
ab
Ba
bb
• (A= 65 is transformed to a= 97, ...)
• As a side note, should you write "AMZN" as "ÀMZN" this would be placed at the end, even after transforming to lower case the "Dec" values are higher (À= 192, à= 224).
• You can toggle "To Lower Case" to verify.
🔹 V. Values are placed in a table , using these sorted indices.
• With the usage of UDTs and objects , the current price has the same index in the aObj as their ticker ,
giving the advantage it is fairly easy to place every value correctly next to each other.
• The same can be done by make 2 separate arrays , 1 for the current price , the other for "TICKER" .
🔶 OTHER TECHNIQUES USED
• Alternative technique for adding comment
Instead of
// this is a comment
You can also do this:
_=" this is a comment "
• Alternate colour
· During a loop , alternate colour when i is even or odd , using the modulo operation (%) .
· This is the remainder when dividing.
EXAMPLE
· 3 % 2 = 1 -> 3 / 2 -> 1 * 2, 1 left (remainder)
· 4 % 2 = 0 -> 4 / 2 -> 2 * 2, 0 left (remainder)
· 5 % 2 = 1 -> 5 / 2 -> 2 * 2, 1 left (remainder)
for i = 0 to 10
even = i % 2 == 0
col = even ? thisColor : otherColor
• Adjust colour in script by using colour picker
Cheers!
Fiat Currency and Gold Indices (FGXY) CandlesA modification of my previous indicator "Crypto Index (DXY) Candles". The idea was to create a similar currency basket to the standard DXY, but from the perspective of other currencies. Still using the standard DXY weights, this indicator allows you to create a tailored index for other currencies, provided that a currency pair exists for each of the 6 components. This means that even currencies that aren't included should work in theory; just find the 3 character currency prefix used by tradingview and give it a shot! This indicator is useful for gauging how well countries/currencies are holding up and when paired with the standard DXY may help see potential inflection points. For use on longer time frames (~1h-~3d) as some of the data being pulled seems to have issues on lower timeframes.
Background ZonesThis script provides up to 5 zones to apply background colors. This is especially useful for applying to indices such as USI:TICK , USI:ADD , and USI:VOLD , where certain levels provides significant meaning to market sentiment and directions. This script will give you the visual cue to help with your trading.
All levels and colors are fully customizable.
Enjoy~!!
Example:
ICT KillZone [Index futures edition] Guided by new ICT Mentorship I create this versatile timezone or strikezone indicator to identify this without changing timezone (is based on America/New_York timezone, not your current timezone or GMT)
Sessions & Days Of The WeekTraders tend to focus their energy on specific sessions or time periods. This indicator will plot the days of the week, and also highlight the following sessions: Frankfurt (2:00am - 11:00am EST), London (3:00am - 12:00pm EST), New York (8:00am - 5:00pm EST), Sydney (5:00pm - 2:00am EST), Tokyo (7:00pm - 4:00am EST).
It’s important to be aware that Session Open and Close times will vary based on the time of year, as countries shift over to daylight savings time.
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.
Correlation IndexShows how often and how much the underlying security deviates from the base stock.
Indices that help in the selection of securities:
Lst10 - last 10(long factor parameter) periods average
Aver - fulltime averaged
pwr - total deviation area from base
ust - unstability (drawdown index)
cor - percent of positive bars
cross - fulltime averaged deviation
Alert(), alertcondition() or strategy alerts?Variety of possibilities offered by PineScript, especially thanks to recent additions, created some confusion. Especially one question repeats quite often - which method to use to trigger alerts?
I'm posting this to clarify and give some syntax examples. I'll discuss these 3 methods in chronological order, meaning - in the order they were introduced to PineScript.
ALERTCONDITION() - it is a function call, which can be used only in study-type script. Since years ago, you could create 2 types of a script: strategy and study. First one enables creating a backtest of a strategy. Second was to develop scripts which didn't require backtesting and could trigger alerts. alertcondition() calls in strategy-type scripts were rejected by Pine compiler. On the other hand compiling study-type scripts rejected all strategy...() calls. That created difficulties, because once you had a nice and backtested strategy, you had to rip it off from all strategy...() function calls to convert your script to study-type so you could produce alerts. Maintenance of two versions of each script was necessary and it was painful.
"STRATEGY ALERTS" were introduced because of alertcondition() pains. To create strategy alert, you need to click "Add alert" button inside Strategy Tester (backtester) and only there. Alerts set-up this way are bound with the backtester - whenever backtester triggers an order, which is visible on the chart, alert is also fired. And you can customize alert message using some placeholders like {{strategy.order.contracts}} or {{ticker}}.
ALERT() was added last. This is an alerts-triggering function call, which can be run from strategy-type script. Finally it is doable! You can connect it to any event coded in PineScript and generate any alert message you want, thanks to concatenation of strings and wrapping variables into tostring() function.
Out of these three alertcondition() is obviously archaic and probably will be discontinued. There is a chance this makes strategy/study distinction not making sense anymore, so I wouldn't be surprised if "studies" are deprecated at some point.
But what are the differences between "Strategy alerts" and alert()? "Strategy alerts" seem easier to set-up with just a few clicks and probably easier to understand and verify, because they go in sync with the backtester and on-chart trade markers. It is especially important to understand how they work if you're building strategy based on pending orders (stop and limit) - events in your code might trigger placing pending order, but alert will be triggered only (and when) such order is executed.
But "Strategy Alerts" have some limitations - not every variable you'd like to include in alert message is available from PineScript. And maybe you don't need the alert fired when the trade hit a stop-loss or take-profit, because you have already forwarded info about closing conditions in entry alert to your broker/exchange.
Alert() was added to PineScript to fill all these gaps. Is allows concatenating any alert message you want, with any variable you want inside it and you can attach alert() function at any event in your PineScript code. For example - when placing orders, crossing variables, exiting trades, but not explicitly at pending orders execution.
The Verdict
"Strategy Alerts" might seem a better fit - easier to set-up and verify, flexible and they fire only when a trade really happens, not producing unnecessary mess when each pending order is placed. But these advantages are illusionary, because they don't give you the full-control which is needed when trading with real money. Especially when using pending orders. If an alert is fired when price actually hit a stop-order or limit-order level, and even if you are executing such alert within 1 second thanks to a tool like TradingConnector, you might already be late and you are making entry at a market price. Slippage will play a great role here. You need to send ordering alert when logical conditions are met - then it will be executed at the price you want. Even if you need to cancel all the pending orders which were not executed. Because of that I strongly recommend sticking to ALERT() when building your alerts system.
Below is an example strategy, showing syntax to manage placing the orders and cancelling them. Yes, this is another spin-off from my TradingView Alerts to MT4 MT5 . As usual, please don't pay attention to backtest results, as this is educational script only.
P.S. For the last time - farewell alertcondition(). You served us well.
INDICES against BTC & ETHThe idea is the following; you can easily chart the FTX perp indices against (currently) two baselines, ETH & BTC.
I always choose ETH since it is way harder to outperform ETH at the moment. Doing this helps me see certain trends and/or fractal that might happen again in the future.
Since I already made D.A.M (Defi against Majors / Pricing Defi categories against BTC & ETH: ) I came across the idea of doing the same thing but with the perp indices that FTX offer. At first, I wanted to add this to D.A.M but it has no place in this indicator since this will not only look at Defi but the macro market as a whole.
The indicator currently only looks at the following indexes (weighting can be found here: https:// help. ftx. com/hc/en-us/articles/360027668812-Index-Calculation) :
DRGN: THE DRAGON INDEX
ARPA, BTM, IOST, NEO, NULS, ONT, QTUM, TRX, VET
ALT: ALTCOIN INDEX
BCH, BNB, EOS, ETH, LTC, XRP, TRX, DOT, LINK, ADA
MID: THE MID CAP INDEX
ALGO, ATOM, BAT, CRO, DASH, DCR, DOGE, HT, IOTA, LEO, NEO, OKB, ONT, QTUM, VET, XEM, XLM, XMR, XTZ, ZEC, ZRX, OMG, COMP, BSV, FTT, YFI, UNI, SNX, MKR, AAVE
SHIT: THE SHITCOIN INDEX
AE, AION, ARDR, ARPA, BCD, BEAM, BTG, BTM, BTS, BTT, CHZ, CKB, DGB, ELF, ENJ, GNT, GRIN, GT, HBAR, HC, ICX, IOST, KMD, KNC, LAMB, LRC, LSK, MANA, MATIC, MCO, NANO, NULS, OMG, POWR, PUNDIX, REN, REP, RVN, SC, SNT, STEEM, THETA, TOMO, VSYS, WAVES, XVG, XZC, ZEN, ZIL, ZRX
PRIV: THE PRIVACY INDEX
BEAM, DCR, GRIN, KMD, XMR, XVG, XZC, ZEC, ZEN
DEFI: THE DECENTRALIZED FINANCE INDEX
KNC, MKR, ZRX, REN, REP, SNX, COMP, TOMO, RUNE, CRV, DOT, LINK, MTA, SOL, CREAM, BAND, SRM, SUSHI, SWRV, AVAX, YFI, UNI, WNXM, AAVE, BAL
TradingView Alerts to MT4 MT5 - Forex, indices, commoditiesHowdy Algo-Traders! This example script has been created for educational purposes - to present how to use and automatically execute TradingView Alerts on real markets.
I'm posting this script today for a reason. TradingView has just released a new feature of the PineScript language - ALERT() function. Why is it important? It is finally possible to set alerts inside PineScript strategy-type script, without the need to convert the script into study-type. You may say triggering alerts straight from strategies was possible in PineScript before (since June 2020), but it had its limitations. Starting today you can attach alert to any custom event you might want to include in your PineScript code.
With the new feature, it is easier not only to execute strategies, but to maintain codebase - having to update 2 versions of the code with each single modification was... ahem... inconvenient. Moreover, the need to convert strategy into study also meant it was required to rip the code from all strategy...() calls, which carried a lot of useful information, like entry price, position size, and more, definitely influencing results calculated by strategy backtest. So the strategy without these features very likely produced different results than with them. While it was possible to convert these features into study with some advanced "coding gymnastics", it was also quite difficult to test whether those gymnastics didn't introduce serious, bankrupting bugs.
//////
How does this new feature work? It is really simple. On your custom events in the code like "GoLong" or "GoShort", create a string variable containing all the values you need inside your alert and this string variable will be your alert's message. Then, invoke brand new alert() function and that's it (see lines 67 onwards in the script). Set it up in CreateAlert popup and enjoy. Alerts will trigger on candle close as freq= parameter specifies. Detailed specification of the new alert() function can be found in TradingView's PineScript Reference (www.tradingview.com), but there's nothing more than message= and freq= parameters. Nothing else is needed, it is very simple. Yet powerful :)
//////
Alert syntax in this script is prepared to work with TradingConnector. Strategy here is not too complex, but also not the most basic one: it includes full exits, partial exits, stop-losses and it also utilizes dynamic variables calculated by the code (such as stop-loss price). This is only an example use case, because you could handle variety of other functionalities as well: conditional entries, pending entries, pyramiding, hedging, moving stop-loss to break-even, delivering alerts to multiple brokers and more.
//////
This script is a spin-off from my previous work, posted over a year ago here: Some comments on strategy parameters have been discussed there, but let me copy-paste most important points:
* Commission is taken into consideration.
* Slippage is intentionally left at 0. Due to shorter than 1 second delivery time of TradingConnector, slippage is practically non-existing.
* This strategy is NON-REPAINTING and uses NO TRAILING-STOP or any other feature known to be causing problems.
* The strategy was backtested on EURUSD 6h timeframe, will perform differently on other markets and timeframes.
Despite the fact this strategy seems to be still profitable, it is not guaranteed it will continue to perform well in the future. 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.
Full specs of TradingView alerts and how to set them up can be found here: www.tradingview.com
Indices Sector SigmaSpikes█ OVERVIEW
“The benchmark Dow Jones Industrial Average is off nearly 300 points as of midday today...”
“So what? Is that a lot or a little? Should we care?”
-Adam H Grimes-
This screener aims to provide Bird-Eye view across sector indices, to find which sector is having significant or 'out-of-norm' move in either direction.
The significance of the move is measured based on Sigma Spikes, a method proposed by Adam H. Grimes, where Standard Deviation of returns used as a baseline.
*You can google his blog or read his book, got some gold in there, especially on how he use indicators for trading
█ Understanding Sigma Spikes
As described by Grimes, moves in markets are only meaningful when we consider what “normal” is for that market.
Without that baseline, the daily change number, and even the percent change on the day doesn’t really mean much.
To overcome that problem, Sigma Spikes, as a measure of volatility, attempt to put todays change in price (aka return) in context of the standard deviation of 20 days daily's return.
Refer chart below:
1. The blue bars refer to each days return
2. The orange line is 1 time standard deviation of past 20days daily's return (today not included)
3. The red line is 2 time standard deviation of past 20days daily's return (today not included)
Using the ratio of today's return over the Std Deviation, determining your threshold (1,2,3,etc) will be the key that tells if today's move is significant or not.
*Threshold referring to times standard deviation, and different market may require different threshold.
*20 Days period are based on the Lookback Period, adjustable from user input window.
█ Features
- Scan up to 13 symbols at a time (Bursa (MYX) indices are defaulted, but you may change to any symbols/index from the user input setting)
█ Limitation
- Due to multiple use of security() function required to call other symbols, expect the screener to be slow at certain times
- Custom Timeframe currently accept only Daily and Weekly. I'll try to include lower timeframe in the next update
█ Disclaimer
Past performance is not an indicator of future results.
My opinions and research are my own and do not constitute financial advice in any way whatsoever.
Nothing published by me constitutes an investment recommendation, nor should any data or Content published by me be relied upon for any investment/trading activities.
I strongly recommends that you perform your own independent research and/or speak with a qualified investment professional before making any financial decisions.
Any ideas to further improve this indicator are welcome :)
Relative Strength Auto ComparisonRelative Strength Comparison with automatic selection of relevant index
Added support for most european and north american exchanges.
Terminal : Important U.S Indices Change (%) DataHello.
This script is a simple U.S Indices Data Terminal.
You can also set the period to look back manually in the menu.
In this way, an idea can be obtained about Major U.S Indices.
Features
Value changes on a percentage basis (%)
Recently, due to increasing interest, the NQNACE index has been added.
Index descriptions are printed on the information panel.
Sentiment NYSE ARCA and AMEX indices added.
Indices
SP1! : S&P 500 Futures Index
DJI : Dow Jones Industrial Average Index
NDX : Nasdaq 100 Index
RUT : Russell 2000 Index
NYA : NYSE Composite Index
OSX : PHLX Oil Service Sector Index
HGX : PHLX Housing Sector Index
UTY : PHLX Utility Sector Index
SOX : PHLX Semiconductor Sector Index
SPSIBI : S&P Biotechnology Select Industry Index
XNG : NYSE ARCA Natural Gas Index
SPGSCI : S&P Goldman Sachs Commodity Index
XAU : PHLX Gold and Silver Sector Index
SPSIOP : S&P Oil and Gas Exploration and Production Select Industry Index
GDM : NYSE ARCA Gold Miners Index
DRG : NYSE ARCA Pharmaceutical Index
TOB : NYSE ARCA Tobacco Index
DFI : NYSE ARCA Defense Index
NWX : NYSE ARCA Networking Index
XCI : NYSE ARCA Computer Technology
XOI : AMEX Oil Index
XAL : AMEX Airline Index
NQNACE : Nasdaq Yewno North America Cannabis Economy Index
Terminal : USD Based Stock Markets Change (%)Hello.
This script is a simple USD Based Stock Markets Change (%) Data Terminal.
You can also set the period to look back manually in the menu.
In this way, an idea can be obtained about Countries' Stock Markets.
And you can observe the stock exchanges of relatively positive and negative countries from others.
Features
Value changes on a percentage basis (%)
Stock exchange values are calculated in dollar terms.
Due to the advantage of movement, future data were chosen instead of spot values on the required instruments.
Stock Markets
Usa : S&P 500 Futures
Japan: Nikkei 225 Futures
England: United Kingdom ( FTSE ) 100
Australia: Australia 200
Canada: S&P / TSX Composite
Switzerland: Swiss Market Index
New Zealand: NZX 50 Index
China: SSE Composite (000001)
Denmark: OMX Copenhagen 25 Index
Hong-Kong: Hang Seng Index Futures
India: Nifty 50
Norway: Oslo Bors All Share Index
Russia: MOEX Russia Index
Sweden: OMX Stockholm Index
Singapore: Singapore 30
Turkey: BIST 100
South Africa: South Africa Top 40 Index
Spain: IBEX 35
France: CAC 40
Italy: FTSE MIB Index
Netherlands: Netherlands 25
Germany : DAX
Regards.
Relative Strength(RSMK) + Perks - Markos KatsanosIf you are desperately looking for a novel RSI, this isn't that. This is another lesser known novel species of indicator. Hot off the press, in multiple stunning color schemes, I present my version of "Relative Strength (RSMK)" employing PSv4.0, originally formulated by Markos Katsanos for TASC - March 2020 Traders Tips. This indicator is used to compare performance of an asset to a market index of your choosing. I included the S&P 500 index along side the Dow Jones and the NASDAQ indices selectively by an input() in "Settings". You may comparatively analyze other global market indices by adapting the code, if you are skilled enough in Pine to do so.
With this contribution to the Tradingview community, also included is MY twin algorithmic formulation of "Comparative Relative Strength" as a supplementary companion indicator. They are eerily similar, so I decided to include it. You may easily disable my algorithm within the indicator "Settings". I do hope you may find both of them useful. Configurations are displayed above in multiple scenarios that should be suitable for most traders.
As always, I have included advanced Pine programming techniques that conform to proper "Pine Etiquette". For those of you who are newcomers to Pine Script, this script may also help you understand advanced programming techniques in Pine and how they may be utilized in a most effective manner. Utilizing the "Power of Pine", I included the maximum amount of features I could surmise in an ultra small yet powerful package, being less than a 60 line implementation at initial release.
Unfortunately, there are so many Pine mastery techniques included, I don't have time to write about all of them. I will have to let you discover them for yourself, excluding the following Pine "Tricks and Tips" described next. Of notable mention with this release, I have "overwritten" the Pine built-in function ema(). You may overwrite other built-in functions too. If you weren't aware of this Pine capability, you now know! Just heed caution when doing so to ensure your replacement algorithms are 100% sound. My ema() will also accept a floating point number for the period having ultimate adjustability. Yep, you heard all of that properly. Pine is becoming more impressive than `impressive` was originally thought of...
Features List Includes:
Dark Background - Easily disabled in indicator Settings->Style for "Light" charts or with Pine commenting
AND much, much more... You have the source!
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
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
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 :)
Is Open equal to High or LowMany people are watching opening price on each time axis. Opening price is very important.
This indicator displays OHLC Open as a line in multiple time frame.
If open is close to high or low, the color of the line changes.
The fact that they are close means the strength of the market flow and the firmness of that price range.
Note:
The color of the line will not be fixed until bar is closed.
And when using, please set arbitrary coefficient according to each market.
Coefficient e.g.
EURUSD: 0.00005
BTCUSD: 1
DJI: 5
BTCJPY: 100
USDJPY: 0.01
NI225: 2