DataMiner Operation Screen Backtest

Run a screen backtest.


This operation allows you to run and collect the output of a screen backtest. The ScreenBacktest operation is basically the same as the ScreenRun operation except that the screen is executed multiple times at the intervals set by the Rebalance Frequency parameter for the period defined by the Start Data and End Date and the returns are calculated for the screen’s holdings.

Input Specification

Default values if not specified are in [brackets]. Any parameter which has a default value is optional and can be omitted. The input script is in YAML syntax. The learn the basics see DataMiner YAML Syntax





# Section with main settings

→ Operation:


→ On Error: 

[Stop],  Continue 

Specifies if you want to stop an operation when there is an error.

→ Precision: 


Decimal precision of the output values.


# Section with operation settings

→ Vendor:

[FactSet], Compustat

→ Type:

[Stock], ETF

→ Screen:

Id of an existing screen.


If the Screen parameter is used, then any other parameters that would override a setting in the existing screen are not allowed and will cause an error.

→ Currency:


→ Trans Price:

[Open], Close, AvgHiLow

Price used in the transactions.

→ Universe:

ALLFUND, SP500, etc.

Specifies the Universe to be used in the operation. Specify the name of your custom universe or one of the Portfolio123 Universes

→ Benchmark:

[SPY], VTI, etc

Instrument that the performance is compared to.

→ PIT method: 

[Complete],  Prelim

“Prelim” includes preliminary data from earnings calls, while “Complete” only includes quarter or annual report data.

→ Start Date:


→ End Date:


→ Rebalance Frequency:

1Day, 1Week, 2Weeks, 3Weeks, [4Weeks], 6Weeks, 8Weeks, 13Weeks, 26Weeks, 52Weeks

→ Max Num Holdings: 

[0] 0 for all.

The maximum number of holdings.

→ Ranking:

see DataMiner Ranking Definition

→ Method:

[Long], Short, LongShort, Hedged

Specifies if your strategy is long, short, long & short or hedged.

→ Rules:

→→ -

Common rules that apply to both long and short positions.

→ Long Rules:

→→ -

Apply to long positions if the Method is LongShort or Hedged.

→ Short Rules:

→→ -

Apply to short positions if the Method is LongShort.

→ Hedge Rules:

→→ -

Apply if the Method is Hedged.

→ Rank Tolerance:


If higher than zero, then any stock that was in the basket during the last rebalance is retained as long as its rank has not slipped below a number of percentage points equal to the Rank Tolerance.

→ Carry Cost:

[1.5] 0-100

Percentage penalty that will be assessed against margined or short positions.

→ Risk Stats Period:

[monthly], weekly, daily

Period used when calculating the statistics presented in the backtest results.

→ Max Pos Pct:

[0]-100. Use 0 for no maximum

Limits the allocation to each position. It does so in conjunction with the Max No Stocks/ETFs setting.

→ Slippage:

[0]-5 in percent

A cost added to each transaction to account for trading costs and price movements.

→ Long Weight:


Only required for Methods LongShort or Hedge.

→ Short Weight:


Only required for Methods LongShort or Hedge.

Sample Input

    Operation: ScreenBacktest
    On Error:  Stop
Default Settings:
    Start Date: 2012-01-01
    End Date: 2022-01-01
    Rebalance Frequency: 4Weeks
    Slippage: .25
    Ranking: 'Core: Value'
    Universe: ALLFUND
    Max Pos Pct: 10
    Max Num Holdings: 20
    Benchmark: IWM
    Trans Price: AvgHiLow
        - MktCap < 300 #microcaps
        - AvgDailyTot(30) > 300000 #tradable
        - Close(0) > Close(90) AND Close(0) > Close(180)
        - Rank >= 70
          #Want the strongest performers.
        - FOrder("close(1)/close(250)",#previous,#desc) <= 35 
          #But filter out the high flyers.
        - FOrder("close(1)/close(250)",#previous,#desc) >= 5

Sample Output