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

Re: Unusual Array Call



PureBytes Links

Trading Reference Links

Thank you Pierre. Let me be clearer about exactly what I'm asking.

The problem is not with the values in MyArray. The values that are returned
to the calling indicator match those values in the function perfectly. So in
fact, the 2-D array was passed correctly to and from the function.

The problem is in the serial values of MyClose before the If...Then
statement vs. after the If...Then statement.

You would think that it should not change, but it does. There is something
going on with TS internal logic that when you hit the "pause" button in
code, then release it after LastBarOnChart, any serial variable "filled" on
the first run through, no longer holds it's historical values.

Perhaps I should just turn MyClose into another array and be done with it.

Regards,

Gene

----- Original Message -----
From: "Pierre Orphelin" <sirtrade@xxxxxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Wednesday, September 25, 2002 8:38 AM
Subject: RE: Unusual Array Call


> It seems that you use a 2 dimension array MyArray[100,2](0)and pass it to
the EL
> fuction
> If I remember, You may only pass  1 dimension array to an EL function that
> should only accept 1 dimension arrays.
> The result that you get  are dependant of the returnes value of the
undocumented
> " Myclose" function, that could return something not related to the array
> populated inside the function.
>
>
> Sincerely,
>
> Pierre Orphelin
> www.sirtrade.com
> TradeStation Technologies representative in France
> Safir-X neurofuzzy logic trading system builder
>
> To subscribe to our FREE trading system newsletter:
> http://www.sirtrade.com/newsletter.htm
>
>
>
>
>
> > -----Message d'origine-----
> > De : Gene Pope [mailto:gene@xxxxxxxxxxxxx]
> > Envoyé : mercredi 25 septembre 2002 06:27
> > À : omega-list@xxxxxxxxxx
> > Objet : Unusual Array Call
> >
> >
> > Here's a query that doesn't appear in the manual... ;~)
> >
> > Please examine the following indicator code that is applied to a 500 bar
> > chart:
> >
>
> --------------------------------------------------------------------------
> >
> > Input:  Price((H+L+C)/3);
> >
> > Vars:  ALoopCount(0), MyClose(0), CallFunction(0);
> >
> > Array: MyArray[100,2](0);   {100x2 array filled with 0's}
> >
> > MyClose = Close;
> > Print(ALoopCount, MyClose);
> > CallFunction = MyFunction(Price, MyArray);
> > ALoopCount = ALoopCount+1;
> >
> > If MyArray[1,2] > 0 then begin  {Wait for MyArray to fill up}
> >     Print(ALoopCount);              {Print Final ALoopCount}
> >     Print(CurrentBar);                {Print How many bars we sent to
the
> > Function, = ALoopCount}
> >     For XX = CurrentBar-1 downto 0 begin
> >         Print(MyClose[XX]);
> >     end;
> > end;
> >
>
> --------------------------------------------------------------------------
> >
> > Now the Function's inputs are:
> >
> > Price(numericSimple);
> > MyArray(numericArrayRef);
> >
> > So, what I intend to happen is for MyFunction to be called on every bar.
All
> > the code after the If...Then is ignored until MyArray is filled.
MyFunction
> > always waits for the LastBarOnChart before it populates MyArray.
> >
> > So after the first run through the data, the following should be true:
> >
> > 1) MyArray is filled, and is available to the calling code. And indeed,
it
> > is.
> > 2) MyClose, a serial variable, should be populated going back to the
very
> > first bar.
> >
> > Here's the puzzle:
> >
> > The first Print Statement correctly shows 500 values of MyClose with the
> > matching ALoopCount. So that part of the code did indeed execute on
every
> > bar.
> >
> > The ALoopCount and CurrentBar Print statements show that the current bar
is
> > still at 500 after the If...then statement, which I'd expect.
> >
> > However, the second Print Statement inside the XX loop, shows only one
value
> > for MyClose for the entire 500 values (and it's not 0, and it's not from
the
> > lastbaronchart either), as if MyClose forgot it's history.
> >
> > Any takers?
> >
> > Best regards,
> >
> > Gene Pope
> >
> >
> >
> >
> >
>