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

Re: [amibroker] Re: Bill re: Coding Question



PureBytes Links

Trading Reference Links

// Volume

Color =  
IIf(Close>Ref(C,-1),colorGreen,IIf(Close<Ref(C,-1),colorRed,colorBlack));
Plot(V,"Volume ", Color, styleHistogram+styleThick,0 );
GraphXSpace = 0;



_SECTION_BEGIN("Intraday Average Volume");
// Intraday Average Volume

TimeFrameSet(inDaily);
TradeDate1 = Ref(DateNum(),-1);
TradeDate2 = Ref(DateNum(),-2);
TradeDate3 = Ref(DateNum(),-3);
TradeDate4 = Ref(DateNum(),-4);
TradeDate5 = Ref(DateNum(),-5);
TradeDate6 = Ref(DateNum(),-6);
TradeDate7 = Ref(DateNum(),-7);
TradeDate8 = Ref(DateNum(),-8);
TimeFrameRestore();

TD1 = LastValue(TradeDate1);
TD2 = LastValue(TradeDate2);
TD3 = LastValue(TradeDate3);
TD4 = LastValue(TradeDate4);
TD5 = LastValue(TradeDate5);
TD6 = LastValue(TradeDate6);
TD7 = LastValue(TradeDate7);
TD8 = LastValue(TradeDate8);

x1 = BarsSince(DateNum()==TD1);	
x2 = BarsSince(DateNum()==TD2);
x3 = BarsSince(DateNum()==TD3);
x4 = BarsSince(DateNum()==TD4);
x5 = BarsSince(DateNum()==TD5);
x6 = BarsSince(DateNum()==TD6);
x7 = BarsSince(DateNum()==TD7);
x8 = BarsSince(DateNum()==TD8);

CumVol1 = Sum(V,x1);				// cum vol today
CumVol2 = Sum(V,x2)-Sum(V,x2-x1);		// cum vol 1 day
CumVol3 = Sum(V,x3)-Sum(V,x3-x1);		// cum vol 2 days
CumVol4 = Sum(V,x4)-Sum(V,x4-x1);		// cum vol 3 days
CumVol5 = Sum(V,x5)-Sum(V,x5-x1);		// cum vol 4 days
CumVol6 = Sum(V,x6)-Sum(V,x6-x1);		// cum vol 5 days
CumVol7 = Sum(V,x7)-Sum(V,x7-x1);		// cum vol 6 days
CumVol8 = Sum(V,x8)-Sum(V,x8-x1);		// cum vol 7 days

V0 = CumVol1-Ref(CumVol1,-1);		// vol today
V1 = CumVol2-Ref(CumVol2,-1);		// vol 1 day ago
V2 = CumVol3-Ref(CumVol3,-1);		// vol 2 days ago
V3 = CumVol4-Ref(CumVol4,-1);		// vol 3 days ago
V4 = CumVol5-Ref(CumVol5,-1);		// vol 4 days ago
V5 = CumVol6-Ref(CumVol6,-1);		// vol 5 days ago
V6 = CumVol7-Ref(CumVol7,-1);		// vol 6 days ago
V7 = CumVol8-Ref(CumVol8,-1);		// vol 7 days ago

AvgVol = (V1+V2+V3+V4+V5+V6+V7)/7;		// 7 Day Average
diff = v0 - AvgVol;

Filter = DateNum()==Now(3);
AddColumn(O," Open  ",1.2);
AddColumn(H," High  ",1.2);
AddColumn(L,"  Low  ",1.2);
AddColumn(C," Close  ",1.2);
AddColumn(v0,"    Today   ",1.0);
AddColumn(Avgvol,"   Average   ",1.0);
AddColumn(diff,"Difference", 1.0 , IIf( diff < 0, colorRed, colorDefault),  
colorDefault );
AddColumn( Cum(diff),"Cumulative", 1.0 , IIf( Cum(diff) < 0, colorRed,  
colorDefault), colorDefault );

x = IIf(DateNum()==Now(3),Avgvol,Null);
Plot(x,"Average",ParamColor( "Average Color", colorWhite  
),styleLine|styleThick);

_SECTION_END();







On Fri, 19 Nov 2004 01:03:54 -0000, jism1992 <gdihia@xxxxxxxxxxx> wrote:

>
>
> Would you please share that AFL file? Thanks.
>
> --- In amibroker@xxxxxxxxxxxxxxx, "W Schmidt" <william.schmidt@xxxx>
> wrote:
>> Dean,
>>
>> 1)I sent to your email address a revised program which doesn't
> require you
>> to enter tradedates.
>> 1)The "Now(3)" restricts the output to the current day only.  You
> don't
>> have to change it.
>>
>>
>> On Thu, 18 Nov 2004 17:45:32 -0000, Dean Hodgins
> <deanhodgins@xxxx>
>> wrote:
>>
>> >
>> >
>> > --- In amibroker@xxxxxxxxxxxxxxx, "W Schmidt"
> <william.schmidt@xxxx>
>> > wrote:
>> >
>> >> Dean,
>> >>
>> >> To answer your question, a price move accompanied by volume
> higher
>> > than average seems to be more significant than a price move on
> lower
>> > than average volume. Watching intraday volume without the
> reference
>> > of an  average doesn't mean much since volune is typically
> greater at
>> > the beginning and end of the day than in the middle.
>> >
>> >> I added the plot function to the code below. Just paste it into
>> > Indicator
>> >> Builder.
>> >
>> >> --Bill
>> >
>> >> Many thanks again Bill - you're right of course - price movements
>> > accompanied by volume increases are likely to be more significant
>> > than price increases with little volume increase. I must admit I'm
>> > one of many who don't pay as much attention to volume as I should.
>> >
>> > The code you were kind enough to share is very useful in terms of
>> > further refining my scans which (until now) have not really
>> > considered volume as a determining factor. Indicator code also
> very
>> > useful.
>> >
>> > Two questions if I may ....
>> >
>> > I assume that I need to change the dates each day accordingly on
> the
>> > following lines of code as appropriate:
>> >
>> > TradeDate1 = 1041117; // trade date 1 day ago
>> > TradeDate2 = 1041116; // trade date 2 days ago
>> > TradeDate3 = 1041115; // trade date 3 days ago
>> > TradeDate4 = 1041112; // trade date 4 days ago
>> > TradeDate5 = 1041111; // trade date 5 days ago
>> > TradeDate6 = 1041110; // trade date 6 days ago
>> > TradeDate7 = 1041109; // trade date 7 days ago
>> > TradeDate8 = 1041108; // trade date 8 days ago
>> >
>> > Question 2 - Do I need any modifications to following line on an
>> > ongoing basis? Guess I'm not sure how/if the "(3)" in this line of
>> > code affects the scan or whether I need to concern myself.
> (Getting
>> > up to speed on AFL language but still much to learn.)
>> >
>> > Filter = DateNum()==Now(3)
>> >
>> >
>> > Thanks again & best regards,
>> >
>> >
>> >
>> > Dean
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >> >
>> >> > Check AmiBroker web page at:
>> >> > http://www.amibroker.com/
>> >> >
>> >> > Check group FAQ at:
>> >> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> >> > Yahoo! Groups Links
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > Check AmiBroker web page at:
>> > http://www.amibroker.com/
>> >
>> > Check group FAQ at:
>> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>> >
>> >
>
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:  
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> 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/