Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not showing arrows and audio alerts

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

    Strategy not showing arrows and audio alerts

    Please review this strategy and show me why it is not drawing on chart, Also the audio alert,,,,,,It seems to me that maybe the codes are canceling each other out.

    <summary>
    /// Plots when the HMA crosses KAMA and ADX value > 30
    ///</summary>
    [Description("Plots when the HMA crosses KAMA and ADX value > 30")]
    [Gui.Design.DisplayName(
    "HMAxKAMAvADX")]
    publicclass HMAxKAMAvADX : 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>
    protectedoverridevoid Initialize()
    {
    Add(HMA(
    21));
    Add(KAMA(
    2, 10, 30));
    Add(ADX(
    14));
    Add(HMA(
    21));
    Add(KAMA(
    2, 10, 30));
    Add(ADX(
    14));
    CalculateOnBarClose =
    true;
    }
    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    {
    // Condition set 1
    if (CrossAbove(HMA(21), KAMA(2, 10, 30), 1)
    && ADX(
    14)[0] > 30)
    {
    DrawArrowUp(
    "My up arrow" + CurrentBar, 0, ADX(14)[0], Color.Blue);
    PlaySound(
    @"C:\Program Files\NinjaTrader 6\sounds\Alert1.wav");
    }
    // Condition set 2
    if (CrossBelow(HMA(21), KAMA(2, 10, 30), 1)
    && ADX(
    14)[0] > 30)
    {
    DrawArrowDown(
    "My down arrow" + CurrentBar, 0, ADX(14)[0], Color.Magenta);
    PlaySound(
    @"C:\Program Files\NinjaTrader 6\sounds\Alert2.wav");

    #2
    Unfortunately we are unable to review actual strategies for bandwidth reasons. NinjaScript consultants are available to help program your custom indicators/strategies or to help our users throughout their learning curve. Additional information is located here: http://www.ninjatrader.com/webnew/pa...injaScript.htm

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    52 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    275 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X