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

Re: [amibroker] Array logic



PureBytes Links

Trading Reference Links

You have these statements like this
SVS = IIf(Filter = (EV < Volumeamount), EV, 0 );
remove the 'filter='
SVS = IIf(EV < Volumeamount, EV, 0 );

In this statement, if HighClose == Lowclose then you will get a divide by zero which gives error
<< maybe check this with explorations to see if this occurs
EV = abs(Todayclose-yesterdayclose)/(HighClose-Lowclose)*Volume;
change to, using Nz which convert null values to zero
EV = nz(abs(Todayclose-yesterdayclose)/(HighClose-Lowclose)*Volume);

together with the Cum as mentioned before

--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://www.aflwriting.com


On 23/02/07, dbw451 <dbw451@xxxxxxxxxxx> wrote:

Nick, use the Cum function instead of the loop to calculate SVS_VF:

 

SVS_VF = Cum (SVS);

 

I think the first value of SVS (i.e. SVS[0]) must be NULL which is causing your calculation to sum as NULL.

 

Regards,

 

David

 


From: amibroker@xxxxxxxxxxxxxxx [mailto: amibroker@xxxxxxxxxxxxxxx] On Behalf Of NickCivit
Sent: 02/22/2007 6:28 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Array logic

 

I thought I had my problem solved from a previous post but still
having trouble. I am obviously new,but am trying hard to learn.I saw a
formula in a book I read and thought I'd give it a try. I have most of
it working but I can not total the array properly. When I run an
exploration the SVS_VF column is blank. If it was working properly it
should show a running total of volume. Not sure what I am doing wrong
any help appreciated.

thank you
Nick C.

_SECTION_BEGIN("Effective Volume");
/* Create date: 13 Feb 2007
The Close Price of the current bar is greater than the Close Price of
1 bar ago */

TodayClose = Close;
TodayLow=Low;
yesterdayclose=Ref(Close,-1);
HighClose=Max(TodayClose,YesterdayClose);
LowClose=Min(TodayLow,YesterdayClose);

EV = abs(Todayclose-yesterdayclose)/(HighClose-Lowclose)*Volume;

VolumeAmount = 10000;
SVS = IIf(Filter = (EV < Volumeamount), EV, 0 );
SVS=IIf(TodayClose > YesterdayClose,SVS,-SVS);
LVS = IIf(Filter = (EV > VolumeAmount), EV, 0 );
Lvs = IIf(TodayClose > YesterdayClose,LVS,-LVS);

SVS_VF=SVS;

LVS_VF = LVS;

for(i=1;i<BarCount;i++)
{
SVS_VF[i] = SVS_vf[i-1] + SVS[i];
}

_Section_End();

/*_SECTION_BEGIN("Small Volume");
SetChartOptions(0,chartShowDates);
//SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 200, 1 );
Plot( SVS,"Small Volume", ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
_SECTION_END();

_SECTION_BEGIN("LargeVol");
SetChartOptions(0,chartShowDates);
//SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 200, 1 );
Plot( LVS,"LargeVol", ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
_SECTION_END();*/

AddColumn( Open, "Open " );
AddColumn( Close, "Close " );
AddColumn( Volume, "Volume " );
AddColumn( EV, "EVVolume " );
AddColumn( SVS, "SVS " );
AddColumn( Svs_VF, "SVS_VF " );
AddColumn( LVS, "LVS " );
AddColumn( LVS_VF, "LVS_VF " );
Filter=1;




__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___