Hi
Ive tried to create an indicator and was wondering to see if someone can help me (i feel its 99.9% finished - well phase I anyway)
//+------------------------------------------------------------------+
//| CCI_Stoc_Xover.mq4 |
//| Copyright © 2007, MetaQuotes Software Corp. |
//|
Forex Trading Software: Forex Trading Platform MetaTrader 4 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 SeaGreen
#property indicator_color2 Red
extern int CCI_Period = 14;
extern int Stoc_K=5;
extern int Stoc_D=3;
extern int Stoc_Slowing=3;
double CrossUp[];
double CrossDown[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, EMPTY,3);
SetIndexArrow(0, 233);
SetIndexBuffer(0, CrossUp);
SetIndexStyle(1, DRAW_ARROW, EMPTY,3);
SetIndexArrow(1, 234);
SetIndexBuffer(1, CrossDown);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int limit, i, counter;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i = 0; i <= limit; i++) {
counter=i;
double cci_1 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, 1);
double cci_2 = iCCI(Symbol(), Period(), CCI_Period, PRICE_TYPICAL, 2);
double stok_0 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_MAIN, 0);
double stod_0 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_SIGNAL, 0);
double stok_1 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_MAIN, 1);
double stod_1 = iStochastic(Symbol(), Period(), Stoc_K, Stoc_D, Stoc_Slowing, MODE_SMA, 0, MODE_SIGNAL, 1);
if ((cci_2 <= 0 && cci_1 > 0 && stok_1 < stod_1 && stok_0 > stod_0)) {
CrossUp[i] = Low[i];
}
else if ((cci_2 >= 0 && cci_1 < 0 && stok_1 > stod_1 && stok_0 < stod_0)) {
CrossDown[i] = High[i];
}
}
return(0);
}