PureBytes Links
Trading Reference Links
|
: Is there a way to write the high and low of the current bar to the screen
: and have it update in real-time in TS2ki? The data window would be fine,
: but it doesn't update in real-time. When I use "chart options" to display
: the high and low I get the high and low of the day, not the 3 minute bar
I'm
: looking at.
Clyde Lee wrote the code below for just the close; I modified it to find the
Highest High and Lowest Low of a lookback period. In your case, I'd set the
lookback period (Lbck) to one for your 3 min bar (I haven't tried it with a
lookback period of one but I think it'll work.).
Inputs: NumDec(3), {Number of decimal spaces to use on post}
Lbck(10), {Lookback period for Lowest L and Highest H}
Color(white); {Color of text that is posted. }
Vars: DoInit(True), HH(0), LL(0);
Value1=AddTime(T,BarInterval);
If LastBarOnChart then begin
If DoInit then begin
HH=Highest(H, Lbck);
LL=Lowest(L, Lbck);
Value2=Text_New(D,Value1,C,"="+NumToStr(C, numdec));
Value3=Text_New(D,Value1,HH,"="+NumToStr(HH, numdec));
Value4=Text_New(D,Value1,LL,"="+NumToStr(LL, numdec));
end
else begin
Text_SetLocation(Value2,D,Value1,C);
Text_SetString(Value2, "="+NumToStr(C, numdec));
Text_SetLocation(Value3,D,Value1,HH);
Text_SetString(Value3, "="+NumToStr(HH, numdec));
Text_SetLocation(Value4,D,Value1,LL);
Text_SetString(Value4, "="+NumToStr(LL, numdec));
end;
DoInit=False;
Text_SetStyle(value2, 0, 2);
Text_SetColor(Value2,color);
Text_SetStyle(value3, 0, 2);
Text_SetColor(Value3,blue);
Text_SetStyle(value4, 0, 2);
Text_SetColor(Value4,red);
End;
---
|