Thanks in advance for your help
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Entering a trade in the last minute of a 3 minute-bar
Collapse
X
-
-
Sangui,
I am happy to assist you.
This is definitely possible. You can use the following reference samples to get where you are going.
Please let me know if I may assist further.Adam P.NinjaTrader Customer Service
-
Hi Adam,
Yes please I would need further explanation about the specific result I am looking for. That is, imaging that we are working with a 3 minute chart and our strategy enters long if MACD indicator goes above ZERO but only when the bar is in the third minute. Could you send me the code or another similar please?
Thanks and regards,
Comment
-
Sangui,
Something like this should work :
An example of the printed output :Code:protected override void OnBarUpdate() { if(BarsInProgress == 0) { three_minute_timestamp = Times[0][0]; } else if(BarsInProgress == 1) { if( ToTime(Times[1][0]) >= ToTime(three_minute_timestamp.AddMinutes(2)) && ToTime(Times[1][0]) <= ToTime(three_minute_timestamp.AddMinutes(3)) ) { Print("Order Entered - 3-minute time : "+Times[0][0]+" Order entry time : "+Times[1][0]); EnterLong(DefaultQuantity, ""); } } }
Order Entered - 3-minute time : 4/18/2012 7:24:00 AM Order entry time : 4/18/2012 7:26:00 AM
The 7:24 is the 3 minute time stamp, and the 3 minute bar would be made up of data from 7:24 through 7:27.
Please let me know if I may assist further.Last edited by NinjaTrader_AdamP; 04-18-2012, 07:31 AM.Adam P.NinjaTrader Customer Service
Comment
-
Hi Again,
I was testing this code but this in not exactly what I am looking for. I would need something like the following:
In a 3-minute chart, as soon as a new bar begins (FirstTickOfBar), the count of the time must start then print an alert when we are in the third minute of the bar.
For example: A new bar starts, so the time is 0:00 (minutes:Seconds). Then when the time of the bar is greater than 2:00 an alert is print. With this code I think I can work because I will use as a filter in my strategy.
I don't know If I am explain the situation properly, please let me know...
Thanks again
Comment
-
The thing is that I need to know exactly when the bar is in its third minute. But using only on chart of 3 minutes. This is why I was thinking in using the Bartimer indicator when the "Time remaining" is >=00:02:01. Do you understand me know?. Sorry about my english...
Regards,
Comment
-
Sangui,
Thanks for your note.
Do you want the indicator to work on historical bars? Or do you only want it to let you know from the time you attach it to a chart and forward? BarTimer in this case only works from the most current bar forward.
Your English is great! I just needed some clarification because there are a couple ways to do this.Adam P.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
637 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
366 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
107 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
572 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

. I will keep you posted.
Comment