Announcement

Collapse
No announcement yet.

Help with array

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

  • Help with array

    Hi

    Ive written this script and come across a stumbling block,
    Im trying to show market speed on tick charts by plotting the time difference *in seconds)between bars, I have got tihs far, but it just keeps adding, Can anyone help out with this

    Ive attached where im up to so far
    Attached Files

  • #2
    Help with array

    Also, The reason i have done it this way, is so that i can smooth it by making a average. xlength is set to 1 at the moment, but i would change this to a higher amount.

    Comment


    • #3
      When i want to know the time difference in seconds i do this

      getValue("rawtime", 0) - getValue("rawtime", -1)

      Comment


      • #4
        Help with Array

        Thanks, Ive modified the script but works well in the passed. but not on the current bars, any help would be appreciated.
        Attached Files

        Comment


        • #5
          biswar
          You may find it easier to use the new EFS2 syntax to create your study taking advantage of the efsInternal() function. This function will allow you to create a custom series that you can then feed as a source to the EFS2 builtin study.
          In your script create a separate function called for example calcTimeDiff(). In that function then perform the following calculation directly in the return statement ie

          return rawtime(0)-rawtime(-1);

          Then in main() you can call that function with an efsInternal() call. Once you have done that you have essentially created a custom series which you can now use as a source for the builtin study

          var vTimeDiff = efsInternal("calcTimeDiff");
          var vAvgTimeDiff = sma(3,vTimeDiff);


          At this point return vTimeDiff and vAvgTimeDiff and you have completed your script. In function TimeDiff() you may want to add a condition like for example if(getDay(0)!=getDay(-1)) return; which will prevent a spike on a change of day
          For more information and examples on how to use efsInternal() see this thread
          Note that EFS2 requires eSignal version 7.9 or later
          Alex

          Comment


          • #6
            Thanks

            Thanks alexis works a treat
            Attached Files

            Comment

            Working...
            X