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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
152 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
89 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
133 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
127 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|


Comment