Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Displaced MA Crossover
Collapse
X
-
Hello Austin,
[I am writing this while watching the how the strategy works with market replay]
Your solution seems to work, but here is the problem:
I have a simple test strategy -
If priceclose crossabove displaced ma, plot a dot
I see dots being plotted all over the place regardless of whether the price closed above or below the displaced ma [fortunately a dot is not plotted for all the bars].
Often a dot gets plotted when the entire bar is above or below the displaced MA.
Interestingly, the dots are plotted only for green bars and often appear if the preceding bar is a red bar
This clearly is not working.
Thanks for the help.
Comment
-
Kumar, please use something like this as condition, yours was not displaced by x bars (6 bar SMA displaced 6 bars in my example) -
Code:if (CrossAbove(Close, SMA(6)[6] , 1)) { DrawDiamond("My diamond" + CurrentBar, false, 0, High[0] + 2 * TickSize, Color.Red); Alert("MyAlert0", Priority.High, "", @"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav", 0, Color.White, Color.Black); }
Comment
-
Use a unique ID for Alert, too -
Code:if (CrossAbove(Close, SMA(6)[6] , 1)) { DrawDiamond("My diamond" + CurrentBar, false, 0, High[0] + 2 * TickSize, Color.Red); Alert("MyAlert0" + CurrentBar, Priority.High, "", @"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav", 0, Color.White, Color.Black); }
Comment
-
No - please replace Condition1 in your OnBarUpdate() of the script you posted with this code -
Code:if (CrossAbove(Close, SMA(6)[6] , 1)) { DrawDiamond("My diamond" + CurrentBar, false, 0, High[0] + 2 * TickSize, Color.Red); Alert("MyAlert0" + CurrentBar, Priority.High, "", @"C:\Program Files\NinjaTrader 6.5\sounds\Alert1.wav", 0, Color.White, Color.Black); }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
581 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
336 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|


Comment