Lester,
Tried the IIF code but got the same results.
It must be my logic but for the life of me I cannot understand why the logic is
not stopping the plotting when the conditions are reached. Instead the
logic appears to be saying that in every bar there is a long and short signal
which is not the case. Here's the new code I generated:
PivotMALong= MA(Pivot,LongPeriods);
PivotMAShort= MA(Pivot,ShortPeriods);
// Plot Long and short period MA of pivot
Plot ( PivotMALong, "PivotLong",ParamColor( "Color1", colorCycle ), ParamStyle("Style1",styleThick) );
Plot ( PivotMAShort, "PivotShort",ParamColor( "Color2", colorCycle ), ParamStyle("Style2",styleThick) );
// Check for Long or Short Signals
dotlocationLong = L - 3;
dotlocationShort = H + 3;
IIf((C[0] > PivotMALong[0]) AND (C[0] >
PivotMAShort[0]) AND (PivotMAShort[0] > PivotMALong[0]),
Plot(dotlocationLong,"Long",ParamColor(
"Color3",
colorGreen ), ParamStyle("Style3",styleDots | styleNoLine |
styleNoLabel)),0);
IIf((C[0] < PivotMALong[0]) AND (C[0] <
PivotMAShort[0]) AND (PivotMAShort[0] < PivotMALong[0]),
Plot(dotlocationShort,"Short",ParamColor(
"Color4", colorRed
), ParamStyle("Style3",styleDots |
styleNoLine | styleNoLabel)),0);
Does the logic make sense to you?
thx,
Freddie
----- Original Message -----
Sent: Saturday, May 05, 2007 3:55
PM
Subject: [amibroker] Re: Plotting
problem
1) Instead of "for" loop use IIF(), it's easier:
http://www.amibroker.com/guide/afl/afl_view.php?id=72
2)
Use PlotShapes() to plot dots, arrows, etc. on the chart:
http://www.amibroker.com/guide/afl/afl_view.php?id=206
Your
code should look something like this:
dotlocationLong = L -
3; dotlocationShort = H + 3;
// specify variables PivotMALong =
??; PivotMAShort = ??;
IIF( ... your conditions here ...
);
// plot the main chart Plot( Close, "", colorBlue, styleCandle
);
// plot your shapes PlotShapes( ... );
///// Below is
an example of the code for PlotShapes. This is just one possible method, there
are a few different ways of coding this:
//***START ***//
Title
= Name()+" \\c11"+Interval(format=2)+" "+Date()+"\\c-1
C="+C+"\\c11 "+FullName();
Plot(C,"",colorBlue,
styleCandle); Plot(EMA(C,14), "", 32, 1);
Buy =Cross(C,
EMA(C,14)); Sell=Cross(EMA(C,14),
C);
PlotShapes(shapeUpArrow * Buy, colorGreen, 0, L,
-15); PlotShapes(shapeDownArrow * Sell, colorRed, 0, H,
-15);
SetChartOptions(0, chartShowDates); // show Date on
X-axis
// to prevent your shapes to move beyond the // top/bottom
of the chart use this: GraphXSpace = 5;
//***END
***//
__._,_.___
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
__,_._,___
Ahhh...imagining that irresistible "new car" smell? Check out
new cars at Yahoo! Autos.
|