Yes exactlygaheitman wrote:Ok, to restate your logic and turn it into code....fxozgirl wrote:The trigger to buy is for the stoch signal line to have crossed the 20 at the opening of the new candle. (For example, if I was trading manually I would wait until the candle opened, checked where the signal line was and then place a trade/or not).
Only determine if there is a valid signal at the opening of the bar. Once the opening of the bar passes, we're done looking for trades until tomorrow.
For a buy, the Stochastic Signal value at the close of the previous bar must be below 20 and the Stochastic signal value at the instant of the opening of the current bar must be above 20.
For a sell, the Stochastic Signal value at the close of the previous bar must be above 80 and the Stochastic signal value at the instant of the opening of the current bar must be below 80.
Would you want to use a delta value to make sure that it is a sharp turn at the OB/OS levels?
Steve,
I think you need to reinstate code to only check at the beginning of the bar. You may need to check Volume[0] <= 1 to make sure you don't take a trade the moment you add the EA to the chart. I've never used that test myself, but most of my coding has been indicators. Also, you may have to make two calls to GetStoch(), one for the current bar and one for the previous bar. That way you are sure to get the final value for the previous bar stoch.
George
Re: delta value...sorry I don't know what that is