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

Re: [amibroker] Re: Determining cycles



PureBytes Links

Trading Reference Links

Jayson,

I see my error in adding parentheses at the wrong spots with the 
Plotcolor= line.  Your's works like a charm.  As usual....

I changed the 2's to 4's and this again is very close to what I 
want.  Perhaps this is the best I can hope for.  

I stare at the code you have written, and try to translate it into 
English.  I have Great difficulties with this task.  I can see 
myself asking more questions in the future, until I become fluent in 
AFL.  Perhaps one other favor could help me.  If you could please 
translate the AFL code you have written line by line to English, 
that would be great.  As an example:

Vol_Avg = MA(V,30); 

--In English Vol_Avg is the moving average value for Volume over the 
past 30 bars.  That one I understand.

PlotColor= IIf(V > (2*Vol_Avg),colorBlue,IIf(C > O AND C > Ref(C,-
1),colorBrightGreen, IIf(C < O AND C < Ref(C,-1), colorRed, 
colorYellow)));  

--In English, If Volume is greater than two times the average 
volume, color the volume bar blue.  If the Closing price is greater 
than the Open price and the Closing price is greater than the prior 
Closing price, color the volume bar bright green.  If the Closing 
price is less than the Open price and the Closing price is less than 
the prior Closing price, color the volume bar red.  If none of these 
conditions exist, color the volume bar yellow.

X=Ref(HHV(V,Param("Look back",30,10,200,1)),-1);

--In English?  X is one bar ago, the highest high value of Volume, 
decided by User?  I don't know.

PlotVol = IIf(V < (2*Vol_Avg),V,x);

--In English?  PlotVol is  If Volume is less than double the average 
volume, ......?

Plot( PlotVol,"Volume", Plotcolor,styleHistogram|styleThick);

--In English?  Plot PlotVol , name it Volume, Use the coloring 
scheme described above, plot it as a histogram with thick style.

I guess the main problem is that I don't understand X or PlotVol.

My questions are:  What decides which Volume bars will be cut off? 
Maybe we are chopping off just the 2*Vol_Avg?  Since those are being 
colored blue?  That's what I wanted originally to have some way to 
tell by a glance which bars have been chopped off.

I really wish I could grasp this for myself.  I would prefer not to 
ask for help.  If you could write a book teaching me AFL, I would 
buy it.

In answer to your question, I plot 210 bars on my charts.  If I'm 
looking at Daily data, I see about 10 months of trading, if I'm 
looking at weekly data, I see about 4 years of data, if I'm looking 
at Monthly data, I see about 17 years of data.

Thank you for all of your help.

Jim 

My code is below:

Vol_Avg = MA(V,30);

PlotColor= IIf(V > (4*Vol_Avg),colorBlue,IIf(C > O AND C > Ref(C,-
1),colorBrightGreen, IIf(C < O AND C < Ref(C,-1), colorRed, 
colorYellow)));

X=Ref(HHV(V,Param("Look back",30,10,200,1)),-1);

PlotVol = IIf(V < (4*Vol_Avg),V,x);

Plot( PlotVol,"Volume", Plotcolor,styleHistogram|styleThick);

Title= EncodeColor (colorWhite) + Name () + " " + WriteIf(Interval()
==86400,"Daily",WriteIf(Interval()==432000,"Weekly",WriteIf(Interval
()==2160000,"Monthly","")))+ EncodeColor(colorDefault) + " Volume " 
+ WriteVal (V, 1.0) + " " + WriteVal(DateTime(), formatDateTime );
---------------------------------------------------------------------
--- In amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> wrote:
> Jim,
> the 30 in vol_avg is the 30 day moving average of volume. Not sure 
why you
> are using ref here which references yesterdays value but it was in 
the
> original code. The 30 in X refers to the look back of the HHV 
(highest high
> value of volume over the last 30 bars).
> 
> The number of look back days in the HHV function is not based on 
the number
> of default bars you load (you said 210) but more on the number of 
bars you
> generally VIEW, If you like to see 3 months of data then set your 
HHV value
> to around 60. Better yet I will add a param statement that allows 
you to
> easily ,make adjustments. just RT click the indicator and choose 
Param to
> adjust the setting
> 
> The errors are caused by misplacements of the brackets. Try 
this....
> 
> Regards,
> Jayson
> 
> Vol_Avg = MA(V,30);
> PlotColor= IIf(V > (2*Vol_Avg),colorBlue,IIf(C > O AND C > Ref(C,-
> 1),colorBrightGreen, IIf(C < O AND C < Ref(C,-1), colorRed,
> colorYellow)));
> X=Ref(HHV(V,Param("Look back",30,10,200,1)),-1);
> PlotVol = IIf(V < (2*Vol_Avg),V,x);
> Plot( PlotVol,"Volume", Plotcolor,styleHistogram|styleThick);
> 
> 
> -----Original Message-----
> From: Jim [mailto:bankedout@x...]
> Sent: Friday, February 06, 2004 2:13 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Cutting off volume spikes
> 
> 
> Jayson,
> 
> This is much closer to what I want.  If I change the 2's to 4's,
> that's what I had in mind.  Can you explain what the 30's are
> describing?  As a reference, I have default number of quotations 
per
> chart set at 210.
> 
> Now, I tried to retain my original bar coloring scheme, and add to
> it bars which would be colored blue if your conditions were true.  
I
> got error messages all over the place.  Here's what I created:
> 
> Vol_Avg = Ref(MA(V,30),-1);
> 
> PlotColor= IIf(V > (4*Vol_Avg),colorBlue,IIf(C > O AND (C > Ref(C,-
> 1))),colorBrightGreen, IIf(C < O AND (C < Ref(C,-1))), colorRed,
> colorYellow);
> 
> X=Ref(HHV(V,30),-1);
> 
> PlotVol = IIf(V < (4*Vol_Avg),V,x);
> 
> Plot( PlotVol,"Volume", Plotcolor,styleHistogram|styleThick);
> 
> The problem is in the PlotColor= line I think.  I want the volume
> bars to be BrightGreen if the Closing Price is greater than the
> Opening price AND the Closing price is greater than the prior
> Closing price
> 
> I want the volume bars to be colored Red if the Closing Price is
> less than the Open price AND the Closing price is less than the
> prior Closing price.
> 
> I want the volume bars to be colored Blue if they are chopped off.
> 
> I want all other volume bars to be colored Yellow.
> 
> Is that possible?  That's what I was trying to tell it when I
> changed your PlotColor= line....
> 
> Thanks for your help.
> 
> Jim
> -------------------------------------------------------------------
--
> --- In amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> wrote:
> > Jim,
> > Instead of the vol average you could use the most recent HHV. In
> my example
> > I used 30 bars but depending on how many bars you generally view
> that could
> > be adjusted. I also suspect there would be a way to calculate the
> number of
> > bars you are viewing with status("barvisible") but this should 
get
> you
> > started....
> >
> > Regards,
> > Jayson
> >
> > Vol_Avg = Ref(MA(V,30),-1);
> > PlotColor= IIf(V > (2*Vol_Avg),colorYellow,IIf(Close >
> > Open,colorBlue,colorRed));
> > X=Ref(HHV(V,30),-1);
> > PlotVol = IIf(V < (2*Vol_Avg),V,x);
> >
> > Plot( PlotVol,"Volume", Plotcolor,styleHistogram|styleThick);
> >
> > -----Original Message-----
> > From: Jim [mailto:bankedout@x...]
> > Sent: Thursday, February 05, 2004 4:49 PM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Re: Cutting off volume spikes
> >
> >
> > I wish I could say that the problem is solved, but that's not
> > exactly what I had in mind.  As an example, use Ticker ABBK  
Plot a
> > daily periodicity chart.  Maybe 1 year in length.  Apply this 
code
> > for volume:
> >
> > //Volume chart
> >
> > col=IIf(C>O AND Close>Ref(C,-1),colorBrightGreen,IIf(C<Open AND
> C<Ref
> > (C,-1),colorRed,colorYellow));
> >
> > Plot( V, "Volume", col, styleHistogram | styleThick );
> >
> > Title= EncodeColor (colorWhite) + Name () + " " + WriteIf
(Interval
> ()
> > ==86400,"Daily",WriteIf(Interval()==432000,"Weekly",WriteIf
> (Interval
> > ()==2160000,"Monthly","")))+ EncodeColor(colorDefault) + " 
Volume "
> > + WriteVal (V, 1.0) + " " + WriteVal(DateTime(), 
formatDateTime );
> >
> > Look at the volume for 10/21/2003 as compared to the rest of the
> > volume bars on the chart.  It's about twice as tall as 6/13/2003
> and
> > 1/26/2004 volume.
> >
> > I would like to have maybe the volume of about 6/13/2003 be the 
top
> > of my chart.  I want 10/21/2003 to be cut off.  Maybe that's what
> > you mean by truncated.  10/21/2003's volume should hit the top of
> > the chart like 6/13/2003's volume.  I would then like the bar 
which
> > is chopped off to be marked from the rest.  Maybe color it blue 
or
> > something, or plot an arrow pointing to it.
> >
> > Is this possible?  Thanks in advance.
> >
> > Jim
> > -----------------------------------------------------------------
--
> --
> > --- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxxx>
> wrote:
> > > Jim Try This... I had the exact same issue
> > > This will color the truncated vol bars yellow
> > > Vol = Volume / 1000;
> > >
> > > Vol_Avg = Ref(MA(Vol,30),-1);
> > >
> > > PlotColor= IIf(Vol > (2*Vol_Avg),colorYellow,IIf(Close >
> > > Open,colorBlue,colorRed));
> > >
> > > PlotVol = IIf(Vol < (2*Vol_Avg),Vol,(Vol_Avg));
> > >
> > > Plot( PlotVol,"Volume", Plotcolor,styleHistogram|styleThick);
> > >
> > > ----- Original Message -----
> > > From: "Jim" <bankedout@xxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Thursday, February 05, 2004 10:40 AM
> > > Subject: [amibroker] Cutting off volume spikes
> > >
> > >
> > > > Hello,
> > > >
> > > > I was wondering if I can do this.  I tried searching the
> > archives,
> > > > but I didn't know what to search for I guess.  On a volume
> chart,
> > > > let's say the average volume on a stock is maybe 100,000 per
> day.
> > > >
> > > > One day there is volume of 20,000,000  After that day, volume
> > goes
> > > > back to normal.
> > > >
> > > > Now the "regular" volume looks squished on the chart.
> > > >
> > > > Is there a way to cut off the super volume spike to make it
> look
> > > > big, but still let me see the regular bars in some detail?  I
> > hope I
> > > > am describing this correctly.  Maybe a way to indicate to me
> > that it
> > > > has been cut off as well.  Otherwise I will never know that 
it
> > was
> > > > really that big unless I click on it.
> > > >
> > > > In searching the archives I solved one of my problems.  In 
the
> > built
> > > > in price charts, there is empty space at the top and bottom 
of
> > the
> > > > chart to allow for the Title text to display at the top or
> > > > whatever.  The code for that is:
> > > >
> > > > GraphXSpace = 7; //Empty space at top and bottom of chart
> > > >
> > > > The bigger the number, the bigger the space.  I hope that 
helps
> > > > someone else.
> > > >
> > > > Jim



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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/