It’s not
rocket science.
if( Buy[i] ) PlotText( "Buy\n@" + C[ i
], i, L[ i ]-dist[i], colorGreen );
writes “Buy @ C””
at the ith bar dist[I] below the value of L for that bar if Buy was true for
that bar.
Bob
-----Original
Message-----
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 ) );