Announcement

Collapse
No announcement yet.

high of a specific bar throughout the day

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

  • high of a specific bar throughout the day

    Is there a way to use the high() function to retrieve the high of a specific bar no matter what the current time of day happens to be?

    For example, the high of the most recent 9:30 15 minute bar.

    TIA.

  • #2
    Hello davemabe,

    Yes there is. The best way to accomplish this is to create a series for these specific bars using efsInternal() in combination with high(). To get the high from the specified time stamp the series will also need to check the bar's time stamps with a combination of hour(), minute() and/or second(). Try the following.

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("High - 09:30");
        
    setCursorLabelName("0930 High");
        
    setShowTitleParameters(false);
        
    setPlotType(PLOTTYPE_FLATLINES);
        
    setDefaultBarThickness(2);
        
        var 
    fp1 = new FunctionParameter("nTime"FunctionParameter.NUMBER);
            
    fp1.setName("Bar Time");
            
    fp1.addOption(830);
            
    fp1.addOption(930);
            
    fp1.addOption(1030);
            
    fp1.setDefault(930);
    }

    var 
    xHigh null;

    function 
    main(nTime) {
        if (
    xHigh == nullxHigh efsInternal("getHigh"nTime);
        
        var 
    nHigh xHigh.getValue(0);
        if (
    nHigh == null) return;
        
        return 
    nHigh;
    }


    var 
    null;

    function 
    getHigh(nT) {
        var 
    barTime hour(0)*100 minute(0);
        if (
    barTime == nThigh(0);
        
        return 
    h;

    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

    Comment


    • #3
      Is it really necessary to code and call a function?

      Can't you just store the high if the bar's time is the specified time?

      Comment

      Working...
      X