0
Views
0
Downloads
0
Favorites
Stochastic_LSDs_MTF
//+------------------------------------------------------------------+
//| MTF_Stochastic.mq4 |
//| Copyright © 2006, Keris2112 |
//| |
//+------------------------------------------------------------------+
//2008fxtsd ki
#property copyright "Copyright © 2006, Keris2112"
#property link "http://www.forex-tsd.com"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Blue
#property indicator_color2 Maroon
#property indicator_color3 RoyalBlue
#property indicator_color4 Red
#property indicator_color5 DeepSkyBlue
#property indicator_maximum 100
#property indicator_minimum 0
#property indicator_level1 80
#property indicator_level2 50
#property indicator_level3 20
#property indicator_levelcolor DarkSlateGray
//----
extern int TimeFrame=60;
extern int KPeriod=8;
extern int DPeriod=3;
extern int Slowing=3;
extern int MAMethod=0;
extern int PriceField=0;
extern bool ShowLine =true;
extern bool ShowSection =true;
extern bool ShowDot =true;
extern bool ShiftToTFClose =true;
extern string PriceField_ = "0=Hi/Low 1=Close/Close";
extern string MA_Method_ = "SMA0 EMA1 SMMA2 LWMA3";
extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN";
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
//+------------------------------------------------------------------+
int init()
{
//----
IndicatorBuffers(5);
TimeFrame =MathMax(TimeFrame,Period());
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle (0,DRAW_NONE);
SetIndexStyle (1,DRAW_NONE);
if (ShowLine)
{
SetIndexStyle (0,DRAW_LINE);
SetIndexStyle (1,DRAW_LINE);
}
if (ShowSection)
{
SetIndexBuffer (2,ExtMapBuffer3);
SetIndexStyle (2,DRAW_SECTION);
SetIndexShift (2,0);
SetIndexStyle (3,DRAW_SECTION);
SetIndexBuffer (3,ExtMapBuffer4);
SetIndexShift (3,0);
}
if (ShowDot)
{
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexStyle (4,DRAW_ARROW);
SetIndexArrow (4,158); // 250 177 251
SetIndexShift (4,0);
SetIndexEmptyValue(4,EMPTY_VALUE);
}
if(ShiftToTFClose) { SetIndexShift(2,TimeFrame/Period()-1);
SetIndexShift(3,TimeFrame/Period()-1);
SetIndexShift(4,TimeFrame/Period()-1);
}
//----
switch(TimeFrame)
{
case 1 : string TimeFrameStr="M1"; break;
case 5 : TimeFrameStr="M5"; break;
case 15 : TimeFrameStr="M15"; break;
case 30 : TimeFrameStr="M30"; break;
case 60 : TimeFrameStr="H1"; break;
case 240 : TimeFrameStr="H4"; break;
case 1440 : TimeFrameStr="D1"; break;
case 10080 : TimeFrameStr="W1"; break;
case 43200 : TimeFrameStr="MN"; break;
default : TimeFrameStr="TF0";
}
IndicatorShortName("Stochastic ("+KPeriod+","+DPeriod+","+Slowing+") "+TimeFrameStr);
}
//----
return(0);
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,y,limit,counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars;
limit=MathMax(limit,TimeFrame/Period());
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
ExtMapBuffer1[i]=iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,y);
ExtMapBuffer2[i]=iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,y);
if(Time[i]==TimeArray[y]) { ExtMapBuffer3[i]=ExtMapBuffer1[i];
ExtMapBuffer4[i]=ExtMapBuffer2[i];
ExtMapBuffer5[i]=ExtMapBuffer1[i];
}
}
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
---