Wednesday, June 11, 2008

Hi-Low Bars

Inputs: HiColor(darkgreen), LoColor(red);

Variables: DHigh(0), DLow(0);

If Date <> Date[1] then begin //High and low of 1st bar of the day are captured
DHigh = High;
DLow = Low;
Value1 = Text_New(Date, Time, High, NumToStr(High, 2)); //Text with high and low are placed above
Value2 = Text_New(Date, Time, Low, NumToStr(Low, 2)); //and below, respectively, the 1st bar of each day
Text_SetStyle(Value1, 2, 1);
Text_SetColor(Value1, HiColor);
Text_SetStyle(Value2, 2, 0);
Text_SetColor(Value2, LoColor);
else begin //Subsequent bars' highs and lows are captured if they exceed
If High > DHigh and Value1 >= 1 then begin //the highs and lows of the 1st bar of the day
DHigh = High;
Text_SetLocation(Value1, Date, Time, High); //If there are new highs or lows that day, then the text objects for that
Text_SetString(Value1, NumToStr(High, 2)); //day are moved, and changed to read the new high and low
If Low < DLow and Value2 >= 1 then begin
DLow = Low;
Text_SetLocation(Value2, Date, Time, Low);
Text_SetString(Value2, NumToStr(Low, 2));

No comments: