hinkognito
New member
Hi All,
I have made the following script for a daytrade setup using some standard indicators.
I am getting a syntax error on my plots, saying 'else' block is expected. can someone have a look at this?
declare upper;
input price = close;
input length = 50;
def AvgExp = ExpAverage(price, length);
input rsilength = 14;
input averageType = AverageType.WILDERS;
def NetChgAvg = MovingAverage(averageType, price - price[1], rsilength);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), rsilength);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
input adxlength = 14;
def ADX = DMI(length).ADX;
Plot Long = if close>avgexp and rsi[1]<30 and rsi>30 and adx>30 then low-3*ticksize();
Plot Short = if close<avgexp and rsi[1]>30 and rsi<30 and adx>30 then high+3*ticksize();
I have made the following script for a daytrade setup using some standard indicators.
I am getting a syntax error on my plots, saying 'else' block is expected. can someone have a look at this?
declare upper;
input price = close;
input length = 50;
def AvgExp = ExpAverage(price, length);
input rsilength = 14;
input averageType = AverageType.WILDERS;
def NetChgAvg = MovingAverage(averageType, price - price[1], rsilength);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), rsilength);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
input adxlength = 14;
def ADX = DMI(length).ADX;
Plot Long = if close>avgexp and rsi[1]<30 and rsi>30 and adx>30 then low-3*ticksize();
Plot Short = if close<avgexp and rsi[1]>30 and rsi<30 and adx>30 then high+3*ticksize();