Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
KPrmSt
//+------------------------------------------------------------------+
//| KPrmSt.mq4 |
//| Copyright © 2010, LeMan. |
//| b-market@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, LeMan."
#property link "b-market@mail.ru"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_level1 80.0
#property indicator_level2 50.0
#property indicator_level3 20.0
//---- input parameters
extern int Per1=14;
extern int Per2=3;
extern int Per3=3;
extern int Per4=5;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double TempBuffer[];
double MinBuffer[];
double MaxBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorDigits(Digits);
IndicatorBuffers(5);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,TempBuffer);
SetIndexBuffer(3,MinBuffer);
SetIndexBuffer(4,MaxBuffer);
SetIndexDrawBegin(0,Per1*3);
SetIndexDrawBegin(1,Per1*3);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i, limit, counted_bars = IndicatorCounted();
//----
if (Bars <= Per1) return(0);
if (counted_bars < 0) return(-1);
if (counted_bars > 0) counted_bars--;
i = Bars - 1;
if (counted_bars > 1) i = Bars - counted_bars - 1;
while (i >= 0) {
MaxBuffer[i] = iHigh(NULL, 0, iHighest(NULL, 0, MODE_HIGH, Per4, i));
MinBuffer[i] = iLow(NULL, 0, iLowest(NULL, 0, MODE_LOW, Per4, i));
i--;
}
limit = Bars - Per1 - 1;
for(i = limit; i >= 0; i--) {
int sh = ArrayMaximum(MaxBuffer,Per1,i);
int sl = ArrayMinimum(MinBuffer,Per1,i);
TempBuffer[i] = NormalizeDouble((Close[i]-MinBuffer[sl])/(MaxBuffer[sh]-MinBuffer[sl])*100,Digits);
}
for(i = 0; i < limit; i++) {
ExtMapBuffer1[i] = NormalizeDouble(iMAOnArray(TempBuffer, Bars, Per2, 0, MODE_EMA, i),Digits);
}
for(i = 0; i < limit; i++) {
ExtMapBuffer2[i] = NormalizeDouble(iMAOnArray(ExtMapBuffer1, Bars, Per3, 0, MODE_EMA, i),Digits);
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---