Error messages

Below you'll find a list of possible errors that can occur during compilation or at runtime, together with suggestions for finding the reason of the error. Messages related to opening and closing positions are listed under Log; known issues with brokers are commented on the related page (FXCM, IB, Oanda, MT4, etc...) in this manual.

Error messages must never be ignored. Even when your script runs and produces a result, an error message always indicates that something is seriously wrong and must be fixed. Warning messages can be ignored in some cases, but only when you know and understood their reason. You can encounter three types of warning or error messages:

For dealing with error messages by script, two functions are available:

 

error(string Message)

User-supplied function that is called on any runtime error message or any print/printf call that contains the word "Error", "Warning", or "Info". This function can be used to sound an alert or send an email about a potential problem. It is not in sync with other functions or I/O operations, so use the call scheduler when modifying global variables or accessing non-reentrant parts of the broker API.

ignore(int Number)

Call this function for not generating messages on runtime errors or warnings with the given number. For instance, ignore(73); suppresses all Error 073 messages. Note that not all errors can be ignored; fatal errors will still generate a message.  

 

Compiler errors

Error in line ...

Wrong or missing token in the script code. Sometimes the line in question is ok, but some command in the preceding code was incomplete. Examples are an #ifdef without an #endif, or a missing semicolon in the previous line, or an orphaned { } bracket in the previous function. Another not-obvious error is declaring a variable or function with the same name as a predefined system variable, such as Stop or Lots.

Wrong type ...

Wrong variable type. You've used a numeric operation with wrong parameter types, for instance an AND or OR operation with a float or var type. Or you're using a variable with the same name as a predefined variable - look them up in variables.h. Or you've called a function with a var although it needs a series, or vice versa. Example: "Wrong type POINTER::DOUBLE" means that the code expects a double (or var) and you gave it a pointer (or series) instead.

Pointer expected ...

Function call with a wrong parameter type, for instance with a var when a series or an array is needed.

Undeclared identifier ...

The given name or type is unknown. A common reason is an #include statement without including <default.c> before. default.c contains all language definitions, but is only automatically included when nothing else is included.

Can not translate ...

Numerical operation with wrong parameter types, for instance an AND or OR operation with a float or var type. In that case, typecast the expression to the correct type.
 

Runtime errors

For suppressing a non-critical runtime error or warning, call ignore(ErrorNumber). Some warnings are only displayed on a higher Verbose level.

Error 010: Invalid trade parameter

A trade was entered with a Stop, TakeProfit, Trail, or Margin value that's unusually high, or low, or at the wrong side of the current price; or with an option or futures contract with no correct or missing Multiplier, strike, or expiration date. The trade can not be executed. Wrong price limits can be caused by a mistake in the script or by wrong margin cost, pip cost, or leverage parameters in the asset list. If it happens during live trading, an alert box will pop up dependent on Verbose settings.

Warning 010: Invalid trade parameter / no price

A trade was entered at an unknown parameter; for instance an option contract with no price in the historical or live data (call contractPrice before entering a trade). In live trading the position will be entered nevertheless, but this message is just to inform that it is not advisable to trade at unknown prices or other parameters.

 Error 011: xxx called with invalid parameters

An indicator or another function was called with wrong parameters - for instance a price of zero, or a parameter outside its valid range. This is usually caused by a bug in the preceding script code. The function name is included in the message.

Error / Warning 012: Bad time / bad date / chain outdated

A date/time function was called with bad data, or the bar with the given time could not be found, or a contract chain had not the current date.

Error 013: Invalid expression (...)

An invalid value or a wrong variable format caused an exception in an expression. For instance a division by zero, or the square root of a negative number.

Warning 014: Bar nnn clipped

Market hours, weekend, holidays, bar offset, time zone, and BarMode parameters contradict each other, causing a wrong start or end time at the given bar. This usually happens when the bar offset enforces bars outside market hours and the BR_MARKET flag suppresses such bars at the same tiome. It can also be caused by large gaps in the historical data. The bar is then clipped at the bar period. When using BarZone with daily bars, consider that the bar period is one hour smaller or longer when daylight saving changes - this can cause bars to end sometimes inside, sometimes outside market hours.

Error 015: Invalid xxx data

Object or function xxx got invalid data, f.i. a wrong parameter for a pointer or string, or data from a non initialized array, or from an invalid mathematical operation such as a division by zero. 

Error 016: Invalid date

A YYYYMMDD date has been given in a wrong format.

Error 017: Bad return value

A script function returned an invalid value.

Error 018: Bad name

A name was too long, too short, or contained spaces or other invalid characters.

Error 019: Empty function

A function prototype was defined, but not set to a function body.

Error 030: Check dates and price history

The lookback period, simulation period, or price history was not set up correctly. Parameters that affect the bars generation (StartDate, BarPeriod, LookBack, TICKS, LEAN, etc.) were either inconsistent (f.i. a too short LookBack period for a subsequent indicator call), or changed after the bars were generated. Make sure to set up all parameters and a sufficient lookback period before calling asset. Use the PRELOAD flag for extremely long lookback periods.

Error 031: Price history missing

The simulation could not be finished because historical data was missing.

Error 032: Constant parameter changed

A variable that should remain constant - such as NumWFOCyles - was changed after the initial run. Make sure not to change those parameters at runtime.

Warning 033: No asset data in INITRUN

The given asset was not selected in the initial run of the strategy. The initial asset call was either missing, or skipped, or failed due to insufficient historical data. The asset parameters are filled with default data. Make sure that all assets are loaded and initialized before they are needed.

Warning 034: No asset data for ...

The given asset is missing in the asset list (note that asset names are case sensitive). The simulation will still run when historical price data is found, but asset parameters such as spread, margin, lot size, trade costs, trade profit etc. are made up and do not reflect the true values. The asset can not be traded.

Warning/Error 035: Price gap / invalid ticks / outliers detected

Prices are missing, outliers, or have invalid time stamps. The broker API did not provide the required historical data, or did not send the current price during the last bar. The missing prices will be automatically replaced with the last valid price. If the warning is triggered by heavy price fluctuations in downloaded data, reduce the sensitivity of the Outlier variable.

Error 036: Index exceeded

A function wrote past the maximum index of an array or a series.

Error 037: Invalid value

A plot function was called with an invalid value, caused by a division by zero, the square root of a negative number, or similar errors in the script.

Error 038: Too many elements

The plotGraph with the given name had more elements that bars exist on the chart. If you need this many, use another name for the rest of the elements.

Error 039: Expression too complex

The rule generated by a machine learning function is too complex for conversion to a C expression. In case of candlestick patterns, use the FAST pattern detection mode that generates simpler rules, or reduce the number of patterns.

Error 040: Skipped optimize calls

Number or order of optimized parameters differ from run to run. Make sure that optimize is always called in the same order, the number of optimize calls is the always same as the number of optimized parameters, and the PARAMETERS flag is not changed between optimize calls.

Error 041: series size / number / usage

Something's wrong with a series, loop, or matrix in your script. It's likely called in wrong order or with wrong parameters. Check all such calls, and all indicators or functions that are described to create series, such as Volatility, ATR, LowPass, etc. Any run must have the same series with the same size in the same order. Don't skip series calls with if statements, and don't create them in event-triggered functions such as tmf, tick, or tock. The error message tells you at which bar the problem occurs first. If you need an extremely large number of series, increase TradesPerBar until the error message disappears.

Error 042: No parameters

Error 043: Irregular optimize calls

The optimize function was called too often per component, or the produced parameters were not found or are inconsisted with the current strategy. Make sure that the optimize calls or the loop parameters were not changed after training. For asset-dependent parameters, make sure that all assets and algos are selected with loop calls and their optimize calls are inside the inner loop. For asset-independent parameters in a portfolio system, make sure that always the same asset is selected before the optimize call.

Error 044: No rule ... / ... not trained

The advise or optimize function could not find a trained rule, model, or parameter for the current asset/algo combination. Make sure that the correct asset and algo is selected and the flag PARAMETERS or RULES is set before the advise or optimize call, then [Train] again.

Error 045: Negative price offset

A price that lies in the future was requested by a price or day function. For the simulation you can suppress this message by setting the PEEK flag. PEEK is not available for real trading though - Zorro is good in predicting prices, but not this good.

Error 046: LookBack exceeded

A price, series, or TA function required a higher lookback period than reserved through LookBack (default = 80). When no asset is selected and time periods don't change at runtime, Lookback is automatically adapted to the longest indicator time period of the initial run. Otherwise it should be manually set to the longest possible time period. Setting LookBack to 0, or calling ignore(46) allows series longer than the lookback period and suppresses this error message at user's risk.

Warning / Error 047: Not enough bars

The price data is not sufficient for covering the test period or the LookBack period. In the latter case the script won't run. Possible reasons and how to overcome them:

Error 048: Endless loop or recursion

Trades are possibly generated in an endless loop or recursion, f.i. by a TMF that enters trades who themselves enter new trades through their TMF. Or a for(trades) loop is nested inside another for(trades) loop.

