Announcement

Collapse
No announcement yet.

Net Change & % calculation

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

  • Net Change & % calculation

    I'm hoping someone can help me with the following efs.
    The calculations for Net Change and Net % Change don't work properly for Australian Indices.
    During trading hours the values are calculated from 2 days ago rather than the previous day.
    Strangely I don't seem to have this problem with U.S. Indices.
    Any help would be greatly appreciated.

    Eric

    function preMain() {

    setPriceStudy(true);
    setStudyTitle("XJO Price")
    setShowCursorLabel(false);
    }

    function main() {

    var vSymbol = close(0, -3, "$XJO-ASX,D");
    var vChange = vSymbol[0]-vSymbol[1];
    var vChngPct = ((vSymbol[0]-vSymbol[1])/vSymbol[1])*100

    if(vChange>=0){
    drawTextRelative(2,375,"$XJO-ASX: "+vSymbol[0].toFixed(2)+" Net: "+vChange.toFixed(2)+" Net%: "+vChngPct.toFixed(2),
    Color.blue,null,Text.RELATIVETOLEFT|Text.BOLD|Text .RELATIVETOBOTTOM,"MS Sans Serif",12,1);
    }
    if(vChange<0){
    drawTextRelative(2,375,"$XJO-ASX: "+vSymbol[0].toFixed(2)+" Net: "+vChange.toFixed(2)+" Net%: "+vChngPct.toFixed(2),
    Color.red,null,Text.RELATIVETOLEFT|Text.BOLD|Text. RELATIVETOBOTTOM,"MS Sans Serif",12,1);
    }
    return ;
    }

  • #2
    Eric
    When you say "During trading hours..." do you mean Australian trading hours?
    Also what time zone is the computer set to?
    Alex

    Comment


    • #3
      Hello Alex,

      I am referring to Australian trading hours and the computer is set to East Australian Standard Time (GMT+10:00)
      I've enclosed a snapshot from yesterday to highlight the difference as can be seen in the "Quote Window".

      Eric
      Attached Files

      Comment


      • #4
        Eric
        As far as I can see at my end the efs seems to return the correct values.
        I set my computer's time to GMT+10 and loaded the efs on a daily chart of $XJO-ASX during Australian market hours (all times shown in the charts are GMT+10). As you can see in the image enclosed below the values returned by the efs match those of the Snapshot Window and of the Quote Board
        Alex

        Comment


        • #5
          Alex,

          I can't seem to get it to work properly - all my settings appear to be OK.
          Would the time format on the computer make any difference ?

          Eric
          Attached Files

          Comment


          • #6
            Alex,

            I managed to get it working by closing down the ESignal platform and Data Manager and re-starting.
            I had E-Signal running prior to the market open, so that would account for the script looking back 2 days rather than the previous day I suppose.
            I originally did try refreshing the screen by holding down the "control" key and clicking "OK" in the Cursor Window, but that had no effect.
            Is there some way around this problem by forcing a reset within the efs ?

            Many thanks,
            Eric

            Comment


            • #7
              Eric
              Clicking OK in the Cursor Window while holding the Ctrl key should refresh the chart.
              Make sure that the chart that is being refreshed is the Daily as that is the interval the efs is calling
              Alex

              Comment


              • #8
                Alex,

                Thanks, refreshing the Daily chart after the market has opened has resolved the problem.
                Is there a way of programming an efs so that it is not necessary to do this ?
                Any clues would be greatly appreciated.

                Eric

                Comment


                • #9
                  Eric
                  As far as I know there isn't
                  Alex

                  Comment

                  Working...
                  X