MobinMQL/Indicators/Class/week-2-ind-5.mq5
2025-07-22 14:48:34 +03:00

82 lines
3.4 KiB
MQL5

//+------------------------------------------------------------------+
//| ProjectName |
//| Copyright 2020, CompanyName |
//| http://www.companyname.net |
//+------------------------------------------------------------------+
input int birth_year ; // سال تولد
int calculate_age(int i_birth_year)
{
return 1404 - i_birth_year;
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnInit()
{
int age = calculate_age(birth_year);
if(age == 10){
Print( " You are 10" );
}else {
Print ( " you are not 10 ");
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnCalculate(const int32_t rates_total,
const int32_t prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int32_t &spread[])
{
//---
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+