C# Класс Forex_Strategy_Builder.Backtester

Class Backtester
Наследование: Data
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AnalyseEntry void
AnalyseExit void
AnalysePermanentSLExit void
AnalysePermanentTPExit void
ArrangeBarsHighLow void
BarInterpolation void
CalculateAdditionalStats void
CancelInvalidOrders void
CancelNoexecutedEntryOrders void
CancelNoexecutedExitOrders void
CheckOrd bool
EntryLogicConditions void
ExecOrd OrderStatus
ExecuteEntryAtClosingPrice void
ExecuteEntryAtOpeningPrice void
ExecuteExitAtClosingPrice void
FastCalculating bool
FindCancelExitOrder void
GenerateAccountStats void
GenerateAccountStatsInMoney void
IntrabarScanning bool
MarginCallCheckAtBarClosing void
NearestMethod void
NormalizeEntryLots double
OptimisticPessimisticMethod void
OrdBuyLimit void
OrdBuyMarket void
OrdBuyStop void
OrdBuyStopLimit void
OrdSellLimit void
OrdSellMarket void
OrdSellStop void
OrdSellStopLimit void
RandomMethod void
ResetStart void
ResetStop void
SetAdditioanlMoneyStats void
SetAdditioanlStats void
SetEntryOrders void
SetExitOrders void
SetPosition void
ShortestMethod void
TickScanning bool
TransferFromPreviousBar void

Открытые методы

Метод Описание
AccountExchangeRate ( double price ) : double

Account Exchange Rate.

BalanceDrawdown ( int bar ) : int

Returns the Balance Drawdown in pips

Calculate ( ) : void

Calculate strategy

CalculateAccountStats ( ) : void

Calculates the account statistics.

Calculation ( ) : void

The main calculating cycle

Commission ( double lots, double price, bool isPosClosing ) : double

Calculates the commission in pips.

CommissionInMoney ( double lots, double price, bool isPosClosing ) : double

Calculates the commission in currency.

EquityDrawdown ( int bar ) : int

Returns the Equity Drawdown in pips

LongBalance ( int bar ) : int

Returns the long balance at the end of the bar in pips.

LongMoneyBalance ( int bar ) : double

Returns the long balance at the end of the bar in money.

MoneyBalanceDrawdown ( int bar ) : double

Returns the Balance Drawdown in currency

MoneyEquityDrawdown ( int bar ) : double

Returns the Equity Drawdown in currency.

MoneyToPips ( double money, int bar ) : double

Converts money to pips.

PipsToMoney ( double pips, int bar ) : double

Converts pips to money.

RequiredMargin ( double lots, int bar ) : double

Calculates the required margin.

RolloverInMoney ( PosDirection posDir, double lots, int daysRollover, double price ) : double

Calculates the rollover fee in currency.

Scan ( ) : void

Performs an intrabar scanning

ShortBalance ( int bar ) : int

Returns the short balance at the end of the bar in pips.

ShortMoneyBalance ( int bar ) : double

Returns the short balance at the end of the bar in money.

TradingSize ( double size, int bar ) : double

Calculates the trading size in normalized lots.

Приватные методы

Метод Описание
AnalyseEntry ( int bar ) : void

Checks the slots for a permission to open a position. If there are no filters that forbid it, sets the entry orders.

AnalyseExit ( int bar ) : void

Sets the close orders for the indicated bar.

AnalysePermanentSLExit ( int bar ) : void

Sets Permanent Stop Loss close orders for the indicated bar

AnalysePermanentTPExit ( int bar ) : void

Sets Permanent Take Profit close orders for the indicated bar

ArrangeBarsHighLow ( int bar ) : void

Arranges the order of hitting the bar's Top and Bottom.

BarInterpolation ( int bar ) : void

Arranges the orders inside the bar.

CalculateAdditionalStats ( ) : void

Calculates the values of the stats parameters.

CancelInvalidOrders ( int bar ) : void

Checks all orders in the current bar and cancels the invalid ones.

CancelNoexecutedEntryOrders ( int bar ) : void

Cancel all no executed entry orders

CancelNoexecutedExitOrders ( int bar ) : void

Cancel all no executed exit orders

CheckOrd ( int bar, int iOrd ) : bool

