Simple multi-Time Frame conversion

MQL4 Indicatori

Specifiche

Hello developers,

The purpose of this indicator is to preserve value of indicator value on one Time-frame when turn chart on different TF. The underlying condition is:

if(iMA(NULL,D1,15,0,MODE_EMA,0,d1bar_1)>=iMA(NULL,D1,15,0,MODE_EMA,0,d1bar_2)) THEN value=1, else Value=-1


I knew how to do it using 1 method, named APPROACH 1 in the code. It is a bit long, especially when it come to lag value like today (D_0), yesterday (D_1)....


I am learning method 2, named APPROACH 2 which allow me simply create a value like indicator_1[I]=indicator_0[I+1]. The problem is that on H1, the [I+1] is 1 more H1 bar even though I want to preserve D1 value which associated with D1 bar.

With the help of other member, the preservation of D1 on any TF chart is done. I want you to follow exactly the same method for H4 and H1.

I try to fill in all other information, and essentially, all you need to do  is to make adjustment for H4 and H1 in the below section (If I am correct).

//---THIS SECTION IS FOR D1 CONVERISIOn-------------------------------------------------------------
//-this section is to make sure that on NON_D1 chart, value of D1 still "preserve and spread"
#define HR2400 86400       // 24 * 3600 = PERIOD_D1 * 60
int      TimeOfDay(datetime when=0){      if(when == 0)  when = TimeCurrent();
                                          return( when % HR2400 );            }
datetime DateOfDay(datetime when=0){      if(when == 0)  when = TimeCurrent();
                                          return( when - TimeOfDay(when) );   }
datetime Yesterday(datetime when=0){      if(when == 0)  when = TimeCurrent();
   int iD1 = iBarShift(NULL, PERIOD_D1, DateOfDay(when) - 1);
                                       return( iTime(NULL, PERIOD_D1, iD1) ); }
//--------------------------------------------------------------------------------------------------


//lag operation
   datetime  now = Time[i],
             yest = Yesterday(now);
   int      iYest = iBarShift(NULL,0, yest);
   D1new_indi_1[i]=D1new_indi[iYest];

I attached the code itself and the MA color indicator just so you can compare the result.


Con risposta

1
Sviluppatore 1
Valutazioni
(4)
Progetti
7
43%
Arbitraggio
5
0% / 60%
In ritardo
3
43%
Gratuito
Pubblicati: 1 codice
2
Sviluppatore 2
Valutazioni
(34)
Progetti
80
34%
Arbitraggio
13
31% / 54%
In ritardo
19
24%
Gratuito
Ordini simili
"I need a high-quality, non-repainting TradingView indicator for Gold (XAUUSD) on the 1-minute timeframe. The goal is to catch 'Tops and Bottoms' using a combination of price exhaustion and candlestick confirmation. Key Requirements: The Signal: Must identify reversals at extremes. Please use a combination of Bollinger Bands (Standard Deviation) and RSI . Candlestick Confirmation: Signals should only fire if there is
Hi guys looking for a reversal indicator that places signals on chart Signals must he placed at candle close and not repaint. Since I'm offering a high budget I want everything to run smoothly in these steps 1. Send screenahots of it 2. I'll give you feedback what to change or we'll skip to stage 3 3. Short period demo 4. Deposite send full version and close deal. That will allow safety for both us I know I'm getting
Need to create a New EA that focuses only on closing trades of an Existing EA . The New EA should be attached to the Existing EA and also it should not interfere the functions of Existing EA. The developer of the New EA should provide guidelines in order to attach the New EA to the Existing EA. The existing EA will not be shared to the developer. The conditions of new EA is as follows: The new EA should close all
I’m looking for an experienced MQL4 / MQL5 developer to help with an indicator project. Project overview: I have an existing MT4 arrow indicator that I’ve used for several years. The indicator is compiled only (.ex4) — source code is not available. It does not repaint . The indicator has stopped displaying properly (likely outdated). What I need: Rebuild the indicator from scratch by analyzing its behavior and
HI Iam trading with XU ma simple BT 1.12 INDICATOR Which I got indicator from forexstation forum but mq4 file is not with me,I want to have similar indicator which is non repainting in both mq4 and mq5 formats,it should be similar and signals should match it has 2 moving averages MA1 IS LONG TERM MA,MA2 is short term MA MA 2 SIGNALS FOLLOW THE MA TREND CHANGE not crossing of MA1
I am looking for an experienced developer to build a TradingView Pine Script that generates trading signals and sends them via webhook to MT4 for automated execution. The trading logic must be handled entirely in TradingView (Pine Script) . MT4 will only be responsible for receiving webhook messages and executing trades (no strategy logic inside MT4). The goal is to ensure that TradingView backtest results and live
Hello I would like to modify the exit method of the trade for current expert advisor which include martingale trading. basically adjusting the position size and closing the trade. additional details will be provided in the next step
cần người tạo EA y thay đổi hình ảnh gửi đầy đủ tính năng như hình giá cả có thể tăng thêm khối lượng mong muốn viết giống hình không khác ROBOT HƠI NHIỀU TÍNH NĂNG MỌI NGƯỜI CÓ THỂ ĐƯA GIÁ THAM KHẢO
Project Overview I am looking for an experienced MT5 (MQL5) developer to modify an existing Account Protection EA and, if required, extend it with custom logic. This is NOT a strategy or trading EA . The EA is purely for risk management, drawdown protection, alerts, and trading lock , suitable for prop-firm and managed accounts . Core Requirements 1. Alerts & Monitoring Alert on trade entry and trade exit Alert when
Platform MetaTrader 4 or MetaTrader 5 (please specify which one you will develop) Indicator must work smoothly without lag or repainting Indicator Function Identify trend direction (Bullish / Bearish / Sideways) Provide clear Buy and Sell signals Optional confirmation using common logic (e.g. MA, RSI, ATR, or price action) Visual Display Buy signal: Arrow or label (customizable color) Sell signal: Arrow or label

Informazioni sul progetto

Budget
10 - 15 USD
Scadenze
da 1 a 2 giorno(i)