Announcement

Collapse
No announcement yet.

High/Low/Median

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

  • High/Low/Median

    How can I plot a thick line across a chart of the high price for the last three days? I tried a formula I found on here but it did not work properly. Any help would be graciously appreciated.

  • #2
    Chris
    Try the enclosed efs. This includes the current day as part of the three days. If instead you want the past three days the change to get those values is easy enough.
    Alex

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("3dayhilo");
        
    setShowCursorLabel(false);
          
    }
    function 
    main() {

    var 
    vSymbol getSymbol();
        
    vSymbol += ",D";

    var 
    vHigh getValue("High",0,-3,vSymbol);
    var 
    vLow  getValue("Low",0,-3,vSymbol);

    var 
    vHH Math.max(vHigh[0],vHigh[1],vHigh[2]);
    addBand(vHH,PS_SOLID,3,Color.blue,"high");

    var 
    vLL Math.min(vLow[0],vLow[1],vLow[2]);
    addBand(vLL,PS_SOLID,3,Color.red,"low");

    return;

    Comment

    Working...
    X