How can i do that?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Compare a bar with a Specific time and entry at the end of the day.
Collapse
X
-
Compare a bar with a Specific time and entry at the end of the day.
For Example, In 1 hour NQ chart, I want to compare the open at 0100 and the close at 23;00, if open (0100) - close (2300) > 300, then take Entry at 23:59 in the same day.
How can i do that?Tags: None
-
Hello strongelephant,
Thank you for your note.
You could check the open price when the time is 0100, and save that to a variable. Then, you could check for the time to be 2300, subtract the open you saved from the close price of that bar, and set a bool to true. Then, at 2359 on an added 1 minute series, check if the bool is true and submit an order if it is.
I've created a simple example script that demonstrates this.
You can also use GetBar to find the 0100 am open price at 2300:
Either method would work.
Please let us know if we may be of further assistance to you.
Attached Files
-
Hi Kate,
I do use your code and plugin to NinjaScript, but it seems doestn work. I don't know which part is wrong. Thanks for your answer.
StrongElephant1 Photo
Comment
-
I use 60mins for the calculation.Originally posted by NinjaTrader_Kate View PostHello strongelephant,
Thank you for your note.
You could check the open price when the time is 0100, and save that to a variable. Then, you could check for the time to be 2300, subtract the open you saved from the close price of that bar, and set a bool to true. Then, at 2359 on an added 1 minute series, check if the bool is true and submit an order if it is.
I've created a simple example script that demonstrates this.
You can also use GetBar to find the 0100 am open price at 2300:
Either method would work.
Please let us know if we may be of further assistance to you.
Comment
-
Hello strongelephant,
Thank you for your reply.
Ah, I left a couple lines in there from starting out in the Strategy Builder that would block the entry. If you remove the following at the top of OnBarUpdate you should see it submit orders:
if (BarsInProgress != 0)
return;
Please let us know if we may be of further assistance to you.
Comment
-
Yes, Thanks!Originally posted by NinjaTrader_Kate View PostHello strongelephant,
Thank you for your reply.
Ah, I left a couple lines in there from starting out in the Strategy Builder that would block the entry. If you remove the following at the top of OnBarUpdate you should see it submit orders:
if (BarsInProgress != 0)
return;
Please let us know if we may be of further assistance to you.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
46 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
66 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment