Dear All,

Still having problem with my script, unable to open trades ;

//**** ConnorsRSI Short Term Trading Strategy ** //
function run()
{

BarPeriod = 60; // 1 hour bars
LookBack = 500;
StartDate = 2012;
EndDate = 2013;

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




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

MaxLong = MaxShort = 1;

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

while(asset(loop("EUR/USD")))



Margin = 0.5 * OptimalF * Capital;

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

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

//
enterLong();


// ** Exit Long Position ** //

if( NumOpenLong >0 && Price > SMAFast)

exitLong();

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

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

enterShort();

// ** Exit Short Position ** //

if(NumOpenShort >0 && Price < SMAFast)

exitShort();

}

Last edited by Materz; 07/02/18 18:47.