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

NOMath Error in TS 2000



PureBytes Links

Trading Reference Links

Someone wrote
Tradestation code error....

>>This is not my actual indicator, but a simplified example.
>>I set MaxBarsBack to 12}
>>
>>
>>if CurrentBar = 1 then value99 = MaxBarsBack-1;
>>value1 = UpTicks;
>>value2 = DownTicks;
>>value3 = Volume;
>>
>>value4 = value1*value3;
>>value5 = value2*value3;
>>
>>value6 = 0;

OK. You set it to  0 before rentering the  for loop.

>>For value0 = 0 to value99 begin
>>   value6 = value6 + value4[value0]-value5[value0];

Now, at the first iteration  (value0=0), value6 is not equal to  0
 but value4[value0]-value5[value0], or value4-value5, usually <>0.


YOUR error is here:
===============
Value6 , during the 2nd line of the for loop has this value, and not 0 , because the first line of the loop has already updated it
Look to you code: you are adding something in value7 by adding it to value6, no more set to 0.
So, under tese conditions, you cannot expect to see value6= value7 when exiting the loop, even  with value0 =1

>>   value7 = value6 + value3[value0]*(value1[value0]-value2[value0]);
>>end;
>>Print(value6," ",value7);
>


Financial analyst should take note:
 this bug do not call for a downgrading of OMGA stock.

Rgds

-Pierre Orphelin
Représentant exclusif de Omega Research en France.
web: http://www.sirtrade.com