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