Help with code

Posted By: carolthesecond

Help with code - 07/01/20 21:19

function run ()
{
vars Price = series(price());
vars SMA10 = series(SMA(Price, 10));
vars SMA40 = series(SMA(Price, 40));

//Stop = 90 * PIP

var BuyStop, SellStop;

BuyStop = HH(10) + 1*PIP;
SellStop = LL(10) - 1*PIP;

if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMA10[0] > SMA40[0]){
enterLong(0, BuyStop);
}
if(dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMA10[0] < SMA[0]){
enterShort(0,SellStop);
}
if (dow() != 5 && dow() != 6 && dow() != 7){
exitLong();
exitShort;
}
}

I tried troubleshooting however I keep on getting the same syntax error.
Posted By: danatrader

Re: Help with code - 07/02/20 04:22

exitShort();

??
Posted By: carolthesecond

Re: Help with code - 07/03/20 23:00

no thats not it, it claims line 17 has a problem
Posted By: Qw3rty

Re: Help with code - 07/11/20 12:03

Fixed it:

function run ()
{
vars Price = series(price());
vars SMA10 = series(SMA(Price, 10));
vars SMA40 = series(SMA(Price, 40));

//Stop = 90 * PIP

var BuyStop, SellStop;

BuyStop = HH(10) + 1*PIP;
SellStop = LL(10) - 1*PIP;

if (dow() == 5 && NumOpenLong == 0 && NumPendingLong == 0 && SMA10[0] > SMA40[0]){
enterLong(0, BuyStop);
}


if (dow() == 5 && NumOpenShort == 0 && NumPendingShort == 0 && SMA10[0] > SMA40[0]){
enterShort(0, SellStop);
}



if (dow() != 5 && dow() != 6 && dow() != 7){
exitLong();
exitShort();
}
}

It was a formatting issue.

Also exitShort(); would've been your next error.
© 2024 lite-C Forums