PureBytes Links
Trading Reference Links
|
Hi,
> I have some limited understanding of how it discerns the series data.
>
> I think my problem stems from variable scoping questions: for example, why
> does count not get set to zero at each invocation of this function?
>
The first time a variable is referenced, EL initializes it to the
value given when the variable was declared in the "Variables:"
section. The variable keeps any value assigned to it from that
point on. In C/C++ parlance the variable would be known as
static. This is true for function as well as indicator variables.
Having said this you should know that EL reinitializes all data
to its value at the beginning of the bar period before each call
made to an indicator.
For example, assume you are using 5 min bars, an indicator that
is updated each tick and your indicator has the following
statement in it
TickNum = TickNum + 1;
You would think think this would be a good way to keep track of
ticks. But it will not work. If TickNum = 25 when the indicator
is called for the first tick in a new bar your code will set
TickNum to 26. When the next tick occurs TS resets the value or
TickNum to 25 and calls your indicator again. You code sets
TickNum to 26 once again. This continues until the first tick of
the next bar at which time TS leaves TickNum set to 26 when it
calls your indicator.
> I understand it scans bars oldest to newest, and when the "Autoscan" feature
> is on, it can figure out in RadarScreen exactly how many bars are needed to
> scan (determine MaxBarsBack).
>
> Assuming the example works (and I have not tested it but have no reason to
> doubt it), this indicates that count (ant hence the rest of the vars) would
> be initialized only once when the indicator is started, but not for each
> bar. This works fine for a TradeStation indicator, certainly, as if you have
> enough bars, it will eventually get a count > 13, and voila, you're happy.
>
> However, in RadarScreen, it only scans the fewest number of bars possible.
Your analysis is correct, but there is a way around this. Go to
the properties dialog for the indicator, The General tab has a
checkbox to Load additional data for accumulative calculations,
check it and set the number of additional bars to a value high
enough to always include at least 1 days data when the indicator
is spawned.
>
> One more question: Is it possible to determine in EasyLanguage what indices
> a stock is in? For example, to be able to set an indicator true given a
> single security (e.g. IBM) such that:
>
> 1) The security is up from yesterday's close
> 2) The security's sector is up (lookup that security's sector index)
> 3) The market is up (S&P is up or possibly Ru2k, etc, depending on which
> one)
>
There is no way to do this without using DLLs and building an
external database containing the relations. If anyone has done
this work already I would be interested in hearing about it. If
anyone is interested in working on such a project cooperatively I
would also be interested in hearing from them.
regards,
tbr
|