Hi. I've written code to back test the ^SPX both long and short (see below). I compared the test results to the chart of the ^SPX and they are accurate. The Buy Plot Shapes are plotted but the Sell Plot shapes are not. Can anyone help, I'm trying to hone my coding skills...thanks!
// https://www.amibroker.com/guide/w_settings.html
// AFL Function Reference (amibroker.com)
// https://forum.amibroker.com // https://www.amibroker.com/guide/h_dragdrop.html
// Change the width of back test metrics, etc. You can have default and all other columns auto-sized to content, so everything fits without truncation.
// This can be achieved in any AmiBroker lists simply: Press CTRL and + (PLUS) key on the NUMERIC keypad.
// SHORT ANALYSIS SETTINGS
// 1) Check Pad and align all data to reference symbol: ^SPX
// 2) Check Long & short
// 3) Check Allow same bar exit / entry signal
// 4) Check Reverse entry signal forces exit
MA1 = MA(C,1);
MA200 = MA(C,200);
Buy = Cross(MA1,MA200);
BuyPrice = Close;
Sell = 0; Short = Cross(MA200,MA1);
SellPrice = Close;
Cover = 0;
Plot (MA1, "MA1", colorGreen, styleDashed, 0, 0, 0, 0);
Plot (MA200, "MA200", colorRed, styleDashed, 0, 0, 0, 0);
PlotShapes (Buy*shapeUpArrow,colorGreen, 0, MA1);
PlotShapes (Sell*shapeDownArrow,colorRed, 0, MA200);