Back_In_Future

Author: 143alex+Sanyooooook
Price Data Components
Series array that contains open prices of each bar
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Back_In_Future
//+------------------------------------------------------------------+
//|                                             Nazad_v_buduchee.mq4 |
//|                                             Back_In_Future.mq4   |
//|                                                143alex@ramler.ru |
//+------------------------------------------------------------------+
#property copyright "143alex+Sanyooooook"
#property link      "143alex@ramler.ru"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int denBarShift=1;//Äåíü ïî ñ÷¸òó íàçàä

//---- buffers
double ExtMapBuffer1[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   
   SetIndexLabel(0,"Den"+denBarShift);

 IndicatorDigits(5);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   //int    
   double Bid1;
   double X1;
   double X2;
   double c1;
   double c2;
   double Razbeg1;
   
    //ÓÇÍÀ¨Ì ÖÅÍÛ îòêðûòèÿ íóëåâîãî è èíòåðåñóþùåãî äíåâíîãî áàðà
     X1=iOpen(NULL,1440,0);
     X2=iOpen(NULL,1440,denBarShift);
    //óçíà¸ì íà ñêîëüêî ñìåùàòüñÿ
     c1=iBarShift(NULL,1,iTime(NULL,PERIOD_D1,denBarShift));
     c2=iBarShift(NULL,1,iTime(NULL,PERIOD_D1,0));
     Print("ñìåùåíèå",(c1-c2));
     SetIndexShift(0,(c1-c2));
     //ÓÇÍÀ¨Ì ÐÀÇÍÈÖÓ 
     Razbeg1=X2-X1;
    
    
    
     //------------------------------------------------------------------ 

  //------------------------------------------------------------------ 
    
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   int i,limit, counted_bars = IndicatorCounted();
   int    k;
   
//----
   if(Bars <= 10100) 
       return(0);
//---- initial zero
   if(counted_bars < 1)
      for(i = 1;i <= 10100; i++) 
          ExtMapBuffer1[Bars-i] = 0.0;
//----
   i = Bars - 10100 - 1;
   if(counted_bars >= 10100) 
       i = Bars - counted_bars - 1;
//----
   while (i>0)
   {
      
         {
            if (Razbeg1<0)
   Bid1=Razbeg1*(-1)+iMA(NULL,1,2,0,3,5,i);
            if (Razbeg1>0)
   Bid1=iMA(NULL,1,2,0,3,5,i)-Razbeg1;
           
            ExtMapBuffer1[i]=NormalizeDouble(Bid1,Digits);
         }
      i--;
   }
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
  
   {
              if (Razbeg1<0)
   Bid1=Razbeg1*(-1)+iMA(NULL,1,2,0,3,5,0);
              if (Razbeg1>0)
   Bid1=iMA(NULL,1,2,0,3,5,0)-Razbeg1;
 
   ExtMapBuffer1[0]=NormalizeDouble(Bid1,Digits);
   }
  
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---