I need help on My Stochastic based EA


Hi ! Can someone help my EA, i need it to open a position when the K and D lines are crossing above 20 and then close that same position when it crosses down 81, that is for the bullish positions. I also need it to open another position when the stochastic crosses down 80 and then close the position when the stochastic crosses above 21. 

i tried to do it mylsef but it doesn't work well. 

I add the code.

if someone can help that will be nice...

Sorry for my english, i'm french...and that's not a good excuse ! 

Thank you


//Create an Instance of CTrade
CTrade trade;
void OnTick()
  //We create a string for the signal
  string signal="";
  //We calculate the Ask Price
  double Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
  //We calculate the bid Price
  double Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);
  //We create an array for the K-line and D-Line
  double Karray[];
  double Darray[];
  //Sort the array from the ccurrent candle downwards
  //Defined EA, Current Candle, 3 candles, Save the result
  int StochasticDefinition=iStochastic(_Symbol,_Period,14,2,1,MODE_SMA,STO_LOWHIGH);
  //We fill the array with price data
  //We calculate the value for the current candle
  double Kvalue0=Karray[0];
  double Dvalue0=Darray[0];
  //We calculate the value for the last candle
  double Kvalue1=Karray[1];
  double Dvalue1=Darray[1];
  //Buy Signal 
  //If Both value are above 20
  //if the K value has crossed the D value from above
  //Sell Signal 
  //If Both Values are below 81
  //If the K value Has crossed the D value From below
  //Sell 3 Microlot
  if(signal == "sell"&&PositionsTotal()<1)
  //Buy 3 Microlot
  if (signal =="buy"&& PositionsTotal()<1)
  //Create a chart output 
  Comment("The current signal is: ",signal);