How to import a strategy into MultiCharts and match the backtest
Import the exported .pla file in the PowerLanguage Editor, import the MultiAlphas library once, compile the signal, attach it to a chart whose instrument, session and strategy properties copy the header of the exported code, then compare the MultiCharts performance report with MultiAlphas's trade list on the same data.
By Soren Huang · Published · updated · Editorial policy
Contents
- How do you import a strategy into MultiCharts and match the backtest?
- What must be in place before you begin?
- What are the export steps in MultiAlphas?
- How do you compile the exported signal in MultiCharts?
- How do you attach the signal to a chart and set the strategy properties?
- Which session, fill and Bar Magnifier settings must match?
- Time zone and session
- Fills
- Bar Magnifier
- How do you compare the MultiCharts performance report with MultiAlphas's?
- How do you fix the usual MultiCharts backtest mismatches?
- How do you keep the strategy running 24 hours a day?
- Frequently asked questions
How do you import a strategy into MultiCharts and match the backtest?
Import the exported .pla file with File → Import in the PowerLanguage Editor, import the MultiAlphas (Valynox) library once, compile the signal, and attach it to a chart whose instrument, session and strategy properties copy the header of the exported code. Then compare the MultiCharts performance report with MultiAlphas's trade list on the same data.
Two terms first. PowerLanguage is the scripting language of MultiCharts. A signal is the MultiCharts name for a script that places orders, so when MultiCharts says "signal" it means the same thing MultiAlphas calls a strategy. The same export route also serves other platforms, TradeStation among them.
Moving a strategy between two programs is like cooking a recipe in a second kitchen. The recipe is the same, but the oven, the pan and the clock are different. The header of the exported code is the list of settings the first kitchen used. If you copy each setting, the two results should be close. If they differ, you compare one step at a time until you find the setting that changed, and the fixed order below tells you where to look first.
What must be in place before you begin?
You need a strategy in the MultiAlphas strategy databank, MultiCharts installed together with its PowerLanguage Editor, and the same market, bar period and history that the backtest used. The third item is the one people skip, and it causes most of the mismatches that look mysterious later.
- A strategy in the strategy databank. The databank is where MultiAlphas keeps every strategy that passed your search and validation. The export is made from there, so the strategy you export is the one whose results you will compare against.
- MultiCharts with the PowerLanguage Editor. The editor is the separate window where scripts are imported and compiled. If you only open the charting window, you will not find the import menu.
- The same instrument. A continuous futures series built one way in MultiAlphas and another way in MultiCharts has different prices at every roll. Use the same contract series, with the same roll method, on both sides.
- The same bar period. A 37-minute bar strategy tested on 37-minute bars must run on 37-minute bars in MultiCharts. Any other period gives different bars and therefore different trades.
- The same history. The date range in the header of the exported code is the range to set in MultiCharts. If MultiCharts loads less history, the first trades are missing; if it loads more, the trade count rises.
- The same data feed, if possible. Two data vendors deliver slightly different tick streams and sometimes different session templates. Bars are built from ticks, so a different feed alone can produce a bar whose high or low differs by a tick, which is enough to trigger or skip a stop order.
Keep the exported code open in a text editor while you work. Its header is the checklist you will copy from, and its last lines hold the backtest results you will compare against.
What are the export steps in MultiAlphas?
Export happens on the Strategy source code tab of the Performance report: choose MultiCharts, save the file as .pla, and the first time only press Export library to get AlphaPrime_Functions.pla, which every exported signal needs.
- Open the strategy databank and double-click the strategy to bring up its Performance report.
- Switch to the Strategy source code tab. The left column shows the parameters of this one strategy; the right column shows the source code.
- Choose MultiCharts as the target platform. The code shown changes to PowerLanguage, and the header at the top lists the instrument, bar period, date range, costs and settings the backtest used.
- Click Export file to save the strategy, or Copy code to put the text on the clipboard. The file is saved as powerlanguage.txt by default; save it as a .pla file instead. A .pla file is the MultiCharts import format that holds the signal together with the functions and indicators it uses, so the editor imports it in one step.
- The first time only, press Export library. This saves AlphaPrime_Functions.pla, the library that holds all the functions the exported signals call. Every signal exported afterwards uses this one library, so you only repeat this step when a newer version of MultiAlphas ships a newer library.
Name the strategy file after the strategy and the market, for example with the databank name and the bar period, so that when you have several exported signals in MultiCharts you can still tell which performance report belongs to which MultiAlphas entry.
How do you compile the exported signal in MultiCharts?
Import the library .pla first and the strategy .pla second with File → Import in the PowerLanguage Editor, when asked to overwrite functions with the same name, answer yes only after checking that they are older copies of the MultiAlphas library and not functions of your own, then compile; a compile error almost always means the library is missing or the code was exported for another platform.
Compiling is the step where the editor translates the script into something MultiCharts can run on a chart. A script that is not compiled cannot be inserted on a chart.
- Open the PowerLanguage Editor.
- Choose File → Import and select AlphaPrime_Functions.pla. The editor shows the contents of the file. Confirm the import. If it asks whether to overwrite functions with the same name, first look at the names it lists: answer yes for older copies of the MultiAlphas library, and back up or rename any function of your own that shares a name, because an overwrite replaces it.
- Choose File → Import again and select the strategy .pla file. Confirm the import.
- Open the imported signal in the editor and compile it. A green or success message at the bottom means the signal is ready. The editor compiles the functions the signal depends on at the same time.
When the compile fails, read the first error line only. The later lines are usually consequences of the first one. The two common causes:
| Error you see | Usual cause | Fix |
|---|---|---|
| Unknown function name | AlphaPrime_Functions.pla was not imported, or was imported after the signal | Import the library, then compile the signal again |
| Syntax errors on many lines | The code was exported for another platform, for example Pine Script or EasyLanguage | Go back to the Strategy source code tab, choose MultiCharts and export again |
| Function exists with different code | An older library version is installed | Import the current library and overwrite once you have checked the function is a MultiAlphas library function |
The exported code is plain text. You can read it, and you can edit it. After an edit, the signal is no longer the one MultiAlphas tested, so repeat the comparison in the last two sections before you rely on it.
How do you attach the signal to a chart and set the strategy properties?
Insert the compiled signal on a chart with the header's instrument, bar period and date range, then copy the header's initial capital, contracts, commission per contract per side, slippage in ticks per side, big point value, tick size and MaxBarsBack into Format → Strategy Properties, because missing costs make MultiCharts look better than the backtest.
Three of these terms deserve one sentence each. Big point value is the money value of a one-point move in the instrument, so it converts price points into profit and loss. Tick size is the smallest price step the instrument can move. MaxBarsBack is the number of bars a script needs before it can calculate its first value, so it decides on which bar the first trade can happen.
Work through the header from top to bottom. Each item has one place in MultiCharts where it is set, shown in the table and in the figure below it.
| Item in the code header | Where to set it in MultiCharts | What happens if it differs |
|---|---|---|
| Instrument and bar period | Format Instrument | Different bars, different trades |
| Date range | Format Instrument, data range | Missing or extra trades at the start or end |
| Initial capital | Strategy Properties | Percent-based figures in the report differ |
| Number of contracts | Strategy Properties | Every profit and loss figure scales |
| Commission per contract per side | Strategy Properties, costs | Net profit too high by the commission total |
| Slippage in ticks per side | Strategy Properties, costs | Net profit too high by the slippage total |
| Big point value and tick size | QuoteManager, symbol settings | Profit in points is right, profit in money is wrong |
| MaxBarsBack | Strategy Properties | First trade appears earlier or later |
| Time zone and session | Format Instrument, settings and sessions | Every bar shifts (next section) |
Steps, in the order that avoids going back:
- Open a new chart with the header's instrument and bar period. Set the data range to the header's start and end dates.
- Check the symbol's big point value and tick size in QuoteManager. If you are unsure what the values should be, the futures contract calculator shows tick size, tick value and point value for common futures, and the exchange's contract page is the final word, because exchanges can change these values.
- Insert the compiled signal on the chart (Insert → Signal, pick the imported signal name).
- Open Format → Strategy Properties. Enter initial capital, the number of contracts, the commission per contract per side and the slippage per side exactly as the header states them. MultiCharts and MultiAlphas both apply commission and slippage on entry and on exit, so a value "per side" in the header goes in as a per-side value, not doubled.
- Set MaxBarsBack to the header's value, or to a larger value if MultiCharts asks for more. A larger value only delays the first possible trade; a smaller value stops the signal from calculating.
- Add any additional data series the header lists, in the same order, with the same bar period.
Hypothetical example
A strategy made 150 round-trip trades with one contract. The header states commission of 2 dollars per contract per side and slippage of one tick per side, with a tick worth 5 dollars in this example. Commission is 150 × 2 sides × 2 dollars = 600 dollars. Slippage is 150 × 2 sides × 5 dollars = 1,500 dollars. If both fields stay at zero in MultiCharts, its net profit is 2,100 dollars higher than MultiAlphas's, with exactly the same trades.
Why costs matter so much for the comparison is explained in trading costs in backtests: commission, slippage and the average trade: the cost per trade is small, but it is paid on every trade.
Which session, fill and Bar Magnifier settings must match?
Set the chart to the exchange time zone and the same trading session, keep next-bar fills so an order decided on a bar close fills on the next bar, and leave Bar Magnifier off, because a time zone or session difference shifts every bar and a different price path inside a bar can change which order fills first.
These three settings do not change the strategy's rules. They change the bars the rules see and the prices the orders get, which is why a strategy with the right code and the right costs can still produce a different trade list.
Time zone and session
Bars are built from a session start. MultiAlphas builds bars in the exchange's time zone with the session the backtest used, for example day session only or the full session including the night session. In MultiCharts, open Format Instrument, set the time zone to Exchange, and pick the session template that covers the same hours. If MultiCharts uses your local time zone, or a session that starts at a different hour, the bar boundaries move. The same price data is cut into different bars, so a rule that fired on the bar closing at one time now fires on a neighbouring bar.
Fills
A next-bar fill means an order decided at the close of one bar is filled at the open of the following bar. This is the execution MultiAlphas's backtesting uses, because the close of a bar is only known when the bar has ended. MultiCharts fills this way by default as long as Intra-bar Order Generation is switched off in the signal's format dialog. Leave it off. With it on, the signal recalculates inside the bar and orders fill at prices the original backtest never saw. With Intra-bar Order Generation off, MultiCharts fills like the next-bar execution in MultiAlphas's backtesting, so the two trade lists you compare were produced under the same fill rule.
Bar Magnifier
Bar Magnifier is a MultiCharts backtesting option that loads data of a finer resolution to work out the path prices took inside a bar. It does not change when an order is sent. With Intra-bar Order Generation off, an order decided at a bar close is placed for the next bar: a market order fills at that bar's open, and a stop or limit order fills when the bar's price reaches it, or at the open if the bar gaps past it. What Bar Magnifier changes is the path inside a bar, which decides, for example, whether a stop or a target in the same bar was reached first; without it, MultiCharts assumes a path from the bar's open, high, low and close. It is a useful option for other kinds of research; for this comparison keep it off, and if prices still differ, check the order type of each exit in the exported code trade by trade.
How do you compare the MultiCharts performance report with MultiAlphas's?
Compare in a fixed order: number of trades, then entry and exit times, then prices, then costs and net profit, so the first number that differs points to the setting that caused it; the header of the exported code ends with the backtest results to compare against.
Open the report in MultiCharts with View → Strategy Performance Report, and keep the MultiAlphas Performance report open beside it. Use the trade list on both sides, not only the summary page, because two reports can show a similar net profit from different trades.
- Number of trades. Compare the total trade count, then the long and short counts separately. Matching counts are a first check, not proof that both programs saw the same bars and signals; the next steps compare the trades one by one. If they differ, the cause is upstream of everything else: the data feed, the date range or MaxBarsBack. Fix it before reading further, because every later number depends on this one.
- Entry and exit times. With equal counts, go down both trade lists and compare the time stamps. All times off by the same amount, or every trade one bar late, means a time zone or session difference. A handful of trades off by one bar, with the rest equal, usually means a bar whose high or low differs by a tick between the feeds.
- Entry and exit prices. With equal times, compare prices. The same trades at different prices mean the fill assumption differs: Intra-bar Order Generation on, Bar Magnifier on, or a different slippage value.
- Commission, slippage and net profit. With equal prices, the remaining difference is costs. Compare the commission total and the slippage total, then net profit. A net profit that is higher in MultiCharts by a round multiple of the trade count means a cost field was left empty.
What a good result looks like: the same trade count, the same time stamps, prices that agree on all but a few trades where the two feeds built a slightly different bar, and a net profit that differs by no more than those few trades explain. Small price differences from a different data vendor are normal and stay small. What a result that still needs work looks like: a trade count that differs by more than a few trades, or a net profit gap that is a round multiple of the trade count.
The PowerLanguage comparison checklist lists every item to compare, line by line, and is the page to print out for the first few strategies you move.
How do you fix the usual MultiCharts backtest mismatches?
Each symptom has one usual cause: every trade shifted by one bar is a time zone or session difference, the same trades at different prices is a fill or Bar Magnifier setting, a higher net profit is missing commission or slippage, and a different trade count on the same settings is a data feed or MaxBarsBack difference.
Change one setting at a time, recalculate the signal, and compare again. Changing two settings at once can fix one difference and create another, and you no longer know which change did what.
| Symptom in the trade lists | Usual cause | Fix |
|---|---|---|
| All trades shifted by one bar, same count | Chart in local time zone, or a session template with a different start | Format Instrument: time zone Exchange, same session template as the header |
| Same trades, same times, different prices | Bar Magnifier on, Intra-bar Order Generation on, or slippage set differently | Bar Magnifier off, Intra-bar Order Generation off, slippage per side as in the header |
| Same trades and prices, MultiCharts net profit higher | Commission or slippage field left at zero | Strategy Properties: commission per contract per side and slippage per side as in the header |
| Same trades and prices, profit in money wrong, profit in points right | Big point value or tick size differs in QuoteManager | Correct the symbol settings, recalculate |
| Different trade count, same settings | Different data feed, different date range, or MaxBarsBack larger than the header | Same feed and roll method, same start and end date, MaxBarsBack as in the header |
| Only the first trades differ | MaxBarsBack or history start differs | Set both as the header states; compare from the first common trade onward |
Hypothetical example
MultiAlphas lists 150 trades; MultiCharts lists 152. The two extra trades are at the very start of the history, before MultiAlphas's first trade. The header states MaxBarsBack of 200 bars and MultiCharts was set to 50, so the signal started trading 150 bars earlier. Setting MaxBarsBack to 200 removes the two trades, the counts match, and the comparison moves to step 2.
When a difference remains after every setting matches, the data is the last place to look. Export a short stretch of bars from both programs around a trade that differs and compare open, high, low and close. A one-tick difference in a high or low is enough to trigger a stop order in one program and not in the other, and no setting fixes that; it is a difference between two feeds that you accept and record.
What this means if you use MultiAlphas: the exported code is plain PowerLanguage text with a header that holds every setting you need to copy, and the platform export page lists every platform the same export supports, so the same compare-and-fix routine carries over when you move a strategy somewhere other than MultiCharts.
How do you keep the strategy running 24 hours a day?
A live MultiCharts signal places orders only while MultiCharts is open and connected, so a computer that sleeps, restarts for updates or loses its connection stops the strategy until someone starts it again. A VPS (virtual private server) is a Windows computer in a data centre that keeps MultiCharts running while your own computer is off, and you manage it by Remote Desktop. QuantVPS (partner link) is a VPS provider built for trading platforms. New customers who sign up through this link or with the code MULTIALPHAS receive a first-month discount. Disclosure: MultiAlphas may receive a commission if you subscribe through this link or use code MULTIALPHAS, at no extra cost to you. Whichever provider you choose, compare server location, uptime and price for the platform and markets you trade, and test the VPS before relying on it, as described in When a low-latency VPS helps.
Frequently asked questions
How do I import a strategy into MultiCharts from a .pla file?
Open the PowerLanguage Editor, choose File → Import, select the .pla file and confirm. The editor shows the contents of the file and imports them. Then open the imported signal and compile it; only a compiled signal can be inserted on a chart with Insert → Signal.
Do I need to import the MultiAlphas library every time I export a strategy?
No. Import AlphaPrime_Functions.pla once in the PowerLanguage Editor. Every strategy exported for MultiCharts afterwards uses the same library. Import it again only when a newer MultiAlphas version ships a newer library, and before you agree to overwrite functions with the same name, check that they are MultiAlphas library functions.
Why does the exported signal not compile in MultiCharts?
The first error line tells you. An unknown function name means the MultiAlphas library was not imported, or was imported after the signal; import the library and compile again. Syntax errors on many lines mean the code was exported for a different platform; go back to the Strategy source code tab, choose MultiCharts and export again.
Why does my MultiCharts backtest show a higher profit than the original backtest?
Almost always because commission or slippage was left at zero in Format → Strategy Properties. The header of the exported code states the commission per contract per side and the slippage in ticks per side the backtest used; enter the same values. If the trades and prices match and the gap is a round multiple of the trade count, this is the cause.
Why are all my MultiCharts trades one bar later than in the original?
The chart is in a different time zone or uses a different session template, so the bars are built from a different start time. Open Format Instrument, set the time zone to Exchange and pick the session the backtest used. Also confirm that Intra-bar Order Generation and Bar Magnifier are off, so orders are decided on bar closes and placed for the next bar.