Error 049: Too many trades

The script entered more than one trade per bar and asset, which is normally a sign of a script bug - therefore the error message. If you really need a huge number of trades, for instance for unlimited grid trading or for training several advise functions at the same time, set the TradesPerBar variable to the required number of trades per bar and asset.

Error 050: Can't access ...

Zorro could not open a file. The file could be already opened by a different program, or externally deleted, or set to read/only.

Error 051: Can't continue trades

Trading was stopped without closing the open trades, then resumed with a different Zorro version. Zorro can only continue trades that the same version has opened. Use the broker platform for closing the trades manually.

Error 052: Broker interface busy

Zorro attempted to log in to the broker, but another Zorro instance on the same PC is already connected. For multiple trading sessions and accounts, Zorro S is required.

Error 053: ... prices unavailable / invalid asset

The script attempted to retrieve or download prices of an asset that is either unavailable with the selected broker, or had a wrong symbol, or got no price quotes at session start due to market closure, a missing market subscription, a wrong price type, or other reasons . Make sure to log in at a time when prices are available for all assets that you want to trade. Also make sure that the asset has a valid and is subscribed and visible in asset lists of the broker platform. Not all assets are available to all users - for instance, US traders can often not trade commodity or index CFDs. Here's a checklist:
- What is the broker error message? If a symbol is wrong or unavailable, you'll normally get an error message from the broker API. If the symbol is correct, but the price type is wrong, you get no broker error message.
- Is the market open and the broker server online? Sometimes servers are offline due to maintenance on weekends.
- Did you set the correct price type? If in doubt, leave it at 0.
- Have you subscribed all market data? Depending on the broker API, you might need a subscription not only for market snapshots, but also for streaming data.

Warning / Error 054: changed / invalid asset parameter

One or several asset parameters, either in the asset list or returned from the broker API, had suspicious, invalid, or zero content. If it happens in [Train] or [Test] mode, edit the asset list and fix the wrong value. If it happens in [Trade] mode at the start of the script, a possible reason of zero content can be a too long response time of MT4/MT5 servers for uploading previously unused assets (see remarks about MT4 issues). In this case, simply start the script again. If the displayed value is substantially different to the value in the asset list, the backtest does not reflect the connected account, so check and possibly correct the asset list. If it happens within a trading session, asset parameters returned from the broker API differ by more than 50% from their previous values. Incorrect parameters can cause wrong trade sizes, so check the asset list. If you are sure that the asset parameters in the list are correct, you can override the broker API with the SET_PATCH command or BrokerPatch setting.

Warning / Error 055: ... no bars / no price history

No asset was selected, or historical price data required for an asset was missing or had insufficient size. Make sure that used assets are selected in the first run, and that historical data - when needed - is of the same type for all assets; don't use a mix of .t1, .t2, and .t6 data, or a part of the data split into years and another part not. You can download price data from online sources with the Download script. Frequently used data is also available on the Zorro Download page. If price data for a certain year is not available, create a .t6 file of 0 bytes size with the name of the asset and year (f.i. SPX500_20017.t6). Zorro will then skip that period in the simulation and not display the error message.

Error 056: ... can't download price history

Historical price data could not be downloaded from the broker's price server. The server can be offline or does not offer price data for the given asset and time period. For brokers that offer market data permissions, check if you've subscribed the permissions for the assets to be downloaded.

Error 057: inconsistent history format

Check if the historical data is consistent (no mix of .t1, .t6, .t8, LEAN mode) and has similar resolution for all used assets. Tick resolution is recommended for testing with bar periods less than one minute. The test will otherwise run with interpolated price data, but won't be very accurate.

Error 058: ... can't parse

A CSV file can not be parsed due to an invalid file format. If the file was recently downloaded (f.i. history.csv), open it with a text editor - it might contain no CSV data, but an error message from the data provider. Otherwise compare the CSV file content with your conversion format string. If in doubt, set Verbose to 7 for checking the source and parse result of the first 2 lines - this normally reveals the format error. The error details:

Bad code - your format string contained an invalid field placeholder.
Bad date - the date code in your format string does not match the date format in the file.
Bad field number - your format string contained invalid field numbers.

Error 060: Out of memory / Memory fragmented / limit exceeded

Zorro could not allocate a memory resource. Windows can assign about 3 GB memory to a process; if that size is exceeded, or if the memory became too fragmented by previous simulation or training runs, the memory required by the script is unavailable. Some methods to overcome the problem or redusing the memory requirement:

 A formula for calculating the memory requirement per asset can be found under asset. Usually, memory on a Windows PC is sufficient for several years tick-based backtests even with large history files.

