Keep your platform.
Export to MultiCharts with the same rules as the backtest, or to five others.
No need to change how you chart and trade. MultiAlphas exports strategies as source code for your trading platform — plain text you can read and edit. These are the platforms supported today.
MultiCharts
Exports PowerLanguage source code.
TradingView
Exports Pine Script v6 source code.
TradeStation
Exports EasyLanguage source code.
NinjaTrader 8
Exports NinjaScript source code.
MetaTrader 4
Exports MQL4 source code.
MetaTrader 5
Exports MQL5 source code.
How it works
Each strategy is one plain-text source file. For MultiCharts and NinjaTrader, shared functions live in the MultiAlphas function library, which you import once; TradingView and TradeStation strategies need no library.
Rollover
Choose a roll method for each futures instrument: by date rule, by open interest, by volume or custom dates. Exports to all six platforms write the same roll rule into the source code.
You can read the logic of every exported strategy and edit it yourself. New platforms will be listed on this page as they are added.
Export to MultiCharts: the same rules as the backtest
Since 2017, the most common and most costly problem with software-generated strategies has been inconsistency between the backtest results of the generator and those of MultiCharts: the same rules, yet different trades. This is one of the main reasons MultiAlphas was developed.
For this reason, the MultiCharts export uses the same rules as the MultiAlphas backtest. Load the same data and set the same session and costs, and the trades and results of the exported PowerLanguage strategy should be close to the backtest; if any of these differ, the results will too.
The header of every exported file states the backtest settings: instrument, bar period and date range, capital and contracts, commission and slippage per side, big point value, minimum tick, MaxBarsBack, time zone and session, and Bar Magnifier off. The backtest results are appended at the end of the file for comparison.
When trade lists do not match, the cause is almost always a difference in settings. A one-bar offset indicates a different time zone or session; different fill prices usually indicate missing commission or slippage. If both are correct, compare the data sources: different data vendors may produce slightly different bars from the same market.
Before relying on the results, compare one week of trades side by side.
Five other platforms
For TradingView, the export is Pine Script v6; for TradeStation, EasyLanguage; for NinjaTrader 8, NinjaScript; for MetaTrader 4, MQL4; and for MetaTrader 5, MQL5. Every file uses the same rules and the futures roll method selected in MultiAlphas. Before live trading on any platform, follow the same approach as with MultiCharts: compare that platform's trade list with MultiAlphas's side by side on the same data.
Contents of the export
- One plain-text source file per strategy, which can be read, modified and placed under version control.
- For MultiCharts, the strategy can also be saved as .pla, combining the strategy and the functions it uses into a single file.
- MultiCharts and NinjaScript strategies call a shared MultiAlphas function library, which needs to be exported and imported only once; Pine Script and EasyLanguage require no library.
- The trial version can also view and export source code, so the full export process can be verified before payment.
Once the source code is modified, the user is responsible for any differences from the original strategy. After modification, compare the trade list again, because the strategy is no longer the version MultiAlphas tested.

