Hi,
I'm new to TOS. I'm trying to build scanner for Greed to Red Strategy, here is the script that I developed but it appears not working. Can you point where I'm gone wrong.
I'm new to TOS. I'm trying to build scanner for Greed to Red Strategy, here is the script that I developed but it appears not working. Can you point where I'm gone wrong.
Rich (BB code):
# Green to Red - Short sell
# current day Open price should be > prevDayClose price
# scanner shows when current 5min candle is 1% away (above) from VWAP, enter when new high is <= VWAP; so scanner should catch before it crosses VWAP
# exit when price near prevDayClose
# Do not run during exnt.hours
def close_price = Fundamental(FundamentalType.CLOSE, period = getAggregationPeriod());
def prev_day_close = if SecondsTillTime(1555) == 0 and
SecondsFromTime(1555) == 0
then close
else prev_day_close[1];
def open_price = if SecondsFromTime(0930.0) >= 0 and SecondsTillTime(0935.0) > 0 then
Fundamental(FundamentalType.HIGH, period = getAggregationPeriod())
else double.nan;
plot GreenToRed =
if SecondsFromTime(0930.0) >= 0 and
SecondsTillTime(1000.0) > 0 and
open_price >= prev_day_close * 1.10 and
close_price > VWAP and close_price <= 1.01*VWAP then 1 else 0;