Miscellaneous
0
Views
0
Downloads
0
Favorites
MTF Volatility Pivot
///+------------------------------------------------------------------+
//| MTF_MACD_inColor.mq4 |
//| Copyright © 2006, Keris2112 |
//| 1June06 Stache added traditional view and 2-color Histogram |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Keris2112"
#property link "http://www.forex-tsd.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DarkSeaGreen
//---- input parameters
extern int TimeFrame=0;
extern double atr_range=100;
extern double ima_range = 10;
extern double atr_factor=3;
extern int Mode = 0;
extern double DeltaPrice = 30;
//---- buffers
double TrStop[];
double ATR[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(2);
SetIndexStyle(0, DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(0, TrStop);
SetIndexStyle(1, DRAW_NONE);
SetIndexBuffer(1, ATR);
SetIndexLabel(1,"range base");
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="ChartTimeframe";
}
string short_name;
short_name="#MTF_!! RisenbergVolatilityCapture";
IndicatorShortName(short_name+ " " + TimeFrameStr+ "");
}
//----
return(0);
//+------------------------------------------------------------------+
//| MTF MACD |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars+TimeFrame/Period();
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
/***********************************************************
Add your main indicator loop below. You can reference an existing
indicator with its iName or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use 'TimeFrame' for the indicator time frame
Rule 3: Use 'y' for your indicator's shift value
**********************************************************/
TrStop[i] = iCustom(NULL,TimeFrame,"Volatility Pivot",atr_range,ima_range,atr_factor,Mode,DeltaPrice,0,y);
ATR[i] = iCustom(NULL,TimeFrame,"Volatility Pivot",atr_range,ima_range,atr_factor,Mode,DeltaPrice,1,y);
}
if (TimeFrame>Period()) {
int PerINT=TimeFrame/Period()+1;
datetime TimeArr[]; ArrayResize(TimeArr,PerINT);
ArrayCopySeries(TimeArr,MODE_TIME,Symbol(),Period());
for(i=0;i<PerINT+1;i++) {if (TimeArr[i]>=TimeArray[0]) {
/********************************************************
Refresh buffers: buffer[i] = buffer[0];
********************************************************/
TrStop[i]= TrStop[0];
ATR[i] = ATR[0];
} } }
//++++++++++++++++++++++++++++++++++++++++++++++++ Raff
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
---