iMomentum.Gap

Indicators Used
Momentum indicator
0 Views
0 Downloads
0 Favorites
iMomentum.Gap
/*
âûçîâ èç êîäîâ - ñòàíäàðòíûå ïîëÿ + ïîëå Gap
double iCustom(
   string symbol,       // ñèìâîëüíîå èìÿ èíñòðóìåíòà (NULL- òåêóùèé)
   int timeframe,       // òàéì-ôðåéì (0- òåêóùèé)
   "iMomentum.Gap",     // èìÿ ýòîãî èíäèêàòîðà
   //
   int period,          // ïåðèîä Momentum
   int applied_price,   // òèï öåíû:
                           // 0 - PRICE_CLOSE - öåíà çàêðûòèÿ 
                           // 1 - PRICE_OPEN - öåíà îòêðûòèÿ
                           // 2 - PRICE_HIGH - ìàêñ.öåíà
                           // 3 - PRICE_LOW - ìèí.öåíà
                           // 4 - PRICE_MEDIAN - ñðåäíÿÿ öåíà,(high+low)/2
                           // 5 - PRICE_TYPICAL - òèïè÷íàÿ öåíà,(high+low+close)/3
                           // 6 - PRICE_WEIGHTED - âçâåøåííàÿ öåíà çàêðûòèÿ,(high+low+close+close)/4
                           // 7 - îáúåì
   int GapPoints,       // ïîðîã èäåíòèôèêàöèè ãýïà â ïï.
   //
   int mode,            // mode - íîìåð áóôåðà èíäèêàòîðà (0)
   int shift            // ñäâèã
   ) 

==============

iCustom(NULL,0,"iMomentum.Gap",MomentumPeriod,Price,GapPoints, 0,i);
*/

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
// âõîäíûå ïàðàìåòðû
extern int MomentumPeriod=14; // ïåðèîä RSI
extern int Price=0; // òèï öåíû
extern int GapPoints=0; // ïîðîã èäåíòèôèêàöèè ãýïà â ïï.
 int GapHours=8; // ïîðîã ïî âðåìåíè â ÷àñàõ (>0) èëè â ìèíóòàõ (<0)
// ìàññèâû áóôåðîâ
double Ind[]; // áóôåð èíäèêàòîðà
double price[]; // áóôåð áåçãýïîâûõ êîòèðîâîê

void init() {
   // êîðîòêîå èìÿ
   string short_name="Mmntm("+MomentumPeriod+")";
   IndicatorShortName(short_name);   
   // áóôåðû
   SetIndexBuffer(0,Ind); // áóôåð èíäèêàòîðà
   SetIndexLabel(0,short_name);
   SetIndexDrawBegin(0,MomentumPeriod);
   IndicatorBuffers(2); 
   SetIndexBuffer(1,price); // áóôåð áåçãýïîâûõ êîòèðîâîê
  }

void start() {
   // ãðàíèöà ïåðåñ÷åòà
   int limit=Bars-IndicatorCounted()-1;  
   if(limit>1) limit=Bars-1; 
   // çàïîëíåíèå ìàññèâà áåçãýïîâûìè êîòèðîâêàìè
   for(int i=limit; i>=0; i--) price[i]=iCustom(NULL,0,"KillGap",GapPoints,GapHours,Price, 0,i); 
   // ðàñ÷åò èíäèêàòîðà ïî ìàññèâó
   for(i=limit; i>=0; i--) Ind[i]=iMomentumOnArray(price,Bars,MomentumPeriod,i);
  }

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 ---