Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
ma_tfx_Kamikaze2
//+------------------------------------------------------------------+
//| Kamikaze.mq4 |
//| Copyright © 2009, klentz |
//| periods are fixed: 5, 15, 30, 60 minutes |
//+------------------------------------------------------------------+
//mod
#property copyright "klentz"
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_color5 Blue
#property indicator_color6 Red
#property indicator_color7 Blue
#property indicator_color8 Red
#property indicator_minimum -0.5
#property indicator_maximum 5
extern int MA1 = 3;
extern int MA2 = 50;
extern int MAmode = 0;
extern int MAprice = PRICE_TYPICAL;
extern int TF1=5;
extern int TF2=15;
extern int TF3=60;
extern int TF4=120;
double buffer1[], buffer2[], buffer3[], buffer4[], buffer5[], buffer6[], buffer7[], buffer8[];
int init()
{
for (int i=0; i<8; i++)
{
SetIndexStyle(i,DRAW_ARROW); SetIndexArrow(i,110); SetIndexEmptyValue(i,EMPTY_VALUE);
}
SetIndexBuffer(0,buffer1); SetIndexBuffer(1,buffer2); SetIndexBuffer(2,buffer3); SetIndexBuffer(3,buffer4);
SetIndexBuffer(4,buffer5); SetIndexBuffer(5,buffer6); SetIndexBuffer(6,buffer7); SetIndexBuffer(7,buffer8);
return(0);
}
int start()
{
int limit;
int counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
limit = Bars - counted_bars;
for(int i = 0; i < limit; i++)
{
if (TF1==0)TF1=Period();
if (TF2==0)TF2=Period();
if (TF3==0)TF3=Period();
if (TF4==0)TF4=Period();
int SMAscale1= MathCeil (MA2*TF1/Period()); if (SMAscale1<=MA1)SMAscale1=MA1+1;
int SMAscale2= MathCeil (MA2*TF2/Period()); if (SMAscale2<=MA1)SMAscale2=MA1+1;
int SMAscale3= MathCeil (MA2*TF3/Period()); if (SMAscale3<=MA1)SMAscale3=MA1+1;
int SMAscale4= MathCeil (MA2*TF4/Period()); if (SMAscale4<=MA1)SMAscale4=MA1+1;
double sma1 = iMA(NULL, 0, MA1 , 0, MAmode, MAprice, i);
double sma21 = iMA(NULL, 0, SMAscale1 , 0, MAmode, MAprice, i);
double sma22 = iMA(NULL, 0, SMAscale2 , 0, MAmode, MAprice, i);
double sma23 = iMA(NULL, 0, SMAscale3 , 0, MAmode, MAprice, i);
double sma24 = iMA(NULL, 0, SMAscale4 , 0, MAmode, MAprice, i);
buffer1[i]=EMPTY_VALUE; buffer2[i]=EMPTY_VALUE; buffer3[i]=EMPTY_VALUE; buffer4[i]=EMPTY_VALUE;
buffer5[i]=EMPTY_VALUE; buffer6[i]=EMPTY_VALUE; buffer7[i]=EMPTY_VALUE; buffer8[i]=EMPTY_VALUE;
if (sma1-sma21 > 0) buffer1[i] = 4; else buffer2[i] = 4;
if (sma1-sma22 > 0) buffer3[i] = 3; else buffer4[i] = 3;
if (sma1-sma23 > 0) buffer5[i] = 2; else buffer6[i] = 2;
if (sma1-sma24 > 0) buffer7[i] = 1; else buffer8[i] = 1;
string name1= MA2+","+SMAscale1;
string name2= MA2+","+SMAscale2;
string name3= MA2+","+SMAscale3;
string name4= MA2+","+SMAscale4;
SetIndexLabel(0,name1);
SetIndexLabel(2,name2);
SetIndexLabel(4,name3);
SetIndexLabel(6,name4);
IndicatorShortName("ma1 "+MA1+", ma2 "+MA2+" ");
}
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
---