hello,
I'm using the following to scan for pre-market movement.
The issue is that I can only run the scan after-market and pre-market. So, if I miss running it by 930AM, I have to wait till after hours.
is there any way to edit this so I can run it at anytime, YET give me only pre-market info?
I see the script has an closing_time and open_time parameter. Not sure if that simply defines after and pre-market or does it also limit to getting results if it is run between the specified hours.
I'm using 1 m timeframe for this scan and have checked the ext hours checkbox
Thanks in advance
I'm using the following to scan for pre-market movement.
The issue is that I can only run the scan after-market and pre-market. So, if I miss running it by 930AM, I have to wait till after hours.
is there any way to edit this so I can run it at anytime, YET give me only pre-market info?
I see the script has an closing_time and open_time parameter. Not sure if that simply defines after and pre-market or does it also limit to getting results if it is run between the specified hours.
I'm using 1 m timeframe for this scan and have checked the ext hours checkbox
Thanks in advance
Code:
#Wizard text: The
#Wizard input: price
#Wizard text: has moved
#Wizard input: operator
#Wizard input: percent_change
#Wizard text: % in after hours trading
input closing_time = 1559;
input open_time = 0930;
input price = close;
input operator = {default "greater than","less than"};
input percent_change = 1.00;
def time_until_close = SecondsTillTime(closing_time);
def time_until_open = SecondsTillTime(open_time);
def closing_bell = time_until_close == 0;
rec closing_price = CompoundValue(1, if closing_bell then price else closing_price[1], price);
def after_closing_bell = time_until_close <= 0;
def before_opening_bell = time_until_open >= 0 ;
def afterhours_percent_change = 100 * (price / closing_price - 1);
def meet_scan_criteria;
switch (operator) {
case "greater than":
meet_scan_criteria = afterhours_percent_change >= percent_change;
case "less than":
meet_scan_criteria = afterhours_percent_change <= percent_change;
}
plot scan = (after_closing_bell or before_opening_bell) AND meet_scan_criteria;