[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: EasyLanguage for "First hour high/low



PureBytes Links

Trading Reference Links

Hi Doug and Terry,


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 verified this statement in real time with the following code:
(indicator set to be updated each tick)

Var: TickNum(0);

TickNum = TickNum + 1;
Print("TickNum : ",TickNum, "  Date : ", Date, "  Time : ", Time);
=====================
 Once the indicator status is set to "On", the TickNum variable is
initialized by the default value you gave to it in Var:TickNum(0) or in the
dialog box;
and TickNum will be incremented by one not for each Ticks but for each 5
mins
But it is printed  with each coming ticks

In order to keep track of ticks, a workaround is to use the HasNums DLL
Create a tick bars chart
insert an indicator in which you increment TickNum by one
export TickNum to the DLL
and import TickNum into the 5 mins bar chart





>
> 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.
=============
in order to determine if a stock is in an indice, you could create a signal
with a string array in which you would store each stock names
then use a For Loop to scan the array
create and insert an indicator for each stock you follow, and put in this
indicator an includeSystem statement (IncludeSystem: "StockIndexSystem";) in
order to insert the following code:

{StockIndexSystem}
Variable: MyCondition(False),MyStock("");
Array:StockIndex[10]("");


StockIndex[1] = "OMGA";
StockIndex[2] = "MSFT";
StockIndex[2] = "CSCO";
{You have to insert here all the stock names.....}

MyStock = GetSymbolName;

For value1 = 1 to 10 begin
	If 	StockIndex[value1] = MyStock then MyCondition = True;

End;
If MyCondition then begin
	Print(MyStock, " is in this indice");
	 {Do what you want}
end	else begin
	 Print(MyStock," is not in this indice");
	{Do something else}
end;
===============

Greetings from Paris,

Philippe