


//+------------------------------------------------------------------+
//| simple lines.mq4 |
//| Copyright 2023, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
#property copyright "H.L Lines Ind"
#property link "[عذراً, فقط الأعضاء يمكنهم مشاهدة الروابط ]"
#property description "H.L Lines"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red // Low / Minor
#property indicator_color2 Blue // High / Major
input ENUM_TIMEFRAMES frame=PERIOD_H4;
//--- input parameters
input int InpMinor=50; // Low
input int InpMajor=50; // High
//--- buffers
double ExtMinorBuffer[];
double ExtMajorBuffer[];
//---
int ExtBegin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit(void)
{
IndicatorDigits(Digits);
//---
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMinorBuffer);
SetIndexDrawBegin(0,InpMinor-1);
SetIndexLabel(0,"Minor");
//---
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMajorBuffer);
SetIndexDrawBegin(1,InpMajor-1);
SetIndexLabel(1,"Major");
//---
ExtBegin=InpMajor;
if(ExtBegin<InpMinor)
ExtBegin=InpMinor;
//--- initialization done
}
//+------------------------------------------------------------------+
//| H.L Indictor Lines |
//+------------------------------------------------------------------+
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[])
{
int i,k,pos;
double high_value,low_value;
perj=int(double(InpMajor)/double(Period())*frame);
pern=int(double(InpMinor)/double(Period())*frame);
if(rates_total<=InpMinor || rates_total<=InpMajor)
return(0);
//--- counting from 0 to rates_total
ArraySetAsSeries(ExtMinorBuffer,false);
ArraySetAsSeries(ExtMajorBuffer,false);
ArraySetAsSeries(open,false);
ArraySetAsSeries(high,false);
ArraySetAsSeries(low,false);
ArraySetAsSeries(close,false);
//--- initial zero
if(prev_calculated<1)
{
for(i=0; i<pern; i++)
ExtMinorBuffer[i]=0.0;
for(i=0; i<perj; i++)
ExtMajorBuffer[i]=0.0;
for(i=0; i<ExtBegin; i++)
}
//--- Minor
pos=pern-1;
if(prev_calculated>pern)
pos=prev_calculated-1;
for(i=pos; i<rates_total; i++)
{
high_value=high[i];
low_value=low[i];
k=i+1-pern;
while(k<=i)
{
if(high_value<high[k])
high_value=high[k];
if(low_value>low[k])
low_value=low[k];
k++;
}
ExtMinorBuffer[i]=high_value-((high_value-low_value)*0.1);
}
//--- Major
pos=perj-1;
if(prev_calculated>perj)
pos=prev_calculated-1;
for(i=pos; i<rates_total; i++)
{
high_value=high[i];
low_value=low[i];
k=i+1-perj;
while(k<=i)
{
if(high_value<high[k])
high_value=high[k];
if(low_value>low[k])
low_value=low[k];
k++;
}
ExtMajorBuffer[i]=low_value+((high_value-low_value)*0.1);
}
//---
return(rates_total);
}
//+------------------------------------------------------------------+
int pern;
int perj; 










المواضيع المتشابهه | ||||
| الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
| إعادت برمجة أكسبيرت من صنعك أخ سمير | basharbna | منتدى المؤشرات و الاكسبرتات | 36 | 23 - 12 - 2018 12:11 PM |
| فرص مؤشر الغلاف: (10\2 ديلي) | نمبر ون | منتدى تداول العملات العام | 3 | 29 - 01 - 2017 04:48 PM |
| برنامج صغيرجداً لإغلاق او إعادة تشغيل الكمبيوتر في ثوانى والمفاجئة برمجة عربية | موزة حمد | استراحة بورصات | 0 | 20 - 01 - 2013 10:58 AM |
| طلب برمجة مؤشر | theatco | منتدى المؤشرات و الاكسبرتات | 34 | 12 - 07 - 2010 01:15 AM |