PureBytes Links
Trading Reference Links
|
Sven Hedrich <shedrich@xxxxxx> writes:
>I have a problem with restricting alerts on live charts...
>I want to get an alert notification after the first occurance of the
>given condition (avg crosses avg). Afterwards I don't want to be
>informed anymore, until it the condition happens again. With other
>words: I'm not interested in receiving more than one alert
>notification per day.
>...
>if FirstTradeDay=0 then begin
> counter = 0;
> print("COUNTERCHECK2 ",counter);
>end;
>
>the variable counter should be reset every day...
>Unfortunately counter is being reset...
You've run into the infamous EL fact of life that variables'
values are not "remembered" until the close of that bar. So
when each tick arrives, counter will still have the value
it had after the close of the previous bar, even though you
set it to zero in your code above. The code runs every tick,
but it runs as though it was running for the first time this bar.
The only way around this is to use a global variable package to
remember the values you need.
I'm speaking for TS 4 and earlier; I don't know if TS2K (or
whatever it's calling itself these days) has a workaround for
this problem.
Jim
|