Optuma Forums › Optuma Scripting › Gap Script
- This topic has 5 replies, 2 voices, and was last updated 6 months ago by
Matthew.
-
AuthorPosts
-
March 10, 2023 at 1:55 pm #70487
Jonathan
- Topics: 48
- Replies: 68
- Posts: 116
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
V4March 13, 2023 at 2:57 pm #70523Matthew
- Topics: 5
- Replies: 677
- Posts: 682
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:
12345678910// Find the full bar date with intraday decimalsV1 = BARDATE();// Find the daily bar date, without decimalsV2 = ROUND(V1, DECIMALTYPE=0);// Reduce bar date to intraday range onlyV3 = 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.31250In 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.
March 14, 2023 at 9:06 am #70545Jonathan
- Topics: 48
- Replies: 68
- Posts: 116
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.
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:
12345678910// Find the full bar date with intraday decimalsV1 = BARDATE();// Find the daily bar date, without decimalsV2 = ROUND(V1, DECIMALTYPE=0);// Reduce bar date to intraday range onlyV3 = 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.31250In 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.
March 15, 2023 at 10:03 am #70557Matthew
- Topics: 5
- Replies: 677
- Posts: 682
Hi,
DayofWeek() can be used to limit the 10pm and 4.30pm lines to just Friday and Monday.
12345678910// Find the full bar date with intraday decimalsV1 = BARDATE();// Find the daily bar date, without decimalsV2 = ROUND(V1, DECIMALTYPE=0);// Reduce bar date to intraday range onlyV3 = 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)1 user thanked author for this post.
March 16, 2023 at 11:02 am #70561Jonathan
- Topics: 48
- Replies: 68
- Posts: 116
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?
March 17, 2023 at 5:13 am #70592Matthew
- Topics: 5
- Replies: 677
- Posts: 682
Hi,
Yes, the PriceatSignal() function can be used to show the Open price each day at 12am.
123456789101112// Find the full bar date with intraday decimalsV1 = BARDATE();// Find the daily bar date, without decimalsV2 = ROUND(V1, DECIMALTYPE=0);// Reduce bar date to intraday range onlyV3 = V1 - V2;//Find 12am barV4 = V3 == 0;//Find Open Price at 12 am barPRICEATSIGNAL(V4, PRICE=Open) -
AuthorPosts
- You must be logged in to reply to this topic.