Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Simple Strategy is not triggered

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Simple Strategy is not triggered

    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
    marketstudent,

    Please check the Control Center logs for errors. Remember your strategy is only true when the close price crosses above the WMA.
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Tin34, Today, 03:30 AM
    2 responses
    16 views
    0 likes
    Last Post Tin34
    by Tin34
     
    Started by sastrades, Yesterday, 09:59 AM
    2 responses
    31 views
    0 likes
    Last Post brucerobinson  
    Started by ETFVoyageur, Today, 12:52 AM
    1 response
    16 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by lollers, Today, 03:26 AM
    0 responses
    12 views
    0 likes
    Last Post lollers
    by lollers
     
    Started by aliyahany, Today, 03:16 AM
    0 responses
    4 views
    0 likes
    Last Post aliyahany  
    Working...
    X