Morning_Fibonacci_v_1





//+------------------------------------------------------------------+
//|                                        Morning_Fibonacci_v_1.mq4 |
//|                                                              MVS |
//|             ICQ  588-948-516    ÏÈØÓ    ÑÎÂÅÒÍÈÊÈ    ÍÀ    ÇÀÊÀÇ |
//+------------------------------------------------------------------+
#property copyright "MVS"
#property link      "ICQ  588-948-516    ÏÈØÓ    ÑÎÂÅÒÍÈÊÈ    ÍÀ    ÇÀÊÀÇ"
//+-------------------------------------------------------------------
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Magenta
#property indicator_color2 Magenta
#property indicator_color3 Aqua
#property indicator_color4 Aqua
#property indicator_color5 Yellow
#property indicator_color6 Yellow
#property indicator_color7 Magenta
#property indicator_color8 Magenta
//+------------------------------------------------------------------- 
extern string OpenTime   = "01:00"; // Âðåìåííàÿ òî÷êà 1                               
extern string CloseTime  = "08:00"; // Âðåìåííàÿ òî÷êà 2
extern int    DaysBack   = 4;       // Êîëè÷åñòâî äíåé íàçàä (0-âñå)
extern bool   Fibo423    = false;   // Ïîêàçûâàòü Fibo423
extern bool   HLine      = true;    // Ïîêàçûâàòü òðåíäîâûå ëèíèè
extern color  colorLine  = Brown;   // Öâåò òðåíäîâîé ëèíèè
//+-------------------------------------------------------------------                          
double buf0[];
double buf100[];
double buf161[];
double buf261[];
double buf423[];
double buf_261[];
double buf_0.618[];
double buf_423[];
//+-------------------------------------------------------------------
void init() {
   SetIndexBuffer(0, buf0);
   SetIndexStyle (0, DRAW_LINE, STYLE_SOLID,2);
   SetIndexEmptyValue(0, EMPTY_VALUE);
   SetIndexLabel(0,"morning_channel");
   SetIndexBuffer(1, buf100);
   SetIndexStyle (1, DRAW_LINE, STYLE_SOLID,2);
   SetIndexEmptyValue(1, EMPTY_VALUE);
   SetIndexLabel(1,"morning_channel");
   SetIndexBuffer(2, buf_0.618);
   SetIndexStyle (2, DRAW_LINE, STYLE_SOLID,0 );
   SetIndexEmptyValue(2, EMPTY_VALUE);
   SetIndexLabel(2,"161");
   SetIndexBuffer(3, buf161);
   SetIndexStyle (3, DRAW_LINE, STYLE_SOLID,0 );
   SetIndexEmptyValue(3, EMPTY_VALUE);
   SetIndexLabel(3,"161");
   SetIndexBuffer(4, buf_261);
   SetIndexStyle (4, DRAW_LINE, STYLE_SOLID,0 );
   SetIndexEmptyValue(4, EMPTY_VALUE);
   SetIndexLabel(4,"261"); 
   SetIndexBuffer(5, buf261);
   SetIndexStyle (5, DRAW_LINE, STYLE_SOLID,0 );
   SetIndexEmptyValue(5, EMPTY_VALUE);
   SetIndexLabel(5,"261");
   SetIndexBuffer(6, buf423);
   SetIndexStyle (6, DRAW_LINE, STYLE_SOLID,0 );
   SetIndexEmptyValue(6, EMPTY_VALUE);
   SetIndexLabel(6,"423"); 
   SetIndexBuffer(7, buf_423);
   SetIndexStyle (7, DRAW_LINE, STYLE_SOLID,0 );
   SetIndexEmptyValue(7, EMPTY_VALUE);
   SetIndexLabel(7,"423");
   DeleteLines();   
for(int i=0; i<2; i++) 
   {
   ObjectCreate("Line"+i,OBJ_HLINE,0,0,0);
   }} 
//+-------------------------------------------------------------------
void deinit() 
   {
   DeleteLines();
   Comment("");
   }
//+-------------------------------------------------------------------
void DeleteLines() 
   {
   for(int i=0; i<2; i++) 
   {
   ObjectDelete("Line"+i);
   }}  
//+-------------------------------------------------------------------
void start() {
   double t1,t2,d1,d2;
   int amount,prevday=0,d=0,td=0,h1,h2,b1,b2;
if(Period()>60) 
   {
   Comment("Èíäèêàòîðó Morning_Fibonacci_v_1 íóæåí TF ìëàäøå H4!"); return;
   }
//------------------
if(DaysBack==0) amount=Bars-10;
   else 
   amount=DaysBack*1440/Period();
   amount=MathMin(Bars-10,amount);
for(int i=0; i<amount; i++) 
   {
if(td!=TimeDay (Time[i])) 
   {
   td =TimeDay (Time[i]);
   d++;      
if(d>DaysBack && DaysBack>0) return;
   h1=iBarShift(NULL, 0, StrToTime(TimeToStr(Time[i], TIME_DATE)+" "+OpenTime));
   h2=iBarShift(NULL, 0, StrToTime(TimeToStr(Time[i], TIME_DATE)+" "+CloseTime)+(Period()*60));
   t1=High[iHighest(NULL, 0, MODE_HIGH, h1-h2, h2+1)];
   t2=Low [iLowest (NULL, 0, MODE_LOW , h1-h2, h2+1)];
   }
if((h1>=i&&i>h2)||(h2>=i&&i>h1)) 
   {
if(prevday!=TimeDay(Time[i])) 
   {     
   buf0[i]=t1-(t1-t2)*0;
   buf100[i]=t1-(t1-t2)*1;
   buf_0.618[i]=t1-(t1-t2)*(-0.618);
   buf161[i]=t1-(t1-t2)*1.618;
   buf_261[i]=t1-(t1-t2)*(-1.618);
   buf261[i]=t1-(t1-t2)*2.618;
if(Fibo423==True){
   buf_423[i]=t1-(t1-t2)*(-3.236);
   buf423[i]=t1-(t1-t2)*4.236;}  
   }
   b1=iBarShift(NULL,0,StrToTime(TimeToStr(CurTime(),TIME_DATE)+" "+OpenTime));
   b2=iBarShift(NULL,0,StrToTime(TimeToStr(CurTime(),TIME_DATE)+" "+CloseTime));
   d1=High[iHighest(NULL,0,MODE_HIGH,b1-b2+1,b2)];
   d2=Low [iLowest (NULL,0,MODE_LOW ,b1-b2+1,b2)];
   SetLine(0, d1);
   SetLine(1, d2);}}}
//-----
void SetLine(int n,double dd) 
   {
if(HLine==true)   
if (dd!=EMPTY_VALUE) 
   {
   ObjectSet("Line"+n,OBJPROP_PRICE1, dd);
   ObjectSet("Line"+n,OBJPROP_COLOR,colorLine);
   }}
//-------------------------------------------------------------------------



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains the highest prices of each bar


Indicator Curves created:



Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: