Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
zscore_mtf
//+------------------------------------------------------------------+
//| zscore.mq4 |
//| mtf fx tsd ki modulatum |
//+------------------------------------------------------------------+
// C-MA(C,60)/ Stddev(C,60) normalizes price over a period60
#property copyright "Mod"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DeepSkyBlue
#property indicator_level1 2
#property indicator_level2 1
#property indicator_level3 -1
#property indicator_level4 -2
#property indicator_levelcolor DarkSlateGray
//---- input parameters
extern int TimeFrame = 0;
extern int Period_ = 20;
extern int barsToCount = 2000;
extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
//---- buffers
double zscore[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(1);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,zscore);
//----
IndicatorShortName("zscore ["+TimeFrame+"]");
if (TimeFrame<Period())TimeFrame=Period();
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit= Bars-counted_bars;
limit= MathMax(limit,TimeFrame/Period());
limit= MathMin(limit,barsToCount);
//----
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
// for(int i = 0 ;i <= limit-20 ;i++)
// {
zscore[i] = (iClose(NULL,TimeFrame,y)-iMA(NULL,TimeFrame,Period_,0,0,0,y))/iStdDev(NULL,TimeFrame,Period_,0,0,0,y);
}
//----
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
---