Mira cómo descargar robots gratis
¡Búscanos en Facebook!
Pon "Me gusta" y sigue las noticias
¿Es interesante este script?
Deje un enlace a él, ¡qué los demás también lo valoren!
¿Le ha gustado el script?
Evalúe su trabajo en el terminal MetaTrader 5
Scripts

Get Last Round Time And Date Acc To TF - script para MetaTrader 4

IronFist
Publicado por:
Kailash Bai Mina
Visualizaciones:
2955
Ranking:
(10)
Publicado:
2021.08.18 00:28
Actualizado:
2021.08.25 20:18
Code.mq4 (1.44 KB) ver
¿Necesita un robot o indicador basado en este código? Solicítelo en la bolsa freelance Pasar a la bolsa

This Custom Function Will Help To Get Round Time For Any Given Timeframe And Time.


Code :-

//+------------------------------------------------------------------+
//|Get Last Round Time And Date Acc To TF                            |
//+------------------------------------------------------------------+
datetime Get_Last_Round_Time_And_Date_Acc_To_TF(datetime From, int TimeFrame)
{
int Minutes = ((int)From - (int)(datetime)(TimeToString(From,TIME_DATE)+" 00:00:00"))/60;
int Min = Minutes-(Minutes%TimeFrame); string Date = "1970.01.01"; string _Hour_ = (string)((Min-Min%60)/60); string _Minutes_ = (string)((Min%60)%60);
return((datetime)TimeToString(From,TIME_DATE) + (datetime)(Date+" "+_Hour_+":"+_Minutes_+":00"));
}

Inputs Required : 

1.) Time To Be Rounded.
2.) Timeframe According To Which You Want Time To Be Rounded.


Few Examples : 

A.) 
     Inputs : 
                1.) Time = "2021.08.25 10:43:00".
                2.) Timeframe = 60.
     Returned Value :   "2021.08.25 10:00:00"

B.) 
     Inputs : 
                1.) Time = "2021.08.25 10:43:00".
                2.) Timeframe = 30.
     Returned Value :   "2021.08.25 10:30:00"

C.) 
     Inputs : 
                1.) Time = "2021.08.25 10:43:00".
                2.) Timeframe = 15.
     Returned Value :   "2021.08.25 10:30:00"

D.) 
     Inputs : 
                1.) Time = "2021.08.25 10:43:00".
                2.) Timeframe = 5.
     Returned Value :   "2021.08.25 10:40:00"


This Code Has Only Been Tested For 5,15,30,60 Minutes Time Frame.


Contact Me For Any Help. Will Be Happy To Help.

    Directional volatility & volume oscillator Directional volatility & volume oscillator

    Displays direction of volatility and volume

    Zone Recovery Hedge EA Zone Recovery Hedge EA

    Turn your losing trade into winning trade with Zone Recovery Hedge

    Get Comma Separated Things From String Get Comma Separated Things From String

    Custom Function To Get Comma Separated Things From String.

    SCT - RiskPerTrade- MT4 SCT - RiskPerTrade- MT4

    Building good trading habits by seeing things in terms of percentage not in terms of money.