Error 061: Compiled with different version

The executable script was compiled with an old Zorro version that is incompatible to the current Zorro. Delete the outdated .x or .dll file and compile it again with the current Zorro version.

Error 062: Can't open file ...

A file was not found, could not be opened, or had wrong format. Make sure that the file exists, that it has the correct name, that the Zorro process has access rights to it, and that it is not opened with exclusive access in another application (f.i. a .csv file in Excel). The Windows error number is displayed in parentheses, f.i. (wb:13). Typical error numbers are listed below. 
   

2

No such file or directory

9

Bad file number

11, 12

Not enough memory or resources

13

No access rights, or file opened in another application

16

Device or resource busy

23, 24

Too many files open in system

28

No space left on device

30

Read-only file system

38

Filename too long


If the missing file is a .par, .c, .fac, or .ml file, you possibly have forgotten to train your strategy. If you then still get that error, check which asset was selected before the first optimize or advise call. If no asset was selected, or if a different asset is selected in training and test mode, parameter or rule files have different names and thus cannot be opened.

Error 063: ... not available

The function is not available in this script because it requires a different setup, an external plugin, or Zorro S. Make sure that you installed your personal Zorro S key or token.

Error 064: ... wrong format

An asset list, account list, or other .csv file has a wrong spreadsheet format. Check the file for wrong entries, missing parameters, wrong delimiters, or the like. Every line in a .csv file must have the same number of delimiters - commas or semicolons - and end with a 'new line' character.

Warning 070: Potential orphan ...

Zorro sent an order to the broker API, but received no response due to a server glitch or connection issue right after sending the order. This means that it is unknown whether the position was opened or not. If it was, the trade is orphaned and not under Zorro control. Check in the broker platform if the trade was opened; if so, close it manually. 

Error 071: Trade not found ...

Zorro closed the trade with the given ID, but the trade was not found in the broker's trade lists. Possibly it was never opened, or was already closed manually or by a margin call or similar event.

Error 072: Login failed ...

A broker connection could not be established. The broker server could be offline or the broker API nonfunctional.

Warning 073: Can't close nn lots

An exitShort/exitLong command for partial closing could not be fully executed because not enough trades were open to close the given number of lots. When partial closing, make sure not to close more lots than are open.

Error 074: Balance limit exceeded

You need Zorro S when your annual profit exceeds $30,000 or your real account balance exceeds $7,000. There are no restrictions for trading on demo or paper accounts.

Error 075: Can't open / can't close trade...

A trade was rejected by the broker API during a live trading session. The reason can normally be found in the Zorro log or in case of an MTR4/MTR5 connection, in the 'Experts' log. Valid reasons for not opening or closing trades are: not enough funds, not enough free margin, no permission to trade that asset, a too distant or too close order limit, a wrong asset symbol, a closed market, no liquidity / no taker, FIFO violation, NFA rules violation, unsupported hedging (f.i. Oanda), a wrong stop distance, or unsupported partial closing (f.i. some MTR4 / MTR5 brokers). All this, except for funds, liquidity, and permissions, can often be solved or worked around in the script, the asset list, or in case of a Z system, in the Z.ini configuration.

Error 111: Crash in ...

A function in the script crashed due to a wrong operation. Examples are a division by zero, a wrong type or missing variable in a print/printf call, a wrong array index, or exceeding the stack size by declaring huge local arrays. The current run is aborted, possibly causing subsequent errors, f.i. inconsistent series calls. The name of the faulty function is normally displayed. See Troubleshooting about how to fix bugs in your script functions or deal with other sorts of crashes.

 

Broker errors and messages

!...

All messages beginning with an exclamation mark are sent from the broker API in a live trading session, so their content depends on the broker. On high Verbose settings, some diagnostics can be printed on events such as session start. Other messages can indicate that the connection was temporarily interrupted or a buy/sell order was rejected (see enter/exit). This happens when assets are traded outside their market hours, such as an UK stock index when the London stock exchange is closed. A "Can't close trade" message can also indicate that the NFA flag was not set on a NFA compliant account, or vice versa, the NFA flag was set on an account that is not NFA compliant. Read the comments on the broker related page (FXCM, IB, Oanda, MTR4, ...) in this manual. When trading with the MT4 bridge, details and reason of error message is printed under the [Experts] and [Journal] tabs of the MTR4 platform.

 

 

 

► latest version online