-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbulls_bears.mq5
24 lines (24 loc) · 969 Bytes
/
bulls_bears.mq5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
input int NumCandles=1000;
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
int bulls=0,bears=0;
double op[],cl[];
int sp[];
if(CopyOpen(_Symbol,PERIOD_CURRENT,0,NumCandles,op)<0) return;
if(CopyClose(_Symbol,PERIOD_CURRENT,0,NumCandles,cl)<0) return;
if(CopySpread(_Symbol,PERIOD_CURRENT,0,NumCandles,sp)<0) return;
for(int i=0; i<NumCandles; i++)
{
if(cl[i]-op[i]>sp[i]*_Point) bulls++;
if(op[i]-cl[i]>sp[i]*_Point) bears++;
}
MessageBox(_Symbol+" "+StringSubstr(EnumToString(_Period),7)+"\n"+
"Candles "+IntegerToString(NumCandles)+"\n"+
"Bulls "+IntegerToString(bulls)+"\n"+
"Bears "+IntegerToString(bears));
}
//+------------------------------------------------------------------+