Hello I start in the mql4 code and I want to understand why my small program does not launch while the compilation shows no error!
(I’ve been stuck for 3 days)
Goal of the program:
Alerts the user that the stochastic oscillator of the M15 M30 H1 H4 timeframe of a symbol is on purchase or under purchase. The user can choose to set several currencies to be checked.
Here is the information MT4 sends me when I load the robots on a chart:
This is the script
//+------------------------------------------------------------------+//| FlashTrade_iStochastics.mq4 |//| Romeo caillon |//| https://www.mql5.com |//+------------------------------------------------------------------+#property copyright"Romeo caillon"#property link"https://www.mql5.com"#property version"1.00"#property strictinputstring symbol = "EURGBP;GBPUSD;USDJPY;USDCHF;AUDUSD;USDCAD;EURGBP;GBPJPY;AUDCAD;GOLD";
inputdouble stocIndiceHigh = 70.0;
inputdouble stocIndiceLow = 30.0;
inputdouble stocIndiceMaxHigh = 80.0;
inputdouble stocIndiceMaxLow = 20.0;
inputint minuteLockAlertLongTimeframe = 2;
string arraySymbol[];
int nbSymbol;
datetime inAlertTimer[];
datetime inBigAlertTimer[];
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//nbSymbol = CountItems(symbol);//Alert("nbSymbol = ",nbSymbol);//ArrayResize(arraySymbol,nbSymbol);//ArrayResize(inAlertTimer,nbSymbol);//ArrayResize(inBigAlertTimer,nbSymbol);
nbSymbol = StringSplit(symbol,';',arraySymbol);
ArrayFill(inAlertTimer,0,nbSymbol,TimeLocal());
ArrayFill(inBigAlertTimer,0,nbSymbol,TimeLocal());
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//---
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
Alert(ArraySize(arraySymbol));
//--- Loop all symbols to check stochastic ocsillation//---------------------------------------------------------------------for(int i = 0 ; i <= nbSymbol ; i++){
string symbolName = arraySymbol[i];
if(inBigAlertTimer[i] < TimeLocal()){
//printf("Vérifier gros Alert (0)");if(StocCalculate(15,symbolName) >= stocIndiceMaxHigh && StocCalculate(30,symbolName) >= stocIndiceMaxHigh && StocCalculate(60,symbolName) >= stocIndiceMaxHigh && StocCalculate(240,symbolName) >= stocIndiceMaxHigh){
Alert(symbolName + " est en sur achat !");
inBigAlertTimer[i] = TimeLocal() + minuteLockAlertLongTimeframe * 60;
}elseif(StocCalculate(15,symbolName) <= stocIndiceMaxLow && StocCalculate(30,symbolName) <= stocIndiceMaxLow && StocCalculate(60,symbolName) <= stocIndiceMaxLow && StocCalculate(240,symbolName) <= stocIndiceMaxLow) {
Alert(symbolName + " est en sous achat !");
inBigAlertTimer[i] = TimeLocal() + minuteLockAlertLongTimeframe * 60;
}
if(inAlertTimer[i] < TimeLocal()){
//printf("Vérifier si Petite Alert (1)");if(StocCalculate(15,symbolName) >= stocIndiceHigh && StocCalculate(30,symbolName) >= stocIndiceHigh && StocCalculate(60,symbolName) >= stocIndiceHigh && StocCalculate(240,symbolName) >= stocIndiceHigh){
Alert(symbolName + " se dirige vers un sur achat !");
inAlertTimer[i] = TimeLocal() + minuteLockAlertLongTimeframe * 60;
}elseif(StocCalculate(15,symbolName) <= stocIndiceLow && StocCalculate(30,symbolName) <= stocIndiceLow && StocCalculate(60,symbolName) <= stocIndiceLow && StocCalculate(240,symbolName) <= stocIndiceLow) {
Alert(symbolName + " se dirige vers un sous achat !");
inAlertTimer[i] = TimeLocal() + minuteLockAlertLongTimeframe * 60;
}
}
}elseif(inAlertTimer[i] < TimeLocal()){
//printf("Vérifier si Petite Alert (2)");if(StocCalculate(15,symbolName) >= stocIndiceHigh && StocCalculate(30,symbolName) >= stocIndiceHigh && StocCalculate(60,symbolName) >= stocIndiceHigh && StocCalculate(240,symbolName) >= stocIndiceHigh){
Alert(symbolName + " se dirige vers un sur achat !");
inAlertTimer[i] = TimeLocal() + minuteLockAlertLongTimeframe * 60;
}elseif(StocCalculate(15,symbolName) <= stocIndiceLow && StocCalculate(30,symbolName) <= stocIndiceLow && StocCalculate(60,symbolName) <= stocIndiceLow && StocCalculate(240,symbolName) <= stocIndiceLow) {
Alert(symbolName + " se dirige vers un sous achat !");
inAlertTimer[i] = TimeLocal() + minuteLockAlertLongTimeframe * 60;
}
}
}
}
//+------------------------------------------------------------------+//+------------------------------------------------------------------+//| Calculate the stochasic | //+------------------------------------------------------------------+ double StocCalculate(int timeFrame,string symbol_)
{
return(iStochastic(symbol_,timeFrame,5,3,3,MODE_SMA,0,MODE_MAIN,0));
}
//+------------------------------------------------------------------+ //+------------------------------------------------------------------+//| Count ";" in input symbol data |//+------------------------------------------------------------------+ int CountItems(string str)
{
int n=0;
int a = StringLen(str);
for(int i=0 ; i<=a ; i++)
{
if(StringSubstr(str,i,1) == ";")
{
n++;
}
}
return(n);
}
//+------------------------------------------------------------------+
Hello I start in the mql4 code and I want to understand why my small program does not launch while the compilation shows no error!
(I’ve been stuck for 3 days)
Goal of the program:
Alerts the user that the stochastic oscillator of the M15 M30 H1 H4 timeframe of a symbol is on purchase or under purchase. The user can choose to set several currencies to be checked.
Here is the information MT4 sends me when I load the robots on a chart:
This is the script