hi guys
I have a code for a tick counter for TS.
It will compile but doesn't seem to do anything on the chart.
Can somebody help me with this as a tick counter will be very beneficial to everybody.
Thanks
Glen
tick counter not working
ok..finally got a tick counter that works..
Here is the code guys.
It works a treat!!
Input: Offset(1), bDrawClose(false), ClosePriceDigits(2), BarsBeforeClose(5);
input: soundFile("c:\WINDOWS\Media\ding.wav"), soundTrigger(1000);
VAR:
IntrabarPersist Bar_Number( 0 ),
IntrabarPersist Bar_Ticks ( 0 ),
TextID(0),
txt(""), snd_ret(true);
//***** Accumulate Intrabar Ticks *****
Bar_Ticks = Bar_Ticks + 1;
// ***** Reset Tick Count Each Bar *****
if BarNumber <> Bar_Number then
begin
Bar_Number = BarNumber;
Bar_Ticks = 0 ;
end; // reset each bar
value1 = BarInterval - Bar_Ticks;
if BarNumber = 1 then
TextID = Text_New(Date, Time, Close, NumToStr(value1, 0))
else
begin
txt = "< " + NumToStr(value1, 0);
if bDrawClose = true then txt = txt + ", " + NumToStr(close, ClosePriceDigits);
Text_SetString(TextID, txt);
Text_SetLocation(TextID, Date, Time + Offset, Close);
Text_SetStyle(TextID, 0, 2);
if value1 <= BarsBeforeClose then
Text_SetColor(TextID, Green)
else
if value1 < BarInterval/3 then
Text_SetColor(TextID, Yellow)
else
if value1 < 2*BarInterval/3 then
Text_SetColor(TextID, LightGray)
else
Text_SetColor(TextID, DarkGray);
if value1 = soundTrigger and soundFile <> "" then snd_ret = PlaySound(soundFile);
end;
Here is the code guys.
It works a treat!!
Input: Offset(1), bDrawClose(false), ClosePriceDigits(2), BarsBeforeClose(5);
input: soundFile("c:\WINDOWS\Media\ding.wav"), soundTrigger(1000);
VAR:
IntrabarPersist Bar_Number( 0 ),
IntrabarPersist Bar_Ticks ( 0 ),
TextID(0),
txt(""), snd_ret(true);
//***** Accumulate Intrabar Ticks *****
Bar_Ticks = Bar_Ticks + 1;
// ***** Reset Tick Count Each Bar *****
if BarNumber <> Bar_Number then
begin
Bar_Number = BarNumber;
Bar_Ticks = 0 ;
end; // reset each bar
value1 = BarInterval - Bar_Ticks;
if BarNumber = 1 then
TextID = Text_New(Date, Time, Close, NumToStr(value1, 0))
else
begin
txt = "< " + NumToStr(value1, 0);
if bDrawClose = true then txt = txt + ", " + NumToStr(close, ClosePriceDigits);
Text_SetString(TextID, txt);
Text_SetLocation(TextID, Date, Time + Offset, Close);
Text_SetStyle(TextID, 0, 2);
if value1 <= BarsBeforeClose then
Text_SetColor(TextID, Green)
else
if value1 < BarInterval/3 then
Text_SetColor(TextID, Yellow)
else
if value1 < 2*BarInterval/3 then
Text_SetColor(TextID, LightGray)
else
Text_SetColor(TextID, DarkGray);
if value1 = soundTrigger and soundFile <> "" then snd_ret = PlaySound(soundFile);
end;
- futurestrader019
- Posts: 79
- Joined: 14 Apr 2007
- Has thanked: 1 time
I tried that tick counter posted by guest and it displays the counter correctly but it puts the counter on the actual candle being formed sometimes. Seems like towards the end of a candle / start of a new one that the counter is displayed on top of the candle.
Any ideas or suggestions?
I'd like a counter that is just right of the current candle being formed and stays there!
Thanks!
Any ideas or suggestions?
I'd like a counter that is just right of the current candle being formed and stays there!
Thanks!
- ABC
- Posts: 722
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact: