![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Member
Join Date: Nov 2008
Posts: 42
Thanks: 0
Thanked 0 times in 0 posts
|
I created a simple strategy to play a sound and draw a text on the chart when price crossovers weighted moving average, and this strategy is started within the strategies tab in Control Center. However, this strategy is never triggered, below is code
Thanks! // This namespace holds all strategies and is required. Do not change it. namespace NinjaTrader.Strategy { /// <summary> /// Enter the description of your strategy here /// </summary> [Description("Enter the description of your strategy here")] public class HSICrossover : Strategy { #region Variables // Wizard generated variables // User defined variables (add any user defined variables below) #endregion /// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() { CalculateOnBarClose = true; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Condition set 1 if (CrossAbove(Close, WMA(Close, 13), 1)) { PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\Alert3.wav"); DrawText("Crossover" + CurrentBar, "Crossover", 0, 0, Color.Red); Log("Crossover occurred", LogLevel.Information); } } #region Properties #endregion } } |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
marketstudent,
Please check the Control Center logs for errors. Remember your strategy is only true when the close price crosses above the WMA.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple question about a simple strategy. | shakira | Strategy Development | 1 | 02-14-2009 10:56 AM |
| Simple strategy | rnr123 | Strategy Analyzer | 1 | 10-17-2008 07:04 AM |
| need help with simple strategy | mike8943 | Strategy Development | 1 | 07-17-2008 08:21 AM |
| OnBarUpdate triggered by historical bars when starting strategy | chyap | General Programming | 1 | 07-01-2008 11:06 PM |
| Simple Strategy | Oli | Automated Trading | 2 | 03-05-2007 11:42 PM |