Announcement

Collapse
No announcement yet.

first hour high and low

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

  • first hour high and low

    I would like a study that would plot the first hour high and low as vertical lines on the chart, RTH only. Thanks for any help.

  • #2
    scolberg13
    One way to do it is the following (the example is for drawing a vertical line on the bar with the highest High in the first hour)
    Create a global variable (ie outside of function main) called for example vHigh and set it initially to 0

    PHP Code:
    var vHigh 0
    Then in main you first set the value of vHigh to the High at 9:30

    PHP Code:
    if((getHour(0)*100)+getMinute(0)==930){
            
    vHigh=high(0)
        } 
    Then in between the hours of 9:30 and 10:30 you check if the current High is higher than vHigh and draw a vertical line on the bar with the highest High

    PHP Code:
    if((getHour(0)*100)+getMinute(0)>=930&&(getHour(0)*100)+getMinute(0)<=1030){
            if(
    high(0)>=vHigh){
                
    vHigh high(0);
                
    drawLineRelative(000Infinity*1PS_SOLID,1Color.blue"high"+getDay(0));
            }
        } 
    Note that in order to draw only one line per day I use getDay(0) as the counter for the TagName parameter.
    Add the logic for the Low and you should see the two vertical lines on the bars with the highest/lowest High/Low in between 9:30 and 10:30
    Alex




    Originally posted by scolberg13
    I would like a study that would plot the first hour high and low as vertical lines on the chart, RTH only. Thanks for any help.

    Comment

    Working...
    X