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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
47 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
33 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
51 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment