How to automatic draw HLine from given VLine!!! - page 2

 
InvestDad:


Yup.. Still one more problem please :)

The current corresponding VLines and HLines, I need to definite the highest price HLine and the lowest one. From this, I must know "shift value" of the bar which has highest price HLine. How do you come up with a solution for this comparison problem? :P

OK, another loop similar to the other one, this time looking for if(ObjectType(name) == OBJ_HLINE), you want the highest and the lowest, so define 4 variables, double HLineHigh = 0, HLineLow = 0; and int HLineHighBar, HLineLowBar;

Then as you loop through all the H Lines you do two things, read the H line price1, read the corresponding V LIne BarShift, then compare the price against the HLineHigh & HLineLow, so: if (price1 > HLineHigh) { HLineHigh = price 1; HLineHighBar = BarShift } and if ( price1 < HLineLow) {HLineLow == price1; HLineLowBar = BarShift}

When you have looped through all the H Lines you will know the highest and lowest . . . follow ?