Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What is wrong with this ?

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

    What is wrong with this ?

    This worked in NT7. When I switched to NT8 I had to hard code the MasterName. I have now tried switching it back and It generates All sorts of errors wiping out All indicators from the chart . Indicators that do not use this. The code swap is as follows.

    MasterName="CL";

    to

    MasterName=Instrument.MasterInstrument.Name.ToStri ng();

    Note their is no sample in the Help guide. So is their something still not working with this.

    Thanks

    #2
    Hello JerryWar,

    Thank you for your post.

    In what context is the string called after being set? Can you provide all lines of code where the string is called and in what functions?
    Example:
    Code:
    Print(MasterName); // in OnBarUpdate
    I look forward to your response.

    Comment


      #3
      dirLong=MasterName+" dirLong.wav"; // Sound wave file name would be "CL dirLong.wav"

      It is then referenced in an Alert() to supply the Sound file.
      MasterName, Hard coded to "CL" works, using Instrument.MasterInstrument.Name.ToString() does not.
      In NT7 it works fine.

      Comment


        #4
        So it appears it only works in State==State.Dataloaded or State==State.Confirgure
        All my sound file names have been set in State == State.SetDefaults because that is what is called
        after you open and close the UI.

        So how do I get around this ?

        Comment


          #5
          Hello JerryWar,

          Thank you for your response.

          Configure would not have the instrument, you would need to use DataLoaded preferably to ensure the data is loaded and thus the instrument.

          Please let me know if you have any questions.

          Comment


            #6
            As I understand it SetDefaults is the only one that is triggered by the UI so if I change the Sound file via the UI how can the Instrument Name get cancatenated if it is only available on DataLoaded which isn't triggered by the UI. How do I get around this issue ?

            Comment


              #7
              Hello JerryWar,

              Thank you for your response.

              If you set the sound file by the UI then I would use a place holder string that reference a specific file, the user can then change that value in the UI. If you want the sound file based on the instrument name then you need to do so in DataLoaded.

              Please let me know if you have any questions.

              Comment


                #8
                Despite the issues that causes i.e No easy way to have Sound files or any files indexed by the Root Symbol installed. It appears illogical to me. The fact you can open a UI for an indicator which has to already be installed on a chart which already has a Root Symbol an that same UI cannot know that Root symbol just doesn't make sense.

                Comment


                  #9
                  Originally posted by JerryWar View Post
                  Despite the issues that causes i.e No easy way to have Sound files or any files indexed by the Root Symbol installed. It appears illogical to me. The fact you can open a UI for an indicator which has to already be installed on a chart which already has a Root Symbol an that same UI cannot know that Root symbol just doesn't make sense.
                  You may be conflating different concepts.

                  I am going to assume that you have multiple different files, that are named by using an instrument name prefix. eg., CLdirlong.wav, ESdirlong.wav, NQdirlong.wav et.c.

                  and you want the user to be able to specify the constant string partial filename that would be appended to an instrument name on the chart or calling medium.

                  In that case, the only part that must be specified in the PropertyGrid would be "dirlong.wav". The concatenation would have to take place when the instrument prefix is available. If you concatenate before the data is available, you will get an undesired result.

                  The first place that the instrument name is available to code is when the data is being loaded: State.DataLoaded. Is there any particular reason why you insist that the chart instrument, which is not yet related to the object whose PropertyGrid is now being configured should show up in the PropertyGrid that, because the object has not yet been applied to the chart, has no relation to the chart yet? The instrument on the chart is not a property of the indicator that you are applying. Why would one expect it to be in the indicator's PropertyGrid.

                  The indicator can only know to what chart it is applied, after it, the indicator is applied to the chart, and the chart data is being loaded. That would be the first time that the indicator can do anything with the chart-instrument's properties.
                  Last edited by koganam; 02-16-2017, 12:33 PM.

                  Comment


                    #10
                    koganam,
                    Thank you for your reply. you grasp exactly what I did that worked well in NT7 and does not now work in NT8. However, I am insisting on Nothing about the properties grid. I was only looking for a work around and pointing out what I believe to be a logical hole in the process. I also agree the indicator cannot do anything with chart until it reloads the data. So obviously a feature got lost in the process with NT8. If the file name is changed in the properties grid which is State.Setdefaults and Root symbol is not available until after State.dataloaded then the new file name is not known.

                    Unless I am mistaken there should be a new state which is something like,

                    If (State.Setdefaults detected && State.Dataloaded detected && Instrument.MasterInstrument.Name!=null )

                    {
                    process file names
                    Clear states detected
                    }

                    but I think this may have a flaw if the indicator is on the chart and the dataSeries is changed on the chart.
                    Last edited by JerryWar; 02-16-2017, 01:43 PM.

                    Comment


                      #11
                      Originally posted by JerryWar View Post
                      koganam,
                      Thank you for your reply. you grasp exactly what I did that worked well in NT7 and does not now work in NT8. However, I am insisting on Nothing about the properties grid. I was only looking for a work around and pointing out what I believe to be a logical hole in the process. I also agree the indicator cannot do anything with chart until it reloads the data. So obviously a feature got lost in the process with NT8. If the file name is changed in the properties grid which is State.Setdefaults and Root symbol is not available until after State.dataloaded then the new file name is not known.

                      Unless I am mistaken there should be a new state which is something like,

                      If (State.Setdefaults detected && State.Dataloaded detected && Instrument.MasterInstrument.Name!=null )

                      {
                      process file names
                      Clear states detected
                      }

                      but I think this may have a flaw if the indicator is on the chart and the dataSeries is changed on the chart.
                      I am not sure that I understand why you think there is a problem, because I am doing the same thing that I did in NT7, and have no problem getting my read strings to include that chart name and period when the indicator announces what I want it to announce. I guess we must be seeing different things.

                      Then again, my ChartId is prepended by the code, and I do not need to see the ChartId reflected in the PropertyGrid, so we are probably talking about different things.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by szferi, Today, 02:04 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post szferi
                      by szferi
                       
                      Started by MidenThur, Today, 12:52 AM
                      0 responses
                      6 views
                      0 likes
                      Last Post MidenThur  
                      Started by seseoraf, Today, 12:51 AM
                      1 response
                      6 views
                      0 likes
                      Last Post charmingishagarg  
                      Started by Rosario, Today, 12:50 AM
                      0 responses
                      4 views
                      0 likes
                      Last Post Rosario
                      by Rosario
                       
                      Started by kemoyums, Today, 12:38 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post kemoyums  
                      Working...
                      X