Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
ma_TemaTma_rlh_smzDS
//+------------------------------------------------------------------+
//| TEMA_RLH |
//| Copyright © 2006, Robert Hill |
//| http://www.metaquotes.net/ |
//| |
//| Based on the formula developed by Patrick Mulloy |
//| |
//| It can be used in place of EMA or to smooth other indicators. |
//| |
//| TEMA = 3 * EMA - 3 * (EMA of EMA) + EMA of EMA of EMA |
//| |
//| Red is EMA, Green is EMA of EMA, Yellow is Ema of Ema of Ema |
//| Aqua is TEMA |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Robert Hill "
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Yellow
#property indicator_color2 Orange
#property indicator_color3 Red
#property indicator_color4 Aqua
#property indicator_color5 Blue
#property indicator_color6 RoyalBlue
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_width4 1
#property indicator_width5 1
#property indicator_width6 2
#property indicator_style1 2
#property indicator_style2 2
#property indicator_style3 2
#property indicator_style4 0
#property indicator_style5 0
#property indicator_style6 0
//----
extern int MA_Period =13;
extern int MA_Mode =3;
extern int MA_Price =PRICE_TYPICAL;
extern string MA_Method_Price = "SMA0 EMA1 SMMA2 LWMA3||0O,1C 2H3L,4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";
extern int smz_Period =3;
extern int smz_Mode =3;
extern bool showTemaSmz = true;
extern int ds_Period =3;
extern int ds_Mode =3;
extern int ds_Shift =1;
extern bool drawmas = false;
//---- buffers
double Ema[];
double EmaOfEma[];
double EmaOfEmaOfEma[];
double Tema[];
double Temasl[];
double Temads[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
if (drawmas) int draw = DRAW_LINE; else draw = DRAW_NONE;
SetIndexStyle(0,draw);
SetIndexStyle(1,draw);
SetIndexStyle(2,draw);
SetIndexStyle(3,draw);
SetIndexStyle(4,draw);
if(showTemaSmz)
SetIndexStyle(4,DRAW_LINE);
SetIndexStyle(5,DRAW_LINE);
SetIndexShift(5,ds_Shift);
SetIndexDrawBegin(0,MA_Period);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);
//---- 3 indicator buffers mapping
if(!SetIndexBuffer(0,Ema) &&
!SetIndexBuffer(1,EmaOfEma) &&
!SetIndexBuffer(2,EmaOfEmaOfEma) &&
!SetIndexBuffer(3,Tema)&&
!SetIndexBuffer(4,Temasl)&&
!SetIndexBuffer(5,Temads))
Print("cannot set indicator buffers!");
// if(!SetIndexBuffer(0,Tema) )
// Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName(" TMA ("+MA_Period+","+MA_Mode+";" +smz_Period+"," +ds_Period+") ");
// Tema[i]=3 * Ema[i] - 3 * EmaOfEma[i] + EmaOfEmaOfEma[i];
SetIndexLabel(0,"ma");
SetIndexLabel(1,"maofma");
SetIndexLabel(2,"maOfmaOfma");
SetIndexLabel(3,"tma");
SetIndexLabel(4,"tma sigln");
SetIndexLabel(5,"tma ds");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i, limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i=limit; i>=0; i--)
Ema[i]=iMA(NULL,0,MA_Period,0,MODE_EMA,PRICE_CLOSE,i);
for(i=limit; i >=0; i--)
EmaOfEma[i]=iMAOnArray(Ema,Bars,MA_Period,0,MODE_EMA,i);
for(i=limit; i >=0; i--)
EmaOfEmaOfEma[i]=iMAOnArray(EmaOfEma,Bars,MA_Period,0,MA_Mode,i);
//==========
for(i=limit; i >=0; i--)
Tema[i]=3 * Ema[i] - 3 * EmaOfEma[i] + EmaOfEmaOfEma[i];
for(i=limit; i >=0; i--)
Temasl[i]=iMAOnArray(Tema,Bars,smz_Period,0,smz_Mode,i);
for(i=limit; i >=0; i--)
Temads[i]=iMAOnArray(Temasl,Bars,ds_Period,0,ds_Mode,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
---