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

Re: EasyLanguage Questions



PureBytes Links

Trading Reference Links

You can refer to the values of each data series with an index.

For example, if you wanted to add all the closes of 30 data streams you could say:

  MySum = 0;
  for j = 1 to 30 begin
     MySum = MySum + Close of data(j);
  end;

To put these values in an array you could say:

  for j = 1 to 30 begin
     MyArray[j] = Close of data(j);
  end;

You do not have to declare the data series as inputs so to handle a variable number of data series you could say:

   Input: N(30);

   Vars: j(0);

   Array: MyArray[30](0);
  
   for j = 1 to N begin
      MyArray[j] = Close of data(j);
   end;


Bob Fulks


At 11:26 AM -0700 1/14/03, Brian S. Hanley wrote:
>Hello,
>
>Is there a way to reference inputs with array indices?
>For example, if I have inputs:
>
>   Inputs:
>   CloseS1(c data1),
>   CloseS2(c data2),
>   CloseS3(c data3),
>   {...}
>
>Would there be some way to reference the value of the
>close of the current bar for data N, say, with MyArray[N]?
>
>Right now the only way I seem to be able to do this is:
>
>   Array: MyArray[10](0);
>
>   MyArray[1] = CloseS1;
>   MyArray[2] = CloseS2;
>   {etc,}
>
>So that MyArray[N] then refers to the current bar's close
>for data N.
>
>Also, you can reference the value of a variable at a
>previous bar, correct? So, a second question: with the
>above construct, can I reference the close of data N,
>say, 3 bars ago, with MyArray[N][3]? Or is there some
>other way to do that?
>
>Finally, does anyone know of a good way to pass in
>a variable number of inputs to an indicator? Right
>now I'm doing things such as:
>
>   Inputs: N(2),
>           CloseS1(c data1),
>           CloseS2(c data2),
>           CloseS3(c data3),
>           CloseS4(c data4),
>           {...}
>
>And then changing the value of N in my chart depending
>on how many data series I actually want to use.
>
>Just wondering how much expressive power EasyLanguage has,
>and what I need to work around ...
>
>Any help or feedback is very much appreciated!
>
>Brian