Posted By: deweymcg
Conditions on two different time frames - 05/13/13 22:13
Sorry to be such a newb. I am trying to write a script that will first check the Daily Close from yesterday and see if it is above both the EAM 50 and EMA 20. If it is in between, do nothing. If it is above, then look at the 1 hour time frame and enter a long if the Williams%R goes below -80. If it is below the EMA's then go short if on the 1 hour time frame the Williams%R goes above -20.
I will add a few more conditions once I get this part figured out. I keep getting errors and am not sure where I am screwing up:
function run()
{
BarPeriod = 60;
TimeFrame = 24;
vars DailyClose = series(priceClose(1));
vars EMA50 = series(EMA(DailyClose,50));
vars EMA20 = series(EMA(DailyClose,20));
TimeFrame = 1;
Stop = 6.5*ATR(30);
TakeProfit = 9*ATR(30);
if ((DailyClose > EMA50) and (DailyClose > EMA20)
and (WillR(14) < -80))
enterLong();
else if ((DailyClose < EMA50) and (DailyClose < EMA20)
and (WillR(14) > -20))
enterShort();
}
Please have a look and point me in the right direction.
I will add a few more conditions once I get this part figured out. I keep getting errors and am not sure where I am screwing up:
function run()
{
BarPeriod = 60;
TimeFrame = 24;
vars DailyClose = series(priceClose(1));
vars EMA50 = series(EMA(DailyClose,50));
vars EMA20 = series(EMA(DailyClose,20));
TimeFrame = 1;
Stop = 6.5*ATR(30);
TakeProfit = 9*ATR(30);
if ((DailyClose > EMA50) and (DailyClose > EMA20)
and (WillR(14) < -80))
enterLong();
else if ((DailyClose < EMA50) and (DailyClose < EMA20)
and (WillR(14) > -20))
enterShort();
}
Please have a look and point me in the right direction.