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

cannot change the sound file in the indicator i made

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

    cannot change the sound file in the indicator i made

    privatestring iAlert = "Alert1.wav";
    [Description(
    "")]
    [Category(
    "Parameters")]
    publicstring AlertString
    {
    get { return iAlert; }
    set { iAlert = value; }
    }

    I have this under the region variables. When i add the indicator to a chart Im supposed t o be albe to change the alert1.wav to any of the other alerts but when i do it just plays alert1.wav.

    #2
    Hello cbart2,

    Welcome to the NinjaTrader forums!

    Is the alert coded to use your variable instead?

    Please share the complete script you're working with and we can take a look.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      publicclass XingEmaXingSma : Indicator
      {
      #region Variables
      // Wizard generated variables
      privateint eMAP = 14; // Default setting for EMAP
      privateint sMAP0 = 40; // Default setting for SMAP
      privateint displace = 0;

      privatestring iAlert = "Alert1.wav";
      [Description(
      "")]
      [Category(
      "Parameters")]
      publicstring AlertString
      {
      get { return iAlert; }
      set { iAlert = value; }
      }
      // User defined variables (add any user defined variables below)

      privatedouble EMAVal,SMAVal;



      #endregion

      Comment


        #4
        private DataSeries sMA, eMA;
        privateint vPlayCount = 0;
        private System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer();

        protectedoverridevoid Initialize()
        {
        Add(
        new Plot(Color.FromKnownColor(KnownColor.Maroon), PlotStyle.Line, "Plot0"));
        Add(
        new Plot(Color.FromKnownColor(KnownColor.DarkGreen), PlotStyle.Line, "Plot1"));

        Plots[
        0].Pen.Width = 3;
        Plots[
        1].Pen.Width = 3;
        Plots[
        1].PlotStyle = PlotStyle.Dot;

        Overlay =
        true;
        PriceTypeSupported =
        false;
        CalculateOnBarClose =
        true;
        AutoScale =
        false;
        DisplayInDataBox =
        false;
        PaintPriceMarkers =
        false;

        sMA =
        new DataSeries(this);
        eMA =
        new DataSeries(this);

        }

        Comment


          #5
          protectedoverridevoid OnBarUpdate()
          {
          if(CurrentBar == 0)
          {

          myTimer.Tick += new EventHandler(TimerEventProcessor);
          myTimer.Interval =
          10000;
          myTimer.Start();
          }

          if (CurrentBar < Displace)
          return;

          EMAVal = EMA(Close, eMAP)[Displace];
          SMAVal = SMA(Close, sMAP0)[
          0];

          Plot0.Set(SMAVal);
          Plot1.Set(EMAVal);

          if(CurrentBar <= 6)
          return;

          sMA.Set(SMAVal);
          eMA.Set(EMAVal);

          if(sMA[1] > eMA[1] && sMA[0] < eMA[0])
          {
          if(!Historical)
          {
          vPlayCount =
          3;
          PlaySound(iAlert);
          }

          if(sMA[1] < eMA[1] && sMA[0] > eMA[0])
          {
          if(!Historical)
          {
          vPlayCount =
          3;
          PlaySound(iAlert);
          }

          Comment


            #6
            One thing you should change is the use of internal variable iAlert in your PlaySound().

            You should use instead the public input AlertString
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              i dont understand i tried that and i get errors.

              Comment


                #8
                i used the coding for the alert from another indicator my father-in-law uses and it works on it with no problems. i just dont see why it doesnt with my indicator

                Comment


                  #9
                  privatestring iAlert = "Alert1.wav";
                  [Description(
                  "")]
                  [Category(
                  "Parameters")]
                  [Gui.Design.DisplayName (
                  "Alert")]
                  publicstring Alert
                  {
                  get { return iAlert; }
                  set { iAlert = value; }
                  }

                  well i just changed it to that and now its working

                  Comment


                    #10
                    Great - thanks for the follow-up, cbart2.
                    Ryan M.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by bortz, 11-06-2023, 08:04 AM
                    47 responses
                    1,607 views
                    0 likes
                    Last Post aligator  
                    Started by jaybedreamin, Today, 05:56 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post jaybedreamin  
                    Started by DJ888, 04-16-2024, 06:09 PM
                    6 responses
                    19 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by Jon17, Today, 04:33 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post Jon17
                    by Jon17
                     
                    Started by Javierw.ok, Today, 04:12 PM
                    0 responses
                    15 views
                    0 likes
                    Last Post Javierw.ok  
                    Working...
                    X