PureBytes Links
Trading Reference Links
|
Hello,
>These both generate the same value neither of which is accurate:
VolumeSumB = Sum(Ref(Volume, -1), 3);
VolumeSumB = Ref(Sum(Volume, 3), -1);
They are BOTH accurrate and correct.
You do not understand what I wrote you.
Your manual formula
VolumeSumA = Volume[i-1] + Volume[i-2] + Volume[i-3];
is WRONG in the sense that it DOES NOT generate ARRAY.
It overwrites the same SCALAR value (VolumeSumA) instead
of calculating ARRAY. It is essentially LastValue( VolumeSumB ) !
Correct formula would be:
VolumeSumA = Null;
for( i = 3; i< BarCount; i++ )
{
VolumeSumA[ i ] = Volume[i-1] + Volume[i-2] + Volume[i-3];
}
And this will yield exactly same result as VolumeSumB.
You SHOULD REALLY READ THIS:
http://www.amibroker.com/guide/h_understandafl.html
Without understanding difference between SCALAR and ARRAY you will be
making mistakes over and over again.
Best regards,
Tomasz Janeczko
amibroker.com
On 2010-03-05 18:55, davemabe2000 wrote:
> These both generate the same value neither of which is accurate:
>
> VolumeSumB = Sum(Ref(Volume, -1), 3);
> VolumeSumB = Ref(Sum(Volume, 3), -1);
>
> --- In amibroker@xxxxxxxxxxxxxxx, Aron<aron.groups@xxx> wrote:
>
>> have you tried:
>>
>> VolumeSum = sum(Volume, 3);
>> VolumeSumB = ref(VolumeSum, -1);
>>
>> On 3/5/2010 5:43 PM, davemabe2000 wrote:
>>
>>> I'm trying to add the volume of the three previous bars (not including the current one) in my backtest.
>>>
>>> If I sum them up "manually" I get one value:
>>>
>>> VolumeSumA = Volume[i-1] + Volume[i-2] + Volume[i-3];
>>>
>>> But when I try using Sum and Ref to do it I get a different value for some reason.
>>>
>>> VolumeSumB = Sum(Ref(Volume, -1), 3);
>>>
>>> But VolumeSumA != VolumeSumB.
>>>
>>> What should I be using for Sum and Ref to get it to work properly and equal VolumeSumA above?
>>>
>>>
>>>
>>> ------------------------------------
>>>
>>> **** IMPORTANT PLEASE READ ****
>>> This group is for the discussion between users only.
>>> This is *NOT* technical support channel.
>>>
>>> TO GET TECHNICAL SUPPORT send an e-mail directly to
>>> SUPPORT {at} amibroker.com
>>>
>>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>>> http://www.amibroker.com/feedback/
>>> (submissions sent via other channels won't be considered)
>>>
>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>> http://www.amibroker.com/devlog/
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>
>
>
>
> ------------------------------------
>
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> TO GET TECHNICAL SUPPORT send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> Yahoo! Groups Links
>
>
>
>
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@xxxxxxxxxxxxxxx
amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|