Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Entry not triggering at the MACD Crossover
Collapse
X
-
Entry not triggering at the MACD Crossover
I'm trying to enter a trade as soon as the MACD Crossover occurs but the strategy is entering a bar later see attached screenshots. I have set MACD at bars 0 and crossover is happening between MACD and Avg. Is there a way to set it so I am able to enter the long position as soon as the crossover happens?Tags: None
-
Hello pyraxic,
Here you get a sample macd cross strategy, it will plot arrow up / down on your chart @ macd cross signal. For me I can't see the lag as you're getting, you can test this with your parameters & confirm. I've used standard parameters which you can change as per your need. Also attaching the snapshot for reference.
[ATTACH]n1127583[/ATTACH]
Comment
-
Hello pyraxic,
I attached it but it seems some issue, let me attach it again. Here you get it.
SampleMACDcross.zip
Comment
-
Hello pyraxic,
Just one thing I am suspecting is that after making the change to Calculate = Calculate.OnEachTick you must reset your strategy or you can remove it & add again on your charts. Any changes made to State.SetDefaults don't reflect by refresh (F5).Last edited by s.kinra; 11-15-2020, 04:55 AM.
Comment
-
Hello pyraxic,
s.kinra would be correct in that Calculate would need to be .OnEachTick.
Below is a link to a forum post that discusses this.
I would expect that in real-time data, orders would appear on the same bar the cross occurred on.
In your screenshot are these real-time orders or historical orders?
That said, in historical data, TickReplay (using historical tick data) would also be required for the historical orders to also be placed intra-bar.Chelsea B.NinjaTrader Customer Service
Comment
-
-
If I wrap it inside the IsFirstTickOfBar, it doesn't trigger buy orders every time it crosses. The strategy entered 4 trades in past 15 days.
Code:protected override void OnBarUpdate() { if (BarsInProgress != 0) return; if (CurrentBars[0] < 1) return; if(IsFirstTickOfBar) { if (CrossAbove(MACD1.Default, MACD1.Avg, 1)) { EnterLong(Convert.ToInt32(DefaultQuantity), @"Long"); } } }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment