hello thanks for share !!! i have a problem because it just working in 5m time frame . In 15m 1h doesn't work . Have some one any idea ?
thanks
Hi I downloaded you indicator and trying to read the value but I am getting "Array out of range" error.
Could you please help me. Thanks
//+------------------------------------------------------------------+
//| Custom_Indicator_EA.mq5 |
//| Copyright 2022, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
#define BreakIndicator "Indicators\\Breakout.ex5"
#resource "\\" + BreakIndicator;
int break_handle;
input ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT;
double upperPeriod[], lowerPeriod[];
double upperArea[], lowerArea[];
int OnInit()
{
//--- create handle of the indicator iCustom
break_handle= iCustom(_Symbol, TimeFrame, "::" + BreakIndicator); //, 0 ,0,5,0,23,0,0);
//--- if the handle is not created
if(break_handle==INVALID_HANDLE)
{
//--- tell about the failure and output the error code
PrintFormat("Failed to create handle of the iCustom indicator for the symbol %s/%s, error code %d",
Symbol(),
EnumToString(Period()),
GetLastError());
//--- the indicator is stopped early
return(INIT_FAILED);
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
IndicatorRelease(break_handle);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
ArraySetAsSeries(upperPeriod,true);
//ArraySetAsSeries(lowerPeriod,true);
//ArraySetAsSeries(upperArea,true);
//ArraySetAsSeries(lowerArea,true);
//--- get the data from the indicators buffer and copy it
CopyBuffer(break_handle , 0, 0, 0, upperPeriod);
//CopyBuffer(break_handle, 0, 0, 0, upperPeriod);
//CopyBuffer(break_handle, 1, 1, 1, lowerPeriod);
//CopyBuffer(break_handle, 0, 0, 0, upperArea);
//CopyBuffer(break_handle, 1, 0, 1, lowerArea);
//We calculate the value of the current candle
double value = upperPeriod[1];
double value2 = upperPeriod[1];
//double value3 = upperPeriod[2];
//double value4 = upperPeriod[3];
Comment(
"\nBreak_handle: ", break_handle,
"\nUpper Value is : ", value,
"\nUpper Value is : ", value2
//"\nUpper Period: ", upperPeriod[0]
// "\nLower Period: ", lowerPeriod[0]
// "\nUpper Area: ", upperArea[0],
// "\nLower Area: ", lowerArea[0]
) ;
}
- 2022.10.12
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Breakout:
The "area" zone begins right after the end of the "period" zone
It has five input parameters:
Author: Scriptor