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

Re: Coding StdDev of Individual Trade Returns



PureBytes Links

Trading Reference Links

Hello List,

Thanks to all who replied with suggestions to my problem. 

After a lot of trial and error using ExpertCommentary as a debugger, I
discovered there were multiple problems with the calculations in my
attempt to send the StdDev of individual trade returns to a csv file.

At M.Simms suggestion I wrote code to put the individual trade returns
into an array as the trades are being closed during the run. The reason?
According to M.Simms, historical statistics like PositionProfit(x) and
ExitPrice(x) are unreliable when x > 30. Correcting this solved part of
the problem.

Another problem was that the following original Omega functions are
screwed up - Average_a(AvgArray, Array_Size), StdDevP_a(StdDevArray,
Array_Size), & StdDevS_a(StdDevArray, Array_Size).

The common problem shared by all these original Omega functions is that
they exclude the "zero" array element when they loop through the array
values.

Example from Average_a function:


Inputs: AvgArray[size](NumericArrayRef), Array_Size(Numeric);
Variables: Sum(0), Counter(0);

Sum = 0;
Counter = 0;

{*************************************************************}
{**The loop starts at Value1 = 1, when it should start at Value1 = 0**}

For value1 = 1 To Array_Size Begin 
	Sum = Sum + AvgArray[value1];
	Counter = Counter + 1;
End;

{*************************************************************}

If Counter <> 0 Then
	Average_a = Sum / Counter
Else
	Average_a = -1;



I don't know if correcting these functions has already been covered on
The List. I'm sure these aren't the only faulty ones in 2000i. 

At any rate, I rewrote the 3 functions mentioned above. They're
attached. I've tested them and can't get them to mess up, so I believe
them to be bug free. However, if anyone out there finds other problems
with them please share. 

This makes me wonder what else is messed up with 2000i.

Lance Fisher

Attachment: Description: "ARRAYFUNCTIONS.ELA"