Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Sem Force
//+------------------------------------------------------------------+
//| Áîëüøàÿ Êîëëåêöèÿ Ñåìàôîðîâ.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ñåðãååâ Àëåêñåé (ñ) 2007"
#property indicator_separate_window
#property indicator_minimum -110
#property indicator_maximum 110
#property indicator_buffers 4
#property indicator_color1 Crimson
#property indicator_color2 LimeGreen
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 1
#property indicator_width4 2
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID
#property indicator_style3 STYLE_DOT
#property indicator_style4 STYLE_SOLID
extern int PeriodStep=10; // Øàã ïåðèîäà ñêîëüçÿùèõ
extern int Slowing=3; // Çàìåäëåíèå îñíîâíîé ëèíèè (ñèãíàëüíàÿ ëèíèÿ)
extern int CountBar=5000; //ñêîëüêî áàðîâ ñ÷èòàòü
extern int Mode=MODE_SMA; //0-sma, 1-ema, 2-smma, 3-lwma
extern int Price=PRICE_CLOSE; //0-close, 1-open, 2-high, 3-low, 4-median, 5-typic, 6-wieight
//---- buffers
double Buy[];
double Sell[];
double buffer[];
double Signal[];
void init()
{
SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(0,Sell);
SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexBuffer(1,Buy);
SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,buffer); SetIndexLabel(2,"Value");
SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,Signal); SetIndexLabel(3,"Signal");
IndicatorShortName("Ñèëà òðåíäà ("+PeriodStep +","+Slowing+")");
return(0);
}
void start()
{
int value, i;
int step=1; if (PeriodStep>1) step=PeriodStep;
double x0, x1, x2, x3, x4, x5, x6;
for (i=0; i<=CountBar; i++)
{
x0=Close[i];
x1=iMA(NULL,0,1*step,0,Mode,Price,i);
x2=iMA(NULL,0,2*step,0,Mode,Price,i);
x3=iMA(NULL,0,3*step,0,Mode,Price,i);
x4=iMA(NULL,0,4*step,0,Mode,Price,i);
x5=iMA(NULL,0,5*step,0,Mode,Price,i);
x6=iMA(NULL,0,6*step,0,Mode,Price,i);
value=0;
if (x1<x0) value++;
if (x2<x0) value++;
if (x3<x0) value++;
if (x4<x0) value++;
if (x5<x0) value++;
if (x6<x0) value++;
if (x1>x0) value--;
if (x2>x0) value--;
if (x3>x0) value--;
if (x4>x0) value--;
if (x5>x0) value--;
if (x6>x0) value--;
buffer[i]=100*value/6;
}
for (i=0; i<=CountBar; i++) Signal[i]=iMAOnArray(buffer,0,Slowing,0,Mode,i);
bool b=false, s=false;
for (i=CountBar-1; i>=0; i--)
{
Buy[i]=0.0; Sell[i]=0.0;
if (Signal[i]>buffer[i]) { Sell[i] = Signal[i]; b=false; s=true; } //ïðîäàåì
else
if (Signal[i]<buffer[i]) { Buy[i] = Signal[i]; b=true; s=false;}//ïîêóïàåì
else
{
if (b) Buy[i]=Signal[i];
if (s) Sell[i]=Signal[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
---