I am having trouble with two things. I would like to create an expert advisor where there are 2 conditions.
Condition one, check where is the price, if price is below the 200 EMA I would only be interested in selling. And if price is above the 200 EMA I am interested in only buying.
After checking condition one, proceed to condition two.
Condition two, is about the stochastic oscillator, where the %k is 15, %d is 5, slowing is 5. When the %k crosses the %d, at a level either above 80 or below 20 then open position. But do remember that position are opened based on condition one, (if price is above the 200 EMA then we are only interested in buying as in where the %k crosses the %d below 20 on the stochastic oscillator, and vice versa when the price is below the 200 EMA, I am only interested in selling, when the %k crosses the %d above the 80.
Kindly note that crossover between the %k and the %d should be found only if it is above the 80 or bellow 20 in order to open a position.
Your earlies response is much appreciated.