# 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.

if someone can help that will be nice...

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

Thank you

```#include<Trade\Trade.mqh>

void OnTick()
{

//We create a string for the signal
string signal="";

//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
ArraySetAsSeries(Karray,true);
ArraySetAsSeries(Darray,true);

//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
CopyBuffer(StochasticDefinition,0,0,4,Karray);
CopyBuffer(StochasticDefinition,1,0,4,Darray);

//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];

//If Both value are above 20
if(Kvalue0>20&&Dvalue0>20)
//if the K value has crossed the D value from above
if((Kvalue0<Dvalue0)&&(Kvalue1>Dvalue1))
{
}

//Sell Signal

//If Both Values are below 81
if(Kvalue0>81&&Dvalue0>81)

//If the K value Has crossed the D value From below
if((Kvalue0<Dvalue0)&&(Kvalue1>Dvalue1))
{
signal="sell";
}

//Sell 3 Microlot
if(signal == "sell"&&PositionsTotal()<1)