# Stochastic EA we want to buy on bottom of stochastic when cross over stock with signal and sell when cross under stock with signall on top ... ```mql4 // int totalBars; // int OnInit() { // totalBars = iBars(Symbol, _Period); // ... }; // void OnTick() { // int bars = iBars(_Symbol, _Period); if (totlaBars != bars) { // totalBars = bars; // // Do Actions here ... } } ```