Announcement

Collapse
No announcement yet.

drawOHLC.efs

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • drawOHLC.efs

    File Name: drawOHLC.efs

    Description:
    Use graphics commands to draw OHLC information for a spread.

    Formula Parameters:
    nBarThickness: Default is 3
    nNumBars: Default is 60

    Notes:
    This formula will not draw OHLC info for historical bars. The information is only drawn on the current bar as new bars come in during real time and will store up to 60 bars of information going forward.

    Download File:
    drawOHLC.efs




    EFS Code:
    PHP Code:
    /*********************************
    Provided By : eSignal. (c) Copyright 2003
    *********************************/
    function preMain() {
        
    setPriceStudy(true);
        
    setShowCursorLabel(false);
    }

    var 
    colorBG null;
    var 
    colorOpen null;
    var 
    colorClose null;
    var 
    vOpen;
    var 
    vHigh;
    var 
    vLow;
    var 
    vClose;
    var 
    DrawCntr 0;
    var 
    vLoading true;

    function 
    main(nBarThicknessnNumBars) {
        if (
    nBarThickness == null) {
            
    nBarThickness 3;
        }
        if (
    nNumBars == null || Math.abs(nNumBars) > 60) {
            
    nNumBars 60;
        }
        
        var 
    nBarState getBarState();

        if (
    getCurrentBarIndex() == 0) {
            
    vLoading false;
        }
            
        var 
    vPrice close();
        if (
    nBarState == BARSTATE_NEWBAR) {
            if (
    vLoading == false) {
                
    colorBG null;
                
    colorOpen null;
                
    colorClose null;
                
    vOpen vPrice;
                
    vHigh vPrice;
                
    vLow vPrice;
                
    vClose vPrice;
            }
            
    DrawCntr += 1;
            if (
    DrawCntr nNumBars) {
                
    DrawCntr 0;
            }
        }

        if (
    vLoading == false) {
            
    vHigh Math.max(vPricevHigh);
            
    vLow Math.min(vPricevLow);
            
    vClose vPrice;
            
    //open
            
    if (nBarState == BARSTATE_NEWBAR) {
                
    drawLineRelative(-1vOpen0vOpenPS_SOLID1Color.blue"Open" DrawCntr);
            }
            
    //high - low
            
    if (vClose >= vOpen) {
                
    colorHL Color.green;
            } else {
                
    colorHL Color.red;
            }
            
    drawLineRelative(0vHigh0vLowPS_SOLIDnBarThicknesscolorHL"HL" DrawCntr);
            
    //close
            
    drawLineRelative(0vClose1vClosePS_SOLID1Color.lime"Close" DrawCntr);
        }
        
        return;

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation
Working...
X