Back Testing fails for long period of data

Hello

Have been trying to do back testing on various stocks over a period of 30 days and upto 180 days.

Most work fine for 30 day back testing, but a high percentage of them are failing when I backtest 180 days.

Here is what I get in the log. Please advise how to resolve:

[2022-01-03 22:15:19] Performing sanity checks on cfg strategy_parameters, setting up required data structures…
[2022-01-03 22:15:23] Sanity checks on cfg successful.
[2022-01-03 22:15:23] Currency set to “INR”
[2022-01-03 22:15:23] Setting up broker connection…
[2022-01-03 22:15:24] Broker connection has been setup successfully.
[2022-01-03 22:15:24] (NSE_EQ) Funds available in client’s ABVIRTUALBROKER account is : INR ‘1000000000.00’
[2022-01-03 22:15:24]
########################################
INITIALIZING ALGOBULLS CORE (v3.3.0 SECURE MODE)…
########################################
[2022-01-03 22:15:24] Welcome ALGOBULLS VIRTUAL USER!
[2022-01-03 22:15:24] Reading strategy…
[2022-01-03 22:15:24] Entering Backtesting mode. Henceforth, all timestamps will be Backtesting timestamps…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] STARTING ALGOBULLS CORE…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls]

####### # ###### ####### ### # #

# # # # # # # # ## # #

# # # # # # # # # #

# # # ###### # # # # # #
   #    #    ####### #   #      #     #  #   # # #     #    

# # # # # # # # # ## #

# # # # # # ### # #
#    #        #####  ####### ######  #     # #       #        #####    

# # # # # # # # # # # # #

# # # # # # # # # # #

# # # #### # # ###### # # # #

####### # # # # # # # # # # # #

# # # # # # # # # # # # #

# ####### ##### ####### ###### ##### ####### #######

####### ######

# # # # #

# # # #

# # ######

# # # #

# # # # #

####### # #

[BT] [2021-06-01 09:15:00,000] [INFO] [tls] --------------------Master Cfg Parameters:--------------------
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] User: ALGOBULLS VIRTUAL USER
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Broker: ABVIRTUALBROKER
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] AUTO_ADD_INSTRUMENTS_BUCKET_FROM_POSITIONS: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] AUTO_ADD_INSTRUMENTS_BUCKET_FROM_HOLDINGS_TPLUS1: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] AUTO_ADD_INSTRUMENTS_BUCKET_FROM_HOLDINGS_TPLUS2: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] RESUME_POSITIONS_ON_START: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] RESUME_HOLDINGS_TPLUS1_ON_START: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] RESUME_HOLDINGS_TPLUS2_ON_START: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] EXIT_INTRADAY_ORDERS_ON_STOP: True
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] EXIT_TPLUS0_DELIVERY_ORDERS_ON_STOP: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] EXIT_TPLUS1_DELIVERY_ORDERS_ON_STOP: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] EXIT_TPLUS2_DELIVERY_ORDERS_ON_STOP: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] --------------------User Cfg Parameters: System Parameters--------------------
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Trading type: BACKTESTING
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] User trading start time: 2021-06-01 09:15:00+05:30
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] User trading end time: 2021-12-31 15:15:00+05:30
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] --------------------User Cfg Parameters: Funds Parameters--------------------
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Credit Exposure: 1
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Fund Allocator: FundAllocatorLots
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Fund Allocator Parameters: {‘NUMBER_OF_LOTS’: 400}
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] --------------------User Cfg Parameters: Candle Parameters--------------------
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Candle interval (sec): 900
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] --------------------User Cfg Parameters: Strategy Parameters--------------------
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Strategy: Two Green Red Candle Price EMA Regular
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Parameters: {‘EMA_PERIOD’: 12.0, ‘PROFIT_BOOKING_PERCENTAGE_BUY’: 2.5, ‘PROFIT_BOOKING_PERCENTAGE_SELL’: 1.0}
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Strategy Mode: INTRADAY
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Instruments Bucket: instruments_bucket | [NSE_EQ:CHOLAFIN]
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] --------------------User Cfg Parameters: Risk Management Parameters--------------------
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Target Trigger: None
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Stoploss Trigger: None
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Trailing Stoploss Trigger: None
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Desired profit: None
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Risk Appetite: None
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] PNL scan frequency (in sec): 30
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] --------------------User Cfg Parameters: Other Parameters--------------------
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Allow multiple orders for same script: True
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Allow new order when order for script already running: True
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Instrument max orders count: 100
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Remove Instrument if Order Rejected: False
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Crossover accuracy decimals: 2
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] ------------------------------------------------------------
[BT] [2021-06-01 09:15:00,000] [INFO] [utils] Instrument (NSE_EQ:CHOLAFIN) subscribed to historical data successfully
[BT] [2021-06-01 09:15:00,000] [INFO] [utils] 1 Instruments subscribed to historical data successfully
[BT] [2021-06-01 09:15:00,000] [INFO] [utils] Prefetching historical data for 1 instruments…
[BT] [2021-06-01 09:15:00,000] [INFO] [strategy]
####################
Strategy Parameters:
StrategyParameters([(‘EMA_PERIOD’, 12),
(‘PROFIT_BOOKING_PERCENTAGE_BUY’, 2.5),
(‘PROFIT_BOOKING_PERCENTAGE_SELL’, 1)])
####################
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Not launching PNL tracker…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Received event EXCEPTION. Stopping AlgoBulls Trading Core Engine…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Cancelling all open orders (if any)… Starting
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Cancelling all open orders (if any)… Done
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Exiting all open positions…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Exiting all open positions with order code: ORDER_CODE_INTRADAY (if any)…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Exiting all open positions with order code: ORDER_CODE_DELIVERY_T0 (if any)…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Exiting all open positions with order code: ORDER_CODE_DELIVERY_T1 (if any)…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] Exiting all open positions with order code: ORDER_CODE_DELIVERY_T2 (if any)…
[BT] [2021-06-01 09:15:00,000] [INFO] [tls] [User: ALGOBULLS VIRTUAL USER] Trading session completed
[BT] [2021-06-01 09:15:00,000] [INFO] [oms]

PENDING ORDERS:

COMPLETED ORDERS:

POSITIONS:

HOLDINGS:

[BT] [2021-06-01 09:15:00,000] [CRITICAL] [tls] An error has occurred due to which the strategy execution cannot proceed anymore. Reason: inputs are all NaN.
If the reason doesn’t help, please double check the tweak parameters. If everything seems fine, please checkout https://community.algobulls.com or contact support@algobulls.com for support.

Hi @Kiwi,

Backtesting is possible as per the following criteria:

  1. for instruments having weekly expiry, backtesting is possible from last week’s Friday till today
  2. for instruments having monthly expiry, backtesting is possible from the last Friday of previous month till today
  3. for all other instruments, backtesting is possible for previous one month from today

Example for 1.
If today is Wednesday, then backtesting is possible from previous Friday till today.

Example for 2.
If today is 05-JAN-2022, Wednesday, then backtesting is possible from 31-DEC-2021 Friday till today.

Example for 3.
If today is 05-JAN-2022, the backtesting is possible for the previous 30 days till today.

Kindly note: Some strategies may require upto 15 days of data for calculations, so choosing the right dates will give the best backtesting results.

Kindly let me know if this helps.
Also, do connect back in case of more queries.

Cheers!
`Akhil