النتائج 16 إلى 18 من 18
الموضوع: شمعة اليوم يومين؟
- 02-09-2017, 12:21 AM #16
تمام كذا معاك على الخط
- 02-09-2017, 02:34 AM #17
- 02-09-2017, 02:58 AM #18
كود PHP:#property indicator_chart_window
#property indicator_buffers 8
color Bull_Color1=clrGreen;
color Bear_Color1=clrOrange;
color Bull_Color2=clrLime;
color Bear_Color2=clrRed;
double High_or_Low_Buffer_1[];
double Low_or_High_Buffer_1[];
double Close_Buffer_1[];
double Open_Buffer_1[];
double High_or_Low_Buffer_21[];
double Low_or_High_Buffer_21[];
double Close_Buffer_21[];
double Open_Buffer_21[];
int OnInit()
{
ObjectsDeleteAll();
ChartSetInteger(0,CHART_FOREGROUND,0,FALSE);
ChartSetInteger(0,CHART_COLOR_BACKGROUND,clrBlack);
ChartSetInteger(0,CHART_COLOR_CHART_LINE,ChartGetInteger(0,CHART_COLOR_BACKGROUND));
ChartSetInteger(0,CHART_MODE,CHART_LINE);
ChartSetInteger(0,CHART_SHOW_GRID,0,TRUE);
ChartSetInteger(0,CHART_SHOW_OHLC,0,TRUE);
ChartSetInteger(0,CHART_SHOW_BID_LINE,0,TRUE);
SetIndexBuffer(0,High_or_Low_Buffer_1);
SetIndexBuffer(1,Low_or_High_Buffer_1);
SetIndexBuffer(2,Close_Buffer_1);
SetIndexBuffer(3,Open_Buffer_1);
SetIndexBuffer(4,High_or_Low_Buffer_21);
SetIndexBuffer(5,Low_or_High_Buffer_21);
SetIndexBuffer(6,Close_Buffer_21);
SetIndexBuffer(7,Open_Buffer_21);
SetIndexStyle(0,DRAW_HISTOGRAM,DRAW_LINE,1,Bull_Color1);
SetIndexStyle(1,DRAW_HISTOGRAM,DRAW_LINE,1,Bear_Color1);
SetIndexStyle(2,DRAW_HISTOGRAM,DRAW_LINE,10,Bull_Color1);
SetIndexStyle(3,DRAW_HISTOGRAM,DRAW_LINE,10,Bear_Color1);
SetIndexStyle(4,DRAW_HISTOGRAM,DRAW_LINE,1,Bull_Color2);
SetIndexStyle(5,DRAW_HISTOGRAM,DRAW_LINE,1,Bear_Color2);
SetIndexStyle(6,DRAW_HISTOGRAM,DRAW_LINE,10,Bull_Color2);
SetIndexStyle(7,DRAW_HISTOGRAM,DRAW_LINE,10,Bear_Color2);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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[])
{
double Open_1,High_1,Low_1,Close_1;
double Open_21,High_21,Low_21,Close_21;
int BarsCount=WindowBarsPerChart()+1;
Comment(Bars);
for(int i=0; i<=Bars; i++)
{
//if(i!=0)
{
datetime FROM = StringToTime(TimeToStr(iTime(NULL,PERIOD_D1,i),TIME_DATE)+" 15:00");
datetime TOTO = StringToTime(TimeToStr(iTime(NULL,PERIOD_D1,i),TIME_DATE)+" 18:00");
int totoH1=iBarShift(NULL,PERIOD_H1,TOTO);
int fromH1=iBarShift(NULL,PERIOD_H1,FROM);
Open_1 = iOpen( NULL,PERIOD_H1,fromH1);
Close_1 = iClose( NULL,PERIOD_H1,totoH1);
High_1 = iHigh ( NULL,PERIOD_H1,iHighest(NULL,PERIOD_H1,MODE_HIGH, fromH1-totoH1+1,totoH1));
Low_1 = iLow( NULL,PERIOD_H1,iLowest( NULL,PERIOD_H1,MODE_LOW, fromH1-totoH1+1,totoH1));
if(Open_1<Close_1)
{
High_or_Low_Buffer_1[i]=High_1;
Low_or_High_Buffer_1[i]=Low_1;
}
else
{
High_or_Low_Buffer_1[i]=Low_1;
Low_or_High_Buffer_1[i]=High_1;
}
Close_Buffer_1[i]=Close_1;
Open_Buffer_1[i]=Open_1;
}
//if(i!=0)
{
datetime FROM1 = StringToTime(TimeToStr(iTime(NULL,PERIOD_D1,i),TIME_DATE)+" 00:00");
datetime TOTO1 = StringToTime(TimeToStr(iTime(NULL,PERIOD_D1,i),TIME_DATE)+" 10:00");
int totoH21=iBarShift(NULL,PERIOD_H1,TOTO1);
int fromH21=iBarShift(NULL,PERIOD_H1,FROM1);
Open_21 = iOpen( NULL,PERIOD_H1,fromH21);
Close_21 = iClose( NULL,PERIOD_H1,totoH21);
High_21 = iHigh ( NULL,PERIOD_H1,iHighest(NULL,PERIOD_H1,MODE_HIGH, fromH21-totoH21+1,totoH21));
Low_21 = iLow( NULL,PERIOD_H1,iLowest( NULL,PERIOD_H1,MODE_LOW, fromH21-totoH21+1,totoH21));
if(Open_21<Close_21)
{
High_or_Low_Buffer_21[i]=High_21;
Low_or_High_Buffer_21[i]=Low_21;
}
else
{
High_or_Low_Buffer_21[i]=Low_21;
Low_or_High_Buffer_21[i]=High_21;
}
Close_Buffer_21[i]=Close_21;
Open_Buffer_21[i]=Open_21;
}
}
/////////////////
return(rates_total);
}