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

HTF EMA No Lookahead - MetaTrader 5용 지표

조회수:
229
게시됨:
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

A common way to show a higher-timeframe moving average on a lower-timeframe chart is to take the value of the higher-timeframe bar that contains the current bar. On history this looks fine, but it is a hidden lookahead: on an H1 chart at 10:00, the H4 bar that started at 08:00 is not closed yet, and its EMA value is only known at 12:00. An indicator or an Expert Advisor that uses it in the past sees information from the future, and the backtest looks better than live trading.

This indicator draws the higher-timeframe EMA using only data that was available at that moment. For every chart bar it takes the last higher-timeframe bar that closed strictly before the chart bar ends. The result is a step line that never repaints: what you see on history is exactly what you would have seen live.

H4 EMA 50 and 200 on an XAUUSD H1 chart

Input parameters

  • Higher timeframe (default H4). If it is not higher than the chart timeframe, a normal EMA of the chart is drawn.
  • Fast EMA period (default 50, 0 = off).
  • Slow EMA period (default 200, 0 = off).
  • Applied price (default Close).

Buffers for Expert Advisors

  • 0 = fast EMA
  • 1 = slow EMA
  • 2 = trend: +1 fast above slow, -1 fast below slow, 0 = no data
int h = iCustom(_Symbol, PERIOD_H1, "HTF_EMA_NoLookahead", PERIOD_H4, 50, 200, PRICE_CLOSE);
double trend[1];
//--- bar 1 = last closed bar
if(CopyBuffer(h, 2, 1, 1, trend) == 1 && trend[0] > 0)
  {
   //--- H4 trend is up
  }

How it was checked

On 2000 bars of XAUUSD H1 every value was compared with an independent calculation (iBarShift of the last second of the H1 bar, then the previous H4 bar). There were no differences. The indicator loads higher-timeframe history in the background and redraws itself when it arrives, also at the weekend when there are no ticks.

Round Number Levels Session Grid Round Number Levels Session Grid

Round number levels for Gold (XAUUSD) and any symbol on MT5. Draws major and minor round levels around price plus Asia, London and New York session open lines, with an optional alert when a candle closes across a major level. Open source code.

Multi Timeframe Trend Dashboard Multi Timeframe Trend Dashboard

Multi timeframe trend dashboard for Gold (XAUUSD) and any symbol on MT5. Shows up, down or flat for up to 6 timeframes from a fast and slow EMA on the last closed bar, with the distance in points and an alert when all line up. Open source code.

Risk Lot From Stop Line Risk Lot From Stop Line

Drag a stop line on the chart and see the volume for a given risk, the real risk after rounding, and a warning when even the minimum volume risks too much.

Trade History in R Trade History in R

Shows the closed trades of the account in R (net profit divided by the money at risk at entry): expectancy, win rate, drawdown in R, losing streak, per-symbol summary and CSV export.