Ron,
You are not the only one with problematical brain gaskets!
Here is some simple plottext code: I pasted in some
other code to insure that it works.
PlotText("
"+" C= "+LastValue(C),BarCount,LastValue(C),colorBlack);
PlotText("\n
"+" V= "+LastValue(V),BarCount,LastValue(C),colorBlack);
Here is the deal.
The first line shows the closing price just to the right of the
last bar on any chart.
The second line shows the Volume just to the right of the last
bar and one space below it.
Now look at the construction of the first line, and the second
line has the same construction. So we will look only at the first line.
At the beginning of the first line after Plottext, the spaces in
quotes say I want that much space to the right.
Then we print “C= “
Then we show the actual Close price C with Lastvalue(C).
We have to say lastvalue © because c is an array, and the function needs a
number, not an array.
Next we want the X, and Y position. They have to be
numbers also, not arrays. So, barcount is a number, Good, that takes care
of X. Now, how high is it on the screen (in dollars). There we use
our old buddy Lastvalue(C) again.
Finally we say what color.
Oh, and one more thing: On the second line the \n says put the
second line one space below the first line stuff.
Final item: watch out for arrays, we need numbers!!
Grover Yowell
From:
amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Ronald
Davis
Sent: Monday, December 03, 2007 7:38 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Simple plottext format
I would
like to be also be able to use plottext(); in the same simple AFL format that I
use for plotshapes.
The
plotshapes that I have pasted below works fine, and it is done with AFL that I
understand.
PlotShapes(Buy*shapedigit1+shapePositionAbove,shapeNone),colorred)
I have
never been able to figure out how to make plottext work because I am not
capable of understanding the help manual explanation of plottext();
There
may be others like myself who would like to be able to plot text in a chart
using the same simple format that I understand, and that I use for plotshapes.
I have pasted the Plotshapes() and PlotText() formats below as an example of
the simple kind of format that I am looking for. Obviously these formats don't
work.
PlotShapes(IIf( Buyb,PlotText("buy
one"),0));
PlotText(IIf( Buyb,PlotText("buy
one"),0));
This
description from the help manual is way beyond my knowledge, and I have no need
to spend a lot of time understanding loops because I don't need them, and I
don't want to blow one of my brain gaskets trying to learn how.
Unless,
of course, someone has previously explained in very detailed english how to
understand this help manual explanation of plottext(). Ron D
Plot(C,"Price", colorBlack,
styleLine );
Plot(MA(C,20),"MA20", colorRed
);
Buy=Cross( C, MA(C,20 ) );
Sell= Cross( MA( C, 20 ), C );
dist = 1.5*ATR(10);
for( i = 0; i < BarCount;
i++ )
{
if( Buy[i]
) PlotText( "Buy\n@" + C[ i
], i, L[ i ]-dist[i], colorGreen );
if( Sell[i]
) PlotText( "Sell\n@" + C[ i
], i, H[ i ]+dist[i], colorRed, colorYellow );
}
PlotShapes( Buy * shapeUpArrow
+ Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed
) );