i_daymomentum_v1_1

Author: ExcStrategy
i_daymomentum_v1_1
Indicators Used
Momentum indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
i_daymomentum_v1_1
//+------------------------------------------------------------------+
//|                                                  DayMomentum.mq4 |
//|                                 Copyright 2010-2015, Excstrategy |
//|                                        http://www.ExcStrategy.ru |
//+------------------------------------------------------------------+
#property copyright "ExcStrategy"
#property link      "http://www.ExcStrategy.ru"
#property version   "1.1"
#property description "Momentum"
#property strict
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
#property indicator_width1 1 
//----
extern int Applied_price=0;
//----
extern int DaysForCalculation=2;
//---- buffers
double Buffer1[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(1);
//---- indicator lines
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Buffer1);
//---- 
   SetIndexLabel(0,"Momentum");
//---
   DaysForCalculation=DaysForCalculation+1;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   if(Period()>1400)
     {
      Alert("Error! Period can not be greater than D1");
      return(0);
     }
//----
   int counted_bars=IndicatorCounted();
   int barsday;
   bool rangeday;
   datetime Time1=Time[0],Time2;
//----
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
//----
   for(int i=0; i<limit; i++)
     {
      //----
      rangeday= false;
      barsday = 0;
      //----
      Time2=Time[i]+(1440*60*DaysForCalculation);
      if(Time1<Time2)
         if(i<Bars-MathRound(1500/Period()))
            for(int a=i; a<i+1441; a++)
              {
               //----
               barsday++;
               //----
               if(TimeDayOfYear(Time[a])!=TimeDayOfYear(Time[a+1])) a=i+1442;
              }
      //----
      Buffer1[i]=iMomentum(NULL,0,barsday,Applied_price,i);
     }
//----
   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 ---