Indicators Used
0
Views
0
Downloads
0
Favorites
test_cross
//+------------------------------------------------------------------+
//| test_cross.mq4 |
//| Copyright 2015, galladion |
//| https://vk.com/id1398982 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, galladion"
#property link "https://vk.com/id1398982"
#property version "1.00"
#property strict
#property script_show_inputs
#include <cross.mqh>
extern int Fast_MA = 12;
extern int Slow_MA = 120;
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
int k=0;
for (int i=0;i<=Bars-1;i++)
{
double Fast_MA_0 = iMA(NULL,0,Fast_MA,0,MODE_EMA,PRICE_CLOSE,i);
double Fast_MA_1 = iMA(NULL,0,Fast_MA,0,MODE_EMA,PRICE_CLOSE,i+1);
double Slow_MA_0 = iMA(NULL,0,Slow_MA,0,MODE_EMA,PRICE_CLOSE,i);
double Slow_MA_1 = iMA(NULL,0,Slow_MA,0,MODE_EMA,PRICE_CLOSE,i+1);
int j = cross(Fast_MA_0,Fast_MA_1,Slow_MA_0,Slow_MA_1);
if (j == 0) continue;
if (j == 1)
{
ObjectCreate((string)k,OBJ_VLINE,0,Time[i],0);
ObjectSetInteger(0,(string)k,OBJPROP_COLOR,clrRed);
}
else if (j == -1)
{
ObjectCreate((string)k,OBJ_VLINE,0,Time[i],0);
ObjectSetInteger(0,(string)k,OBJPROP_COLOR,clrGreen);
}
k++;
}
}
//+------------------------------------------------------------------+
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
---