test_cross_1

Author: Copyright 2015, galladion
Indicators Used
Stochastic oscillator
3 Views
0 Downloads
0 Favorites
test_cross_1
//+------------------------------------------------------------------+
//|                                                 test_cross_1.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 K = 12;
extern int D = 60;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
int z=0;
for (int i=0;i<=Bars-1;i++)
{
double Sto_Main_0 = iStochastic(NULL,0,K,D,3,MODE_SMA,0,MODE_MAIN,i);
double Sto_Main_1 = iStochastic(NULL,0,K,D,3,MODE_SMA,0,MODE_MAIN,i+1);
double Sto_Signal_0 = iStochastic(NULL,0,K,D,3,MODE_SMA,0,MODE_SIGNAL,i);
double Sto_Signal_1 = iStochastic(NULL,0,K,D,3,MODE_SMA,0,MODE_SIGNAL,i+1);
int j = cross(Sto_Main_0,Sto_Main_1,Sto_Signal_0,Sto_Signal_1);
if (j == 0) continue;
if (j == 1) 
{
ObjectCreate((string)z,OBJ_VLINE,0,Time[i],0);
ObjectSetInteger(0,(string)z,OBJPROP_COLOR,clrRed);
}
else if (j == -1)
{
ObjectCreate((string)z,OBJ_VLINE,0,Time[i],0);
ObjectSetInteger(0,(string)z,OBJPROP_COLOR,clrGreen);
}
z++;
}   
  }
//+------------------------------------------------------------------+

Comments