Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
cd
//+------------------------------------------------------------------+
//| cd.mq4 |
//| neo |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "neo"
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 MediumSeaGreen
extern int SHORTPERIOD=20;
extern int LONGPERIOD=200;
//---- buffers
double KK[];
double MM[];
double JC[];
double SC[];
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexBuffer(0,JC);
SetIndexStyle(1,DRAW_ARROW);
SetIndexBuffer(1,SC);
SetIndexArrow(0,233);
SetIndexArrow(1,234);
SetIndexLabel(0,"upcross");
SetIndexLabel(1,"downcross");
return(0);
}
int deinit()
{
//----
//----
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
int limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//-----------------------------------------------------------------
for(int i=0; i<limit; i++)
{
KK[i]=100*iMA(NULL,0,SHORTPERIOD,0,MODE_EMA,PRICE_CLOSE,i)/iMA(NULL,0,LONGPERIOD,0,MODE_EMA,PRICE_CLOSE,i);
}
for(int h=0; h<limit; h++)
{
MM[h]=iMAOnArray(KK,0,7,0,MODE_SMA,h);
}
for(int n=limit-1; n>0; n--)
{
if(KK[n]>100 && KK[n+1]<MM[n+1] && KK[n]>MM[n]) JC[n]=Close[n];
if(KK[n]>100 && KK[n+1]>MM[n+1] && KK[n]<MM[n]) SC[n]=Close[n];
}
Print(KK[1]);
//----
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
---