Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Connor's RSI 2 script #473583
07/24/18 14:48
07/24/18 14:48
Joined: Dec 2017
Posts: 19
M
Materz Offline OP
Newbie
Materz  Offline OP
Newbie
M

Joined: Dec 2017
Posts: 19
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();

}

Re: Connor's RSI 2 script [Re: Materz] #473627
07/28/18 17:09
07/28/18 17:09
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
if(Price > TrendSMA

That make no sense with series, maybe you meant not Price, but Price[0]?


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1