For complete steps and every setting, see Tutorial: exporting a strategy to MultiCharts PowerLanguage.
Export one strategy in the free 7-day trial and compare one week of its trade list with MultiCharts side by side.
One strategy,
source code for six platforms.
- 01PowerLanguage
- 02Pine Script v6
- 03
EasyLanguage - 04NinjaScript
- 05MetaTrader 4MQL4
- 06MetaTrader 5MQL5
MultiAlphas exports to compatible platforms including MultiCharts, TradingView, TradeStation, NinjaTrader, MetaTrader 4 and MetaTrader 5. Platform names and logos are trademarks of their respective owners.
One strategy. Six native, human-readable platform scripts.
Click any tab below to inspect sample exported code: clean entry/exit rules, next-bar execution, and explicit protective stops—fully unlocked during your 7-day free trial.
//@version=6
// Illustrative sample by MultiAlphas (multialphas.com) — Unlocked Research Strategy
// Market: CME NQ 60m | Execution: Next-bar open, realistic commission & slippage
strategy("AP_NQ_60m_Breakout_Sample", overlay=true, initial_capital=100000,
commission_type=strategy.commission.cash_per_contract, commission_value=2.5, slippage=2,
process_orders_on_close=false, calc_on_every_tick=false)
lenBreak = input.int(20, "Breakout Lookback")
lenAdx = input.int(14, "ADX Length")
adxMin = input.float(20.0, "Min ADX Filter")
slMult = input.float(2.0, "Stop Loss ATR Mult")
tpMult = input.float(3.5, "Profit Target ATR Mult")
highestHi = ta.highest(high[1], lenBreak)
[_, _, adxVal] = ta.dmi(lenAdx, lenAdx)
atrVal = ta.atr(14)
emaExit = ta.ema(close, 20)
// Confirmed closed-bar signal -> fills on next bar open (zero repainting)
longCond = barstate.isconfirmed and close > highestHi and adxVal > adxMin
if longCond and strategy.position_size == 0
strategy.entry("AP_Long", strategy.long)
if strategy.position_size > 0
stopPx = strategy.position_avg_price - slMult * atrVal
takePx = strategy.position_avg_price + tpMult * atrVal
strategy.exit("AP_Protect", from_entry="AP_Long", stop=stopPx, limit=takePx)
if barstate.isconfirmed and close < emaExit
strategy.close("AP_Long", comment="EMA_Trail_Exit")// Illustrative sample by MultiAlphas (multialphas.com) — MultiCharts PowerLanguage
// Market: CME NQ 60m | Next-bar execution, unlocked source code
Inputs:
LenBreak(20), LenAdx(14), AdxMin(20.0), SlAtrMult(2.0), TpAtrMult(3.5);
Variables:
hh(0), atrVal(0), emaExit(0), stopDist(0), takeDist(0);
hh = Highest(High, LenBreak)[1];
atrVal = AvgTrueRange(14);
emaExit = XAverage(Close, 20);
If MarketPosition = 0 and Close > hh and ADX(LenAdx) > AdxMin Then
Buy ("AP_Long") next bar at market;
If MarketPosition = 1 Then Begin
stopDist = SlAtrMult * atrVal * BigPointValue;
takeDist = TpAtrMult * atrVal * BigPointValue;
SetStopContract;
SetStopLoss(stopDist);
SetProfitTarget(takeDist);
If Close < emaExit Then
Sell ("EMA_Trail_Exit") next bar at market;
End;// Illustrative sample by MultiAlphas (multialphas.com) — NinjaTrader 8 NinjaScript (C#)
// Calculate = Calculate.OnBarClose (zero intra-bar look-ahead)
namespace NinjaTrader.NinjaScript.Strategies
{
public class AP_NQ_60m_Breakout_Sample : Strategy
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Name = "AP_NQ_60m_Breakout_Sample";
Calculate = Calculate.OnBarClose;
IsExitOnSessionCloseStrategy = false;
}
}
protected override void OnBarUpdate()
{
if (CurrentBar < 25) return;
double hh = MAX(High, 20)[1];
double adxVal = ADX(14)[0];
double atrVal = ATR(14)[0];
double emaExit = EMA(Close, 20)[0];
if (Position.MarketPosition == MarketPosition.Flat
&& Close[0] > hh && adxVal > 20.0)
{
SetStopLoss("AP_Long", CalculationMode.Price, Close[0] - 2.0 * atrVal, false);
SetProfitTarget("AP_Long", CalculationMode.Price, Close[0] + 3.5 * atrVal);
EnterLong("AP_Long");
}
else if (Position.MarketPosition == MarketPosition.Long && Close[0] < emaExit)
{
ExitLong("EMA_Trail_Exit", "AP_Long");
}
}
}
}{ Illustrative sample by MultiAlphas (multialphas.com) — TradeStation EasyLanguage }
Inputs:
LenBreak( 20 ), LenAdx( 14 ), AdxMin( 20.0 ),
SlAtrMult( 2.0 ), TpAtrMult( 3.5 );
Vars:
hh( 0 ), atrVal( 0 ), emaExit( 0 );
hh = Highest( High, LenBreak )[1];
atrVal = AvgTrueRange( 14 );
emaExit = XAverage( Close, 20 );
If MarketPosition = 0 and Close > hh and ADX( LenAdx ) > AdxMin Then
Buy ( "AP_Long" ) next bar at market;
If MarketPosition = 1 Then Begin
SetStopShare;
SetStopLoss( SlAtrMult * atrVal * BigPointValue );
SetProfitTarget( TpAtrMult * atrVal * BigPointValue );
If Close < emaExit Then
Sell ( "EMA_Trail_Exit" ) next bar at market;
End;// Illustrative sample by MultiAlphas (multialphas.com) — MetaTrader 5 (MQL5)
// Evaluates strictly on new bar open using closed bar [1] values
#include <Trade\Trade.mqh>
CTrade trade;
input int InpBreakLen = 20;
input int InpAdxLen = 14;
input double InpAdxMin = 20.0;
input double InpSlAtr = 2.0;
input double InpTpAtr = 3.5;
input double InpLots = 1.0;
int hAdx, hAtr, hEma;
datetime lastBarTime = 0;
int OnInit() {
hAdx = iADX(_Symbol, PERIOD_CURRENT, InpAdxLen);
hAtr = iATR(_Symbol, PERIOD_CURRENT, 14);
hEma = iMA(_Symbol, PERIOD_CURRENT, 20, 0, MODE_EMA, PRICE_CLOSE);
return (hAdx != INVALID_HANDLE && hAtr != INVALID_HANDLE && hEma != INVALID_HANDLE)
? INIT_SUCCEEDED : INIT_FAILED;
}
void OnTick() {
datetime barTime = iTime(_Symbol, PERIOD_CURRENT, 0);
if (barTime == lastBarTime) return; // Next-bar open execution only
lastBarTime = barTime;
double adx[], atr[], ema[];
CopyBuffer(hAdx, 0, 1, 1, adx);
CopyBuffer(hAtr, 0, 1, 1, atr);
CopyBuffer(hEma, 0, 1, 1, ema);
int hhIdx = iHighest(_Symbol, PERIOD_CURRENT, MODE_HIGH, InpBreakLen, 2);
double hh = iHigh(_Symbol, PERIOD_CURRENT, hhIdx);
double close1 = iClose(_Symbol, PERIOD_CURRENT, 1);
if (!PositionSelect(_Symbol) && close1 > hh && adx[0] > InpAdxMin) {
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
trade.Buy(InpLots, _Symbol, ask, ask - InpSlAtr * atr[0], ask + InpTpAtr * atr[0], "AP_Long");
} else if (PositionSelect(_Symbol) && close1 < ema[0]) {
trade.PositionClose(_Symbol);
}
}// Illustrative sample by MultiAlphas (multialphas.com) — MetaTrader 4 (MQL4)
// Evaluates strictly on new bar open using closed bar [1] values
extern int InpBreakLen = 20;
extern int InpAdxLen = 14;
extern double InpAdxMin = 20.0;
extern double InpSlAtr = 2.0;
extern double InpTpAtr = 3.5;
extern double InpLots = 1.0;
extern int MagicNumber = 20261125;
datetime lastBarTime = 0;
void OnTick() {
if (Time[0] == lastBarTime) return; // Next-bar open execution only
lastBarTime = Time[0];
double hh = High[iHighest(NULL, 0, MODE_HIGH, InpBreakLen, 2)];
double adx1 = iADX(NULL, 0, InpAdxLen, PRICE_CLOSE, MODE_MAIN, 1);
double atr1 = iATR(NULL, 0, 14, 1);
double ema1 = iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 1);
bool hasLong = false;
for (int i = OrdersTotal() - 1; i >= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderMagicNumber() == MagicNumber) {
hasLong = true;
if (Close[1] < ema1) OrderClose(OrderTicket(), OrderLots(), Bid, 3);
}
}
if (!hasLong && Close[1] > hh && adx1 > InpAdxMin) {
int tk = OrderSend(Symbol(), OP_BUY, InpLots, Ask, 3,
Ask - InpSlAtr * atr1, Ask + InpTpAtr * atr1, "AP_Long", MagicNumber, 0, clrDodgerBlue);
}
}
