PureBytes Links
Trading Reference Links
|
I still don't think I am referencing or storing the array variables
correctly. Could some one take a serious look?
TIA
Ned
Code:
Vars: StopPrice(0), MP(0);
Arrays: SLow[2](0), SHigh[2](0);
MP=MarketPosition;
If high[5]<=high[3] and high[4]<=high[3] and
high[2]<=high[3] and high[1]<=high[3]
Then SHigh[2] = SHigh[1];
SHigh[1] = SHigh[0];
SHigh[0] = high[3];
If low[5]>=low[3] and low[4]>=low[3] and
low[2]>=low[3] and low[1]>=low[3]
Then SLow[2] = SLow[1];
SLow[1] = SLow[0];
SLow[0] = low[3];
If entryprice - contractprofit < SLow[0] then{}
StopPrice = SHigh[1];
ExitShort ("CRXS") StopPrice Stop;
If entryprice + contractprofit > SHigh[0] then {}
StopPrice = SLow[1];
ExitLong ("CRXL") StopPrice Stop;
-----Original Message-----
From: unicorn@xxxxxxxxx [mailto:unicorn@xxxxxxxxx] On Behalf Of Alex
Matulich
Sent: Wednesday, October 22, 2003 9:41 PM
To: omega-list@xxxxxxxxxx
Subject: Re: [SM] Code Help Please
Dennis:
>> Arrays: SLow[1](0), SHigh[1](0);
>
>You are only providing one slot in your arrays.... the [1].
>
>If you want to save 2 values, all initialized to a value of 0, it would
>be:
>Array: SLow[2](0);
No, he was correct. The array declaration statement specifies the
maximum value of the array index, not the number of elements in the
array. Here's an example quoted from the TS2Ki reference manual:
For example, the following statement declares a one-dimensional
array with a total of 6 elements:
Array: MyArray[5](0);
The array called MyArray will have elements 0, 1, 2, 3, 4, and
5. The elements in this array will start with a value of zero (0).
The following Array Declaration statement declares a
3-dimensional array with a total of 726 elements:
Array: MyBigArray[10, 10, 5](0);
The array MyBigArray will hold a maximum of 726 elements
(11x11x6) and all elements will begin with a value of zero (0).
--
,|___ Alex Matulich -- alex@xxxxxxxxxxxxxx
// +__> Director of Research and Development
// \
// __) Unicorn Research Corporation -- http://unicorn.us.com
|