Checks the order

EntryLogicConditions ( int bar, string group, double buyPrice, double sellPrice, bool &canOpenLong, bool &canOpenShort ) : void

checks if the opening logic conditions allow long or short entry.

ExecOrd ( int bar, Order order, double price, BacktestEval testEval ) : OrderStatus

Tunes and Executes an order

ExecuteEntryAtClosingPrice ( int bar ) : void

Executes an entry at the closing of the bar

ExecuteEntryAtOpeningPrice ( int bar ) : void

Executes an entry at the beginning of the bar

ExecuteExitAtClosingPrice ( int bar ) : void

Executes an exit at the closing of the bar

FastCalculating ( int startBar ) : bool

Calculate statistics

FindCancelExitOrder ( int bar, Order order ) : void

Finds and cancels the exit order of an entry order

GenerateAccountStats ( ) : void

Generate the Account Statistics in pips.

GenerateAccountStatsInMoney ( ) : void

Generate the Account Statistics in currency.

IntrabarScanning ( int bar, BacktestEval eval, double &current, int &reachedIntrabar, int &tradedIntrabar, bool isTopReachable, bool isBottomReachable, bool isHigherPrice, bool isLowerPrice, double priceHigher, double priceLower, Order orderHigher, Order orderLower, bool isClosingAmbiguity ) : bool

Intrabar Scanning

MarginCallCheckAtBarClosing ( int bar ) : void

Checks and perform actions in case of a Margin Call

NearestMethod ( int bar, BacktestEval eval, double &current, bool isTopReachable, bool isBottomReachable, bool isHigherPrice, bool isLowerPrice, double priceHigher, double priceLower, Order orderHigher, Order orderLower, bool isClosingAmbiguity ) : void

Nearest order first Method

NormalizeEntryLots ( double lots ) : double
OptimisticPessimisticMethod ( int bar, BacktestEval eval, double &current, bool isTopReachable, bool isBottomReachable, bool isHigherPrice, bool isLowerPrice, double priceHigher, double priceLower, Order orderHigher, Order orderLower, bool isClosingAmbiguity ) : void

Optimistic / Pessimistic Method

OrdBuyLimit ( int bar, int orderIf, int toPos, double lots, double price, OrderSender sender, OrderOrigin origin, string note ) : void

Sets a new order Buy Limit.

OrdBuyMarket ( int bar, int orderIf, int toPos, double lots, double price, OrderSender sender, OrderOrigin origin, string note ) : void

Sets a new order Buy Market.

OrdBuyStop ( int bar, int orderIf, int toPos, double lots, double price, OrderSender sender, OrderOrigin origin, string note ) : void

Sets a new order Buy Stop.

OrdBuyStopLimit ( int bar, int orderIf, int toPos, double lots, double price1, double price2, OrderSender sender, OrderOrigin origin, string note ) : void

Sets a new order Buy Stop Limit.

OrdSellLimit ( int bar, int orderIf, int toPos, double lots, double price, OrderSender sender, OrderOrigin origin, string note ) : void

Sets a new order Sell Limit.

OrdSellMarket ( int bar, int orderIf, int toPos, double lots, double price, OrderSender sender, OrderOrigin origin, string note ) : void

Sets a new order Sell Market.

OrdSellStop ( int bar, int orderIf, int toPos, double lots, double price, OrderSender sender, OrderOrigin origin, string note ) : void

Sets a new order Sell Stop.

OrdSellStopLimit ( int bar, int orderIf, int toPos, double lots, double price1, double price2, OrderSender sender, OrderOrigin origin, string note ) : void

Sets a new order Sell Stop Limit.

RandomMethod ( int bar, BacktestEval eval, double &current, bool isTopReachable, bool isBottomReachable, bool isHigherPrice, bool isLowerPrice, double priceHigher, double priceLower, Order orderHigher, Order orderLower, bool isClosingAmbiguity ) : void

Random Execution Method

ResetStart ( ) : void

Resets the variables and prepares the arrays

ResetStop ( ) : void

Resets the variables at the end of the test.

SetAdditioanlMoneyStats ( ) : void

Sets the additional stats in Money.

SetAdditioanlStats ( ) : void

Sets the additional stats in pips.

