Gap Script

I am trying to use either show bar or showplot to higligth two points.
Using Axicorp -
10pm which is 5pm NY and 4:30pm which is 9:30am NY.

I can’t seem to get just those two points highlighted.

// Find the full bar date with intraday decimals
V1 = BARDATE();
// Find the daily bar date, without decimals
V2 = ROUND(V1 - 5/24, DECIMALTYPE=0);
// Reduce bar date to intraday range only
V3 = V1 - V2;
// Identify time range between 9:59 pm on Friday and 4:35 am on Monday
V4 = ((DAYOFWEEK() == 6) and (V3 >= -0.2291667)) or ((DAYOFWEEK() == 1) and (V3 <= -0.7263889)) or ((DAYOFWEEK() == 2) and (V3 >= -0.7263889 and V3 <= -0.3958333));
// Highlight the time range
V4

Hi,

I’m not 100% sure what your script is trying to do. In your description you mention looking to mark the 10pm and 4.30pm bar, here’s an example of how that can be done on a 5min Axicorp chart:

// Find the full bar date with intraday decimals
V1 = BARDATE();
// Find the daily bar date, without decimals
V2 = ROUND(V1, DECIMALTYPE=0);
// Reduce bar date to intraday range only
V3 = V1 - V2;
//Find and highlight the 10pm Bar and the 4.30pm Bar (5min Chart)
(V3 < -0.08325 and V3 > -0.08340) or V3 == -0.31250

Ex2

In your example script I am not sure what V2 is trying to do with the addition of - 5/24? It also looks like you may be trying to limit which days the results appear on?

When I am doing a script based on intraday time counts, I start by applying the above script showing just the V3 values. From there I can find the values to reference for the time(s) I want to mark. Once you have these values you can work on the rest of the script, tailoring it to what you want to show.

Ahh, maybe the script is incorect.

but i am trying to only find the Friday closeing price at 5pm NY time which is 10pm on the server. And then Find the Monday 9:30am opening time of NY which is 4:30pm on the server.

I guess I was trying to highlight only the friday and the monday trading period for those two dates, instead of every single day.

[postquote quote=70523]

Hi,

DayofWeek() can be used to limit the 10pm and 4.30pm lines to just Friday and Monday.

// Find the full bar date with intraday decimals
V1 = BARDATE();
// Find the daily bar date, without decimals
V2 = ROUND(V1, DECIMALTYPE=0);
// Reduce bar date to intraday range only
V3 = V1 - V2;
//Find and highlight Fridays 10pm Bar and the Mondays 4.30pm Bar (5min Chart)
((V3 < -0.08325 and V3 > -0.08340) and DAYOFWEEK() == 6) or (V3 == -0.31250 and DAYOFWEEK() == 2)

Ex3

Great addition!

Can I ask, is there any way to script a horizontal line to reference the 00:00 UTC5 opening hours on the chart each day, at the opening price of that bar?

Hi,

Yes, the PriceatSignal() function can be used to show the Open price each day at 12am.

// Find the full bar date with intraday decimals
V1 = BARDATE();
// Find the daily bar date, without decimals
V2 = ROUND(V1, DECIMALTYPE=0);
// Reduce bar date to intraday range only
V3 = V1 - V2;
//Find 12am bar
V4 = V3 == 0;
//Find Open Price at 12 am bar
PRICEATSIGNAL(V4, PRICE=Open)

Ex2