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 cmoran13, 04-16-2026, 01:02 PM
|
0 responses
42 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
25 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|
||
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
162 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
98 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
157 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|


Comment