PHP Code:
double Buy2_1 = iOpen(NULL, 0, Current + 0); //Statement in question for crossover!
double Buy2_2 = iMA(NULL, 0, 50, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
If I had to zero into a problem area, it would be this code above. There needs to be a cross over for a buy and a sell.
double Buy1_1 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double Buy1_2 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, Current +
1); //1-Back
double Buy2_1 = iMA(NULL, 0, 50, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double Buy2_2 = iMA(NULL, 0, 50, 0, MODE_EMA, PRICE_CLOSE, Current +
1); //1-Back
double Sell1_1 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double Sell1_2 = iMA(NULL, 0, 5, 0, MODE_EMA, PRICE_CLOSE, Current +
1); //1-Back
double Sell2_1 = iMA(NULL, 0, 50, 0, MODE_EMA, PRICE_CLOSE, Current + 0);
double Sell2_2 = iMA(NULL, 0, 50, 0, MODE_EMA, PRICE_CLOSE, Current +
1); //1-Back
if(Buy1_1>Sell2_1 && Buy1_2<Sell2_2) Then Buy; // Proper 'UP' crossover has occurred!
if(Sell1_1<Buy2_1 && Sell1_2>Buy2_2) Then Sell; // Proper 'DOWN' crossover has occurred!
Dave
