PChannel Indicator For MT5
The PChannel Indicator For MT5 is a high-low channel indicator. It calculates the highest price high and the lowest price low for a defined time frame, and then plots two continuous lines to connect those highs and lows. When prices sustain above the upper line of PChannel Indicator For MT5, it signals market strength. Contrarily, when prices drop below the lower line, it suggests that bears have become the predominant market group.
Installing the PChannel Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file PChannel.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the PChannel Indicator For MT5
The PChannel Indicator For MT5 has 2 parameters to configure.
input uint PCPeriod=55;
input int Shift=0; // Ñäâèã èíäèêàòîðà ïî ãîðèçîíòàëè â áàðàõ
Buffers of the PChannel Indicator For MT5
The PChannel Indicator For MT5 provides 2 buffers.
SetIndexBuffer(0,ExtABuffer,INDICATOR_DATA);
SetIndexBuffer(1,ExtBBuffer,INDICATOR_DATA);
Main Parts Of The Code
int OnCalculate(
const int rates_total, // êîëè÷åñòâî èñòîðèè â áàðàõ íà òåêóùåì òèêå
const int 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 int &Spread[]
)
{
//---- ïðîâåðêà êîëè÷åñòâà áàðîâ íà äîñòàòî÷íîñòü äëÿ ðàñ÷¸òà
if(rates_total lt min_rates_total) return(0);
//---- Îáúÿâëåíèå öåëûõ ïåðåìåííûõ
int limit;
//---- ðàñ÷¸ò ñòàðòîâîãî íîìåðà limit äëÿ öèêëà ïåðåñ÷¸òà áàðîâ
if(prev_calculated gt rates_total || prev_calculated lt =0)// ïðîâåðêà íà ïåðâûé ñòàðò ðàñ÷¸òà èíäèêàòîðà
limit=rates_total-min_rates_total-1; // ñòàðòîâûé íîìåð äëÿ ðàñ÷¸òà âñåõ áàðîâ
else limit=rates_total-prev_calculated; // ñòàðòîâûé íîìåð äëÿ ðàñ÷¸òà òîëüêî íîâûõ áàðîâ
//---- èíäåêñàöèÿ ýëåìåíòîâ â ìàññèâàõ êàê â òàéìñåðèÿõ
ArraySetAsSeries(High,true);
ArraySetAsSeries(Low,true);
//---- îñíîâíîé öèêë ðàñ÷¸òà èíäèêàòîðà
for(int bar=limit; bar gt =0 && !IsStopped(); bar--)
{
ExtABuffer[bar]=High[ArrayMaximum(High,bar,PCPeriod)];
ExtBBuffer[bar]=Low[ArrayMinimum(Low,bar,PCPeriod)];
}
//----
return(rates_total);
}
//+------------------------------------------------------------------+