Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OnEachTick and OnBarClose
Collapse
X
-
OnEachTick and OnBarClose
I have a function in my strategy that depends on OnBarClose calculation to draw an object but I have other functions inside OnBarUpdate() that need OnEachTick calculation. Is this possible?Tags: None
-
Hello TraderMatt83,
Thank you for your post.
Yes, this is possible. You would need to set the strategy to calculate On Each Tick, and then within your logic for anything that requires updates On Bar Close, you can add a check to see if IsFirstTickOfBar is true. This is because a bar's close is determined by the first tick of a new bar forming. Here is the help guide page about IsFirstTickOfBar:
Additionally, we have a reference sample that demonstrates how to separate logic to calculate either on each tick or on bar close:
Please let us know if we may be of further assistance.
-
-
Emily,
I finally got this to work except not sure how to fix my issue where my trade is no longer taking the trade if the previous closing bar is above a range. This function below determines whether to go long if the previous candle close is above the range high but it appears to be taking the trade below the range high. And I know the range high is correct because I have it painted. Yet the entry always happens if the current candle hits the range high. Thoughts?
private bool entryLongCheck()
{
return Close[1] > rangeHigh && Close[2] <= rangeHigh && High[0] > High[1] && CurrentBar - lastTradeBarLong > 2 && Close[0] > rangeLow;
}
Comment
-
Emily,
I finally got this to work except not sure how to fix my issue where my trade is no longer taking the trade if the previous closing bar is above a range. This function below determines whether to go long if the previous candle close is above the range high but it appears to be taking the trade below the range high. And I know the range high is correct because I have it painted. Yet the entry always happens if the current candle hits the range high. Thoughts?
private bool entryLongCheck()
{
return Close[1] > rangeHigh && Close[2] <= rangeHigh && High[0] > High[1] && CurrentBar - lastTradeBarLong > 2 && Close[0] > rangeLow;
}
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
89 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
143 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
83 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
257 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
334 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment