How can i do that?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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 FilesKate W.NinjaTrader Customer Service
-
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
-
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.Kate W.NinjaTrader Customer Service
Comment
-
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 rhyminkevin, Today, 04:58 PM
|
3 responses
48 views
0 likes
|
Last Post
by Anfedport
Today, 05:24 PM
|
||
Started by iceman2018, Today, 05:07 PM
|
0 responses
5 views
0 likes
|
Last Post
by iceman2018
Today, 05:07 PM
|
||
Started by lightsun47, Today, 03:51 PM
|
0 responses
7 views
0 likes
|
Last Post
by lightsun47
Today, 03:51 PM
|
||
Started by 00nevest, Today, 02:27 PM
|
1 response
14 views
0 likes
|
Last Post
by 00nevest
Today, 03:48 PM
|
||
Started by futtrader, 04-21-2024, 01:50 AM
|
4 responses
50 views
0 likes
|
Last Post
by futtrader
Today, 03:01 PM
|
Comment