Simple multi-Time Frame conversion

MQL4 Indicateurs

Spécifications

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.


Dossiers :

Répondu

1
Développeur 1
Évaluation
(4)
Projets
7
43%
Arbitrage
5
0% / 60%
En retard
3
43%
Gratuit
Publié : 1 code
2
Développeur 2
Évaluation
(34)
Projets
80
34%
Arbitrage
13
31% / 54%
En retard
19
24%
Gratuit
Commandes similaires
can anyone help me with building a complete automated pine code strategy and indicator that work for both FXs & CFDs and have a high winning rate proved through back testing. I have a very complex current code that developed mostly using AI but lots of gaps are there although it translate exactly what I have in my mind. So, you are free to decide whether wo build a complete new code or fix my current working code ( i
Two EAs 30 - 100 USD
Hello, I will need one indicator in Tradingview converted to a strategy in MT5. The indicator is called ...Multi Kernel Regression [ChartPrime] Indicator. If the indicator says "BUY" then the EA buys, if the indicator says "SELL" then the EA sells. I will need another one that is a strategy in Tradingview converted to a strategy in MT5. "UT Bot Strategy". Two in total. Lets talk
I have build the trade copier for ninja trader as indicator. I need someone to fix the issue i am having or create new one similar to replicanto. here are my issue.. ### 1. Opposing Positions Across Multiple Accounts A counter trade violation occurs when you hold opposite directional positions (Buy vs. Sell) in the same symbol or product across different accounts. * *Example from your report:* In Violation #8
Hello. I am finding an experienced python developer who can implement my trading strategies into robots. I like trend-following swing trading strategies and am going to automate my idea. More details can be discussed by chatting. If you have similar working experience it can be a plus. Thanks
Job Title MT5 Developer Needed – Sync Data Feed Between Two MT5 Accounts Job Description I am a trader using multiple MT5 accounts and need a reliable way to have the same market data from one MT5 account reflected in another MT5 account. One account already has a stable and accurate data feed, and I want the second MT5 account to receive identical pricing and symbols for analysis and execution purposes. What I Need
Greeting Im in need of a programmer that can help me convert from TOS to trading view? The script is available with me, kindly bid if it is what you can do for me Thanks
can you help me with I need an ATM strategy for NT8, here's the criteria: Forex trade entry 100,000 units with a starting SL of 70 pips. The following proft targets: 33 pips, 68, 125, 180. All targets exit 25,000 units each. As each target is hit, move SL to BE+5, then BE+35, then BE+70. So the SL's are fixed, not trailing. I can't figure this out on my platform
"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

Informations sur le projet

Budget
10 - 15 USD
Délais
de 1 à 2 jour(s)