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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    62 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    33 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    44 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    58 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    47 views
    0 likes
    Last Post CarlTrading  
    Working...
    X