Announcement

Collapse
No announcement yet.

constructing efs for price channel

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

  • constructing efs for price channel

    is there anyone who could lend me a hand on this?

    what i am trying to do here is to create a price channel which plot the highest of bar-high(1..5) on bar(0), and only on the current/last day.

    at this stage, i am still trying to get the numbers right before putting it on the chart. how unfortunately, i have trouble using&understanding the functions, hhv() & highest(). and i have used 'if (bar_cur >= -5)' & 'if (bar_cur>-2)' to limit the testing range in the efs, without having my esignal crash (i crashed es earlier while testing this).

    btw, i can't seem to be able to explain it to myself, why would the formula output looks different, if i add the 'debugPrintln();' at where i indicated. and i can't export/copy+paste the output result in order to show you in this post. in case, anyone who could lend a hand, please try the efs with/out the indicated 'debugPrintln();' line.

    thx.
    Attached Files

  • #2
    dietcoke2000

    what i am trying to do here is to create a price channel which plot the highest of bar-high(1..5) on bar(0)
    A simple way to accomplish what you want is to use the upperDonchian() function (which calculates by default the highest value of the High over the specified period) and return to the current bar its prior bar value. See the link for the description and syntax of the function. You may also want to review this thread for a complete series of examples on how to use the builtin studies functions
    In the case of your example you would write
    PHP Code:
    var HighestHigh upperDonchian(5,-1); 
    The first parameter is the lookback period (or length) and the second is the bar index which is set to -1 to retrieve the prior bar's value.

    and only on the current/last day
    See this thread for a complete example of the logic required to plot only on the current day.

    and i can't export/copy+paste the output result in order to show you in this post
    The contents of the Formula Output Window are stored in the formulaouput.log file which is in the eSignal folder and can be copied from there. Note that they are in reverse order (ie most recent output at the end of the file) respect to what is displayed in the Formula Output Winow.
    Alex

    Comment

    Working...
    X