거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
지표

SuperTrend TV - MetaTrader 5용 지표

TradingView (ta.supertrend)
게시자:
Mykyta Samoiliuk
Mykyta Samoiliuk
I make indicators and Expert Advisors for MetaTrader 5 and write the tools around them in Python. Everything I publish comes with a way to check that it works, so you do not have to take my word for it. I convert TradingView indicators to MQL5 so they show the same values as the original, and I
조회수:
284
평가:
(1)
게시됨:
업데이트됨:
\MQL5\Scripts\ \MQL5\Files\
verify.py (6.63 KB) 조회
selftest.py (3.13 KB) 조회
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

CodeBase already has plenty of SuperTrends, so this one needs a reason to exist. It returns the same numbers as TradingView, down to the last digit that matters, and it ships with the tool that proves it. A screenshot of two charts that look alike is not evidence of anything, and anyone who has ported an indicator knows the difference only shows up later.

If you have ever moved an indicator from Pine to MQL5 and found that the arrows land in roughly the right places while the entries are not the ones you saw on TradingView, this project is about exactly that gap. The line comes out the right shape, the flips look plausible, and the trades still differ.

SuperTrend TV on XAUUSD M5, teal for uptrend and crimson for downtrend

Why ports drift

The first trap is that ta.rma is not an EMA. Pine builds its ATR as a Wilder average with alpha of 1/n, seeded with the simple average of the first n true ranges. The reflex when porting is to write an EMA with alpha of 2/(n+1), which produces a line of the same shape and a different set of signals.

The second trap is that iATR is not a drop-in replacement either. Its warm-up begins one bar later than Pine's ta.tr with handle_na enabled, which counts the very first bar as high minus low. Inside a recursive average that one bar offset never fully washes out, so this indicator builds the true range and the smoothing itself rather than borrowing them.

The third trap is the stickiest one, and it is a single line in the Pine source. The bands only tighten, and a band gives way only once price has closed through it. Skip that rule and the indicator disagrees with the original on nearly half of all bars, which stops being a rounding difference and becomes a different strategy.

Each mistake was switched on by itself and measured against the same reference on five instruments. The drift scales with the instrument, so the same error is worth fractions of a pip on EURUSD and hundreds of dollars on BTCUSD.

Mistake Wrong trend on Worst price error
ATR as EMA, alpha = 2/(n+1) 5.5% to 7.3% of bars 42 on gold
ATR as a plain moving average 5.2% to 9.4% of bars 41 on gold
Bands not sticky 47.6% to 56.6% of bars 85 on gold

There is one more thing that is not a bug but bites all the same. In TradingView the direction value is minus one while the trend is up and plus one while it is down. That reads backwards to most people, and flipping it silently inverts every signal built on top of the indicator. This port keeps the TradingView convention.

How to check it yourself

The attached script exports OHLC together with the indicator's own output into a single file. The Python reference then recomputes the indicator from those very same rows and compares every bar. Both sides therefore see identical input, which leaves a discrepancy nowhere to hide, and the check either passes on every bar or names the first bar where it fails.

SuperTrend  period=10  factor=3.0  tolerance=1e-08
source: supertrend_mt5.csv  (17443 bars)

MQL5 port vs Pine reference
  ATR (Wilder/RMA)   bars 17434 | max 0.0000000000 | mean 0.0000000000   PASS
  SuperTrend line    bars 17434 | max 0.0000000001 | mean 0.0000000000 | direction differs on 0 bars   PASS

Result that port matches Pine bar for bar

The run above is gold on M5. The same check was repeated on five instruments out of a live terminal, chosen to cover five digit and three digit quotes, a metal, an index and crypto. Across all of them the trend direction never disagreed on a single bar, and the largest difference on the line itself was one part in ten billion, which is double rounding rather than a difference in the arithmetic.

Instrument Timeframe Bars compared Direction mismatches
EURUSD M5 99990 0
USDJPY M5 99990 0
XAUUSD M5 17434 0
GER40 M15 5815 0
BTCUSD M15 5727 0

The checker is itself tested, because a verifier stuck on PASS would be worse than no verifier at all. The selftest feeds it one correct file and one deliberately mis-ported file, and it fails unless the second is rejected. The Python side needs nothing installed beyond the standard library, so anyone can rerun all of this in a minute.

Usage

The indicator takes the usual two inputs, the ATR period with a default of 10 and the factor with a default of 3.0. It draws a single line coloured by trend, and it exposes the values an Expert Advisor needs through iCustom.

buffer 0, the SuperTrend value

buffer 2, the direction, minus one for up and plus one for down

buffer 3, the Wilder ATR

The scope is deliberately narrow. This is ta.supertrend on hl2, one symbol and one timeframe, computed on closed bars. The forming bar is excluded from the export, since its value is still moving and comparing it would report a mismatch that means nothing at all.

Pending Order Inspector MT5 Pending Order Inspector MT5

Read-only panel that checks a BUY STOP or SELL STOP against the symbol contract before you send it: price tick grid, volume minimum/step/maximum, stop distances and order permissions. It never sends, changes or suggests anything.

Completed Bar Trend Regime Dashboard MT5 Completed Bar Trend Regime Dashboard MT5

An MT5 dashboard that classifies completed-bar trend regimes using EMA structure, ADX/DI, higher-timeframe confirmation, ATR, breakout position and spread context.

Any Indicator Alert - alerts, push notifications and multi-timeframe for any custom indicator, no source code needed Any Indicator Alert - alerts, push notifications and multi-timeframe for any custom indicator, no source code needed

Attach it to a chart, type the name of any custom indicator, and it alerts you on that indicator's own buffers - popup, sound, push notification to your phone, or email. It reads the indicator through iCustom, so no source is needed: a compiled .ex5 you downloaded is enough. It can also read that indicator from a higher timeframe, and it re-checks closed bars to tell you whether the indicator repaints or merely lags. It opens in EXPLORE mode, which lists every buffer the indicator has and what is in each one, because "which buffer holds the signal" is the question that stops most people using iCustom at all.

SuperTrend TV EA SuperTrend TV EA

An Expert Advisor that trades the SuperTrend TV indicator through iCustom on closed bars only, shipped with the audit that proves every trade matches a signal and no signal was missed