SetEntryOrders ( int bar, double price, PosDirection posDir, double lots ) : void

Sets an entry order

SetExitOrders ( int bar, double priceStopLong, double priceStopShort ) : void

Sets an exit order

SetPosition ( int bar, OrderDirection ordDir, double lots, double price, int ordNumb ) : void

Sets the position.

ShortestMethod ( int bar, BacktestEval eval, double &current, bool isTopReachable, bool isBottomReachable, bool isHigherPrice, bool isLowerPrice, double priceHigher, double priceLower, Order orderHigher, Order orderLower, bool isClosingAmbiguity ) : void

Shortest route inside the bar Method

TickScanning ( int bar, BacktestEval eval, double &current, int &reachedTick, bool isTopReachable, bool isBottomReachable, bool isHigherPrice, bool isLowerPrice, double priceHigher, double priceLower, Order orderHigher, Order orderLower, bool isClosingAmbiguity ) : bool

Tick Scanning

TransferFromPreviousBar ( int bar ) : void

Описание методов

AccountExchangeRate() публичный статический Метод

Account Exchange Rate.
public static AccountExchangeRate ( double price ) : double
price double
Результат double

BalanceDrawdown() публичный статический Метод

Returns the Balance Drawdown in pips
public static BalanceDrawdown ( int bar ) : int
bar int
Результат int

Calculate() публичный статический Метод

Calculate strategy
public static Calculate ( ) : void
Результат void

CalculateAccountStats() публичный статический Метод

Calculates the account statistics.
public static CalculateAccountStats ( ) : void
Результат void

Calculation() публичный статический Метод

The main calculating cycle
public static Calculation ( ) : void
Результат void

Commission() публичный статический Метод

Calculates the commission in pips.
public static Commission ( double lots, double price, bool isPosClosing ) : double
lots double
price double
isPosClosing bool
Результат double

CommissionInMoney() публичный статический Метод

Calculates the commission in currency.
public static CommissionInMoney ( double lots, double price, bool isPosClosing ) : double
lots double
price double
isPosClosing bool
Результат double

EquityDrawdown() публичный статический Метод

Returns the Equity Drawdown in pips
public static EquityDrawdown ( int bar ) : int
bar int
Результат int

LongBalance() публичный статический Метод

Returns the long balance at the end of the bar in pips.
public static LongBalance ( int bar ) : int
bar int
Результат int

LongMoneyBalance() публичный статический Метод

Returns the long balance at the end of the bar in money.
public static LongMoneyBalance ( int bar ) : double
bar int
Результат double

MoneyBalanceDrawdown() публичный статический Метод

Returns the Balance Drawdown in currency
public static MoneyBalanceDrawdown ( int bar ) : double
bar int
Результат double

MoneyEquityDrawdown() публичный статический Метод

Returns the Equity Drawdown in currency.
public static MoneyEquityDrawdown ( int bar ) : double
bar int
Результат double

MoneyToPips() публичный статический Метод

Converts money to pips.
public static MoneyToPips ( double money, int bar ) : double
money double
bar int
Результат double

PipsToMoney() публичный статический Метод

Converts pips to money.
public static PipsToMoney ( double pips, int bar ) : double
pips double
bar int
Результат double

RequiredMargin() публичный статический Метод

Calculates the required margin.
public static RequiredMargin ( double lots, int bar ) : double
lots double
bar int
Результат double

RolloverInMoney() публичный статический Метод

Calculates the rollover fee in currency.
public static RolloverInMoney ( PosDirection posDir, double lots, int daysRollover, double price ) : double
posDir PosDirection
lots double
daysRollover int
price double
Результат double

Scan() публичный статический Метод

Performs an intrabar scanning
public static Scan ( ) : void
Результат void

ShortBalance() публичный статический Метод

Returns the short balance at the end of the bar in pips.
public static ShortBalance ( int bar ) : int
bar int
Результат int

ShortMoneyBalance() публичный статический Метод

Returns the short balance at the end of the bar in money.
public static ShortMoneyBalance ( int bar ) : double
bar int
Результат double

TradingSize() публичный статический Метод

Calculates the trading size in normalized lots.
public static TradingSize ( double size, int bar ) : double
size double
bar int
Результат double