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

Audio Alert

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

    Audio Alert

    Hello,

    I have been trying to get an audio dropdown box made on an indicator in NT7. However, I get errors that I don't have a reference to a valid DLL or import.

    Here is the code:

    [Display(Name="Alert sound file", Order=2, GroupName="Parameters")]
    [PropertyEditor("NinjaTrader.Gui.Tools.FilePathPick er", Filter="Wav Files (*.wav)|*.wav")]
    public string SoundFile
    { get; set; }

    But I get the following error:
    https://screencast.com/t/jjnWo5Z9j

    #2
    Hello WHICKED,

    Thank you for your note.

    Without the full code I'm unable to test on my end, if you'd like to upload the file I can take a look however I do have a sample which does what you're looking for that I've attached.

    You may also try amending to the top of your code block,

    Code:
    [NinjaScriptProperty]
    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      This is in regards to the thread located here:

      https://ninjatrader.com/support/foru...ad.php?t=78796

      I am attempting to do the same implementation but I have put the code as shown below/above in the properties section, but it will compile with errors. Etiher I have not imported a reference correctly or the code is incorrect for NT7

      Comment


        #4
        Hello WHICKED,

        I have attached a indicator which implements that NinjaScript property.

        In regards to why your code is not compiling without error, if you'd like you can upload a copy and I could take a look. If you do so please export using the following format,

        To export a NinjaScript from NinjaTrader 8 do the following:
        From the Control Center window select Tools -> Export -> NinjaScript...
        Click Add>Select the indicator>OK>Export.
        Then attach that file you saved; under My Docs>NT8>Bin>Custom>Select the downloaded .zip file.

        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          After looking at the script you attached, it is clear that this is for NT8, however I am not using NT8 I am using NT7.

          For some reason the FilePathPicker isnt working correctly, either I am not referencing a assembly correctly or I am missing a reference.

          Comment


            #6
            Here is the code, excluding the ninjascript generated code and the logic for the indicator I am using. The only thing I am attempting to do is add a drop down.


            #region Using declarations
            using System;
            using System.ComponentModel;
            using System.Diagnostics;
            using System.Drawing;
            using System.Drawing.Drawing2D;
            using System.Xml.Serialization;
            using NinjaTrader.Cbi;
            using NinjaTrader.Data;
            using NinjaTrader.Gui.Chart;
            using System.Windows.Forms;
            using System.Collections.Generic;
            using System.ComponentModel.DataAnnotations;
            using System.Linq;
            using System.Text;
            using System.Threading.Tasks;
            using System.Windows;
            using System.Windows.Input;
            using System.Windows.Media;
            using NinjaTrader.Gui;
            using NinjaTrader.Gui.SuperDom;
            using NinjaTrader.Gui.Tools;
            using NinjaTrader.NinjaScript;
            using NinjaTrader.Core.FloatingPoint;
            using NinjaTrader.NinjaScript.DrawingTools;
            #endregion

            // This namespace holds all indicators and is required. Do not change it.
            namespace NinjaTrader.Indicator
            {

            public class IndiFor : Indicator
            {
            #region Variables

            #endregion

            /// <summary>
            /// This method is used to configure the indicator and is called once before any bar data is loaded.
            /// </summary>
            protected override void Initialize()
            {
            Add(new Plot(Color.Transparent, "Pattern Found"));
            Overlay = true;
            }


            protected override void OnBarUpdate()
            {
            if (CurrentBar == 0 && ChartControl != null)
            {
            downColor = ChartControl.GetAxisBrush(ChartControl.BackColor). Color;
            txtColor = downColor;
            if (downColor == Color.Black)
            upColor = Color.Transparent;
            else
            upColor = Color.Black;
            }

            Value.Set(0);


            }


            #regoin Properties
            [NinjaScriptProperty]
            [Display(Name="AlertFile", Order=1, GroupName="Parameters")]
            [PropertyEditor("NinjaTrader.Gui.Tools.FilePathPick er", Filter="Any Files (*.)|*.")]
            public string MyFile
            { get; set; }
            #endregion
            }
            }

            Comment


              #7
              Hello WHICKED,

              This thread was opened in the NT8 section of the forum, going forward it would be appreciated if you could be more cautious.

              I do not have a sample of the sound drop down for NT7 and converting the sample I provided in NT8 to NT7 would be out of the scope of the support desk.

              Below I have provided instructions for converting indicators from NT7 to NT8, however you could use these to work backwards.

              There is not an official indicator/strategy converter which takes scripts from NT7 and converts them to NT8 however on the forum there is a post which provides script for conversion.



              I’d like to mention its best to do a manual conversion for accuracy as not all scripts are simple enough to be converted directly.

              Also below I’ve provided a link to code breaking changes which you should consider when converting your scripts:



              Converting customer code is out of the scope of NinjaScript support however if you’d like I could have someone from our business development team pass over a list of third party developers that you could contact about debugging your code.

              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by alifarahani, Today, 09:40 AM
              6 responses
              31 views
              0 likes
              Last Post alifarahani  
              Started by Waxavi, Today, 02:10 AM
              1 response
              17 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by Kaledus, Today, 01:29 PM
              5 responses
              14 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by Waxavi, Today, 02:00 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by gentlebenthebear, Today, 01:30 AM
              3 responses
              17 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X