Hi all,

I need assistance on the below Connors RSI Script, it opens Position wrongly.
//**** ConnorsRSI Short Term Trading Strategy ** //
function run()
{
set(PARAMETERS); // generate and use optimized parameters
BarPeriod = 60; // 1 hour bars
LookBack = 500;
StartDate = 2015;

vars Price = series(priceClose());
vars Close = series(priceClose());
vars SMAFast = series(SMA(Close,5)); // Fast SMA for Position trigger
vars SMASlow = series(SMA(Close,200)); // Slow SMA for Trend Direction
vars cRSI = series(ConnorsRSI(Close,2,3,100)); // ConnorsRSI
int Threshold1=65;
int Threshold2= 25;
Capital= 5000;
Stop=2*ATR(10);



// ** set up max trades ** //

MaxLong = MaxShort = 1;

// ** Type ** //
while(asset(loop("EUR/USD","USD/JPY")))



Margin = 0.5 * OptimalF * Capital/2 ;

// *** Condition for Buy *** //

if(crossUnder(cRSI,Threshold2) && (Price > SMASlow && Price < SMAFast))

enterLong();


// ** Exit Long Position ** //

if( NumOpenLong >0 && Price > SMAFast)

exitLong();

// *** Condition for Sell *** //

if(crossOver(cRSI,Threshold1) && (Price < SMASlow && Price > SMAFast))

enterShort();

// ** Exit Short Position ** //

if(NumOpenShort >0 && Price < SMAFast)

exitShort();

}