Announcement

Collapse
No announcement yet.

Daily Pivot Point on intraday chart

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

  • Daily Pivot Point on intraday chart

    Hi there I need efs help to plot today's pivot point on intraday charts as it is formed relative to the current days (high+low+close)/3.
    Here is an attempt at getting it to work but it does not plot on the chart but on a separate pane.
    function premain(){
    setPriceStudy(true);
    setStudyTitle("PivotPoint");
    setCursorLabelName("PP");
    setDefaultBarThickness(1,0);
    setDefaultBarStyle(PS_SOLID);
    }
    function main(){
    var vTime = getValue("Time");
    if (vTime != null) {
    var vFirstIndex = getFirstBarIndexOfDay( vTime );
    if (vFirstIndex != null) {
    var vHigh = getValueAbsolute("High",vFirstIndex,"ES #F,D");
    var vLow = getValueAbsolute("Low",vFirstIndex,"ES #F,D");
    var vClose = getValueAbsolute("Close",vFirstIndex,"ES #F,D");}}
    var vPP = (vHigh+vLow+vClose)/3;


    return vPP;}

    Any help will be very much appreciated as I am not familiar with efs script
    Regards KV

  • #2
    KV
    Replace premain() with preMain(). That should make it plot in the main window
    Alex

    Comment


    • #3
      Need further help

      Thanks Alexis that did the trick, it works now exept that I have to constantly reload the program so that it will draw a straight line. Is there something I can add to the EFS script so that it will reload automatically after each new intraday bar is formed or better still after each tick of the bar?
      This will then cause a straight line to be formed instead of a squiggly line at the end where the newest line is being formed.
      regards KV

      Comment


      • #4
        KV
        An easy way around would be to use drawLineRelative() instead of returning vPP. The advantage is that it is always a straight line, the disadvantage is that there is no historical plot.
        Anyhow try adding the following in the line just above the return
        drawLineRelative(vFirstIndex,vPP, 0, vPP, PS_SOLID, 2, Color.black, "Line");
        and then remove vPP from the return
        Alex

        Comment


        • #5
          Thank you

          Thanks Alexis.
          That did the trick. Works just fine for me as I am only interested in the present data and don't really need the historical reference here.
          Regards KV

          Comment

          Working...
          X