Miscellaneous
0
Views
0
Downloads
0
Favorites
ATRstops_v1.1_MTF
//+------------------------------------------------------------------+
//| MTF_ATRstop_v1.1.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
//2008fxtsd
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue
#property indicator_color2 DeepPink
#property indicator_width1 2
#property indicator_width2 2
extern int TimeFrame=0;
extern int Length=10;
extern int ATRperiod=5;
extern double Kv=2.5;
extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double smin[];
double smax[];
double trend[];
//--
int init()
{
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexDrawBegin(0,Length);
SetIndexDrawBegin(1,Length);
//---
TimeFrame = MathMax(TimeFrame,Period());
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="MN1"; break;
default : TimeFrameStr ="TF0";
}
string short_name;
short_name="ATRstops("+Length+","+ATRperiod+","+Kv+")["+TimeFrameStr+"]";
IndicatorShortName(short_name);
SetIndexLabel(0,"Up "+short_name);
SetIndexLabel(1,"Dn "+short_name);
}
return(0);
//----
int start()
{
datetime TimeArray[];
int i,limit,y=0,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]=iCustom(NULL,TimeFrame,"ATRStops_v1.1",Length,ATRperiod,Kv,0,y);
ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"ATRStops_v1.1",Length,ATRperiod,Kv,1,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
---