Error 706: Show arrows feature needs a trades list

Here is a dummy version of my program:

/*=====================================================================
OPTIONS/SETTINGS
=====================================================================*/
InitialEquity = 100000;
PositionSize = 10000;
CommissionAmount = 10;

SetOption("UseCustomBacktestProc", 0);              // Enable custom backtesting
SetOption("InitialEquity", InitialEquity);
SetOption("MinPosValue", PositionSize*0.99);        // Minimum dollar amount required to open the position in the backtester/optimizer
                                                    /*
                                                    // Set to "PositionSize" for fixed position sizes, otherwise the position size can fall between
                                                    // "PositionSize" and "MinPosValue".
                                                    // Set to 0 to have as much funds in the market as possible,
                                                    // with the downside of varying positions sizes.  Use this with caution.
                                                    */
SetOption("MaxOpenPositions", 1000);                // Maximum number of open positions, range between 1 and 1000, 1000 means limited only by available funds

SetOption("PriceBoundChecking", 1);                 // True: Adjust prices so that they fall within the High-Low range
SetOption("CommissionMode", 2);                     // Use $ amount
SetOption("CommissionAmount", CommissionAmount);    // Broker's commission (fixed value)
SetOption("UsePrevBarEquityForPosSizing", 1);       // True: Use previous bar closing equity to perform position sizing
SetOption("AllowSameBarExit", 0);                   // False: Trade is exited & we move to next bar ignoring other signals
SetOption("NoDefaultColumns", 0);                   // Do not display the default columns (Symbol and Date)
SetOption("ExtraColumnsLocation", 1);               // Allows the location change of custom columns added during backtest/optimization.
SetOption("MinShares", 1);                          // Minimum number of shares required to open the position in the backtester/optimizer
SetOption("AllowPositionShrinking", 0);             //
SetOption("ReverseSignalForcesExit", 0);            // Reverse entry signal forces exit of existing trade
SetOption("FuturesMode", 0);                        //
SetOption("AccountMargin", 100);                    // Account margin requirement - 100 = no margin
SetOption("InterestRate", 0);                       //
SetOption("EveryBarNullCheck",0);                   //
SetOption("HoldMinBars",0);                         // > 0 - disables exit during user-specified number of bars
SetOption("EarlyExitBars",0);                       // > 0 - causes that special early exit (redemption) fee is charged
SetOption("EarlyExitFee",0);                        // Defines the % (percent) value of early exit fee
SetOption("EarlyExitDays",0);                       // > 0 - causes that special early exit (redemption) fee is charged
//SetOption("DisableRuinStop",1);                       // Built-in ruin stop is disabled
SetOption("RefreshWhenCompleted",0);                // Refresh All after Automatic-Analysis operation (scan/exploration/backtest/optimize) is completed.
SetOption("SeparateLongShortRank", 1);              // Backtester maintains TWO separate "top-ranked" signal lists
SetOption("MCEnable", 1);                           // Value == 0 disables MC simulation, Value == 1 enables MC only in portfolio backtests (default),
                                                    // Value == 2 forces MC to be enabled everywhere (in every mode including optimization - SLOW !)
SetOption("MCRuns", 1000);                          // define number of MC simulation runs (realizations)

/*=====================================================================
EXPLORATION
=====================================================================*/

// Dummy Values
ROCShort = ROC(C,5);
ROCLong = ROC(C,10);

Buy = ROCShort > 5;
Sell = ROCShort < 5;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

PositionScore = ROCShort;
NumShares = 1000;
BuyOffer = C * 1.03;
PctRiskTrade = 10;
RiskAmount = 1000;
InitialStopLoss = C - ATR(10);
SellOffer = C * 0.8;

// Set Column Sort Order
switch(Status("action")) {
    case actionScan:
        SetSortColumns(3, 2, 4);
        break;
    case actionExplore:
        SetSortColumns(1,2);
        break;
    case actionBacktest:
        break;
}

Filter = Buy OR Sell;

AddTextColumn(Date(), "Date", 1, colorDefault, colorDefault, 80);
AddTextColumn(Name(), "Ticker", 1, colorDefault, colorDefault, 80);

// Exploration Analysis - this column displays the close price
AddColumn(Close, "Close Price", 1.3, colorDefault, colorDefault, 80);

// Exploration Analysis - primary filter criteria
AddColumn(IIf(Buy, ROCShort, Null), "ROCShort",colorDefault, colorDefault, -1);
AddColumn(IIf(Buy, ROCLong, Null), "ROCLong");

// Exploration Analysis - this column displays the position score
AddColumn(IIf(Buy, PositionScore, Null), "Position Score", 1.2, colorDefault, colorDefault, -1);

// Exploration Analysis - this column displays the desired/target Buy Price (same as close)
AddColumn(IIf(Buy, Close, Null), "Buy Price", 1.3, colorWhite, colorDarkGreen, -1);

// Exploration Analysis - this column displays the desired/target quantity of shares to buy (if entered at desired Buy Price)
AddColumn(IIf(Buy, NumShares, Null), "# Shares", 1, colorDarkGreen, -1);

// Exploration Analysis - this column displays the desired/target Position Size (if entered at desired Buy Price)
AddColumn(IIf(Buy, PositionSize, Null),  "* Position Size *", 1.2, colorWhite, colorPaleBlue, -1);

// Exploration Analysis - this column displays pre-auction buy offer price (+3% premium added to the last closing price)
AddColumn(IIf(Buy, BuyOffer, Null), "* Buy Offer *", 1.3, colorWhite, colorPaleBlue, -1);

// Exploration Analysis - this column displays the total ($) you will pay for the qty of shares at the +3% premium
AddColumn(IIf(Buy, NumShares * BuyOffer, Null), "Buy Cost", 1.2, colorDefault, colorDefault, -1);

// Exploration Analysis - this column displays the percent risk on this trade
AddColumn(IIf(Buy, PctRiskTrade, Null), "% Risk/Trade", 1.2, colorDefault, colorDefault, -1);

// Exploration Analysis - this column displays the total dollar risk on this trade
AddColumn(IIf(Buy, RiskAmount, Null), "$ Risk/Trade", 1.2, colorDefault, colorDefault, -1);

// Exploration Analysis - this column displays the initial stop loss (exit EOW with Next Day order for Monday's open)
AddColumn(IIf(Buy, InitialStopLoss, Null), "Stop Loss", 1.3, colorDefault, colorDefault, -1);

// Exploration Analysis - this column displays the GTFO stop (ISL - 20%: enter this into the market as a limit order)
AddColumn(IIf(Buy, InitialStopLoss * 0.8, Null), "GTFO Loss", 1.3, colorWhite, colorPaleBlue, -1);

// Exploration Analysis - this column displays pre-auction sell offer price (-3% discount to the last closing price)
AddColumn(IIf(Sell, SellOffer,  Null), "Sell Offer", 1.2, colorWhite, colorRed, -1);

/*=====================================================================
CHARTING
=====================================================================*/

function DateNumToDateFull(nDate,index)
{
	dt = DateTimeConvert(2,nDate,Null);
	ds = DateTimeFormat("%A, %B %d, %Y",dt[index]);
	return ds;
}

InTrade = Flip(Ref(Buy,-1),Ref(Sell,-1));

TrailStopReason = Null;
TrailStopPrice = C - (3 * ATR(14));

// Trailing Stop Reason message
stopMessage = "";
stopMessageString = ",- TRAILING STOP,- %.0f x DOWN BAR STOP,- PROFIT STOP";
idx=TrailStopReason[SelectedValue(BarIndex())];
stopMessage = StrExtract(stopMessageString,idx);
if (idx == 2) stopMessage = StrFormat(stopMessage,StopDownBars);

SetChartOptions(1, chartShowDates, chartGridMiddle, 0, 0, 0);
_N(Title = StrFormat("{{NAME}} - %s - {{INTERVAL}} - %s\nOpen %g, Hi %g, Lo %g, Close %g (%.1f%%)\n{{VALUES}} %s",
FullName(),DateNumToDateFull(DateNum(),SelectedValue(BarIndex())), O, H, L, C, SelectedValue(ROC(C, 1)), stopMessage ));

Plot(Close, "Close", ParamColor("Color", colorDefault), styleNoTitle | ParamStyle("Style") | GetPriceStyle());

// Show ROC for selected bar
Plot(ROCShort,"ROCShort", colorBrightGreen, styleNoDraw | styleOwnScale);
Plot(ROCLong,"ROCLong", colorBrightGreen, styleNoDraw | styleOwnScale);

// Show Trailing Stop Price and Reason if in a trade
Plot(IIf(InTrade,TrailStopPrice,Null),"Trailing Stop Price", colorRed, styleLine | styleThick);
Plot(IIf(InTrade,TrailStopReason,Null),"Trailing Stop Reason", colorWhite, styleNoDraw);

// Show Buy and Sell Arrows
PlotShapes(Buy*shapeUpArrow,colorGreen,0,Low);
PlotShapes(Sell*shapeDownArrow,colorRed,0,High);

// Show Buy and Sell price on the chart on the Buy and Sell bar (not the Trigger Bar)
textdist = 1.5*ATR(10);
for( i = 1; i < BarCount; i++)
{
	if (Buy[i - 1])  PlotText("Buy\n@ " +  Prec (Open[i],2), i, L[i] - textdist[i], colorWhite);  // Displays white buy price (opening price) under the white box (buy bar)
	if (Sell[i - 1]) PlotText("Sell\n@ " + Prec (Open[i],2), i, H[i] + textdist[i], colorWhite);  // Displays yellow sell price (opening price) above the yellow circle (sell bar)
}

I run an explore and can double-click the results to navigate to that symbol in the chart.

If the only change I make to the program is:

SetOption("NoDefaultColumns", 1);                   // Do not display the default columns (Symbol and Date)

I get Error 706: Show Arrows feature needs a Trades List.

Settings -> Report -> Trade List is selected.

I want to display Date then Ticker in that order. I also want to be able to double click the row and navigate to the ticker in the chart.

How do I make that happen?

From how-to-ask-a-good-question.

How to ask a good question

  1. Follow the forum rules first: How to use this site

Please use the search field in this forum, there are high chances that somebody already had the same problem and the answer is already available. If you have follow-up question, reply in existing thread instead of creating new topic.

Your post is a duplicate:

  • first column of result list must hold proper symbol name

So I can't have Date then Symbol and double-click. Massive bummer but I'll just have to reorder the columns when I paste into my trade journal.

1 Like

You can have different order IF you rearrange columns from the UI:

1 Like

That didn't work for my intended use case.

I ran with SetOption("NoDefaultColumns", 0); so symbol was in the left most column and I could double click the row to bring up that symbol in the chart.

I then dragged Date to the left, as that will be my sort key in my trade journal. And because that's what I want. I then Cntl-A, Cntl-C, and Cntl-V in Excel. But the columns are in the order as originally displayed.

I read somewhere recently that reordering the display columns did not change the order for export or cut and paste. I thought it had to do with optimization output, but I can't find that article now otherwise I'd paste in the link.

I wonder if a potential enhancement request would be, during an explore that is capable of returning a symbol (i.e. not some aggregate explore, sector ranking, etc), Amibroker prepended the symbol itself as a hidden column in the underlying data structure that displays the explore output? Then, when you double click the Explore output row, it uses the index of the row to lookup the symbol from the leftmost (but hidden) column.

So, if you ran:

SetOption("NoDefaultColumns", 0)

internally the columns would be Symbol (hidden), Symbol, and Date (displayed).

And if you ran:

SetOption("NoDefaultColumns", 0)
AddColumn(Date(), "Date", -1);
AddTextColumn(Name(),"Ticker", -1);

internally the columns would be Symbol (hidden), Date, Symbol (displayed)

and double click would still work to navigate the chart in either scenario.

The hidden Symbol column would never be added to export or cut-and-paste, only what is visible.

Default columns are here FOR REASON.

Exactly FOR REASON OF AmiBroker being able to synchronize chart and display arrows.

If you DISABLE default columns you are shooting yourself in the foot and you are explicitly DISABLING ability do synchronize.

So just DO NOT disable default columns. It is that easy. Don't fight with the program. Let it work the way it was intended.

If you don't need them in your EXCEL, DO THE THING IN EXCEL, not in AmiBroker.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.