Strategy Submission#
This document outlines the technical deliverables, submission rules, suggested approaches, position sizing strategies, PnL formulas, and guidelines for calculating the maximum dip in running trades for the OHLCV data analysis of BTC/USDT across various timeframes.
Technical Deliverables#
Participants are provided with OHLCV data for BTC/USDT in multiple timeframes: 3 minutes, 5 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 6 hours, 12 hours, and 1 day. Aggregation or deduction to other desired timeframes from the provided data is permitted.
This can be found under /work/data of your jupyter workspace.
How to Backtest Your Strategy Using the SDK?#
Requirements for Your Log File To successfully backtest your strategy using the SDK, ensure that your log file (CSV format) adheres to the following specifications: Required Columns:
Your .csv file must include the following columns:
- Basic Price Data
open: Opening price of the asset
high: Highest price during the period
low: Lowest price during the period
close: Closing price of the asset
volume: Trading volume during the period
- signals
Signal indicating the trade action. Valid values are:
1: Long Signal
-1: Short Signal
1,-1: Close
2: Open a new position in the opposite direction (Reverse Short)
-2: Open a new position in the opposite direction (Reverse Long)
0: No action (Hold)
- trade_type
Specifies the type of trade. Valid values are:
LONG: Enter a long position
SHORT: Enter a short position
CLOSE: Close the current position
REVERSE_LONG: Reverse to a long position
REVERSE_SHORT: Reverse to a short position
HOLD: Maintain the current position
- leverage
Must be between 1 and 5
Default value is 1
Can be customized per trade
- position
Percentage of total account balance used for trade:
Range: 50% to 100%
50%: Trades with half of account balance (e.g., $500 out of $1,000)
100%: Trades with full account balance (default)
Example Trades#
1. Basic Long Trade#
open |
high |
low |
close |
volume |
signals |
trade_type |
leverage |
position |
100 |
102 |
99.5 |
101.5 |
1000 |
1 |
LONG |
1 |
100 |
A long position is entered with leverage of 1 using 100% of the account balance.
2. Short Trade with Custom Leverage#
open |
high |
low |
close |
volume |
signals |
trade_type |
leverage |
position |
200 |
202 |
198 |
199.5 |
1500 |
-1 |
SHORT |
2 |
100 |
A short position is entered with leverage of 2 using 100% of the account balance.
3. Reverse to Long Trade with 50% Position#
An existing short position is reversed to long with leverage of 3 using 50% of the account balance.
Advanced Features#
Limit(TP,SL)#
The Limit SDK provides advanced functionality for managing trades with Take Profit (TP) and Stop Loss (SL):
Requirements:
- TP and SL Values:
Must be provided from start with signals
Determine trade exit conditions
- Dynamic Updates:
Values can be updated during trade
Allows adaptation to market conditions
- Exit Calculation:
SDK checks next high/low prices at smallest timeframe
Exits when conditions are met
Example Limit SDK Trades#
Long Trade with Updated TP/SL:
open |
high |
low |
close |
volume |
signals |
trade_type |
leverage |
position |
TP |
SL |
120 121 |
122 123 |
119 120 |
121 122.5 |
800 850 |
1 0 |
LONG HOLD |
1 0 |
100 0 |
125 126 |
118 119 |
TP updated from 125.00 to 126.00, SL from 118.00 to 119.00 while holding.
Short Trade with Limit Exits:
open |
high |
low |
close |
volume |
signals |
trade_type |
leverage |
position |
TP |
SL |
300 298 |
305 304 |
295 293 |
298 295 |
2000 2100 |
-1 0 |
SHORT HOLD |
2 0 |
100 0 |
290 290 |
310 309 |
SL updated to 309.00 while holding short position. .
Additional Requirements:
TSL Column:
Must be included with required columns Used for dynamic stop loss management
Implementation:
Provide initial TSL value with trade entry Update TSL as trade progresses SDK monitors next high/low values No TP/SL columns needed with TSL
Example TSL Trades#
Long Trade with TSL:
open |
high |
low |
close |
volume |
signals |
trade_type |
leverage |
position |
TSL |
100 |
102 |
99.5 |
101.5 |
1000 |
1 |
LONG |
1 |
100 |
99 |
Initial TSL value of 99.00, updated during trade progression.
Short Trade with TSL:
Short position with 201.00 TSL value, tracked based on price movement.
You can refer sample csv in examples section
Make sure ,we execute orders on the closing of timestamps , irrespective of long/short signals.
Suggested Approaches#
Time series models (ARIMA, STL, LSTM networks, etc.).
Machine learning models (regression models, decision trees, random forests, SVMs, etc.).
Deep learning models (RNNs, CNNs, etc.).
Reinforcement learning (Q-learning, deep reinforcement learning, etc.).
Technical analysis using indicators.
Miscellaneous (bagging and boosting, Monte Carlo methods, Markov chains, etc.).
Utilizing Multiple Time Frames in Trading Strategy Development#
This document provides guidance on using multiple time frames in the development of trading strategies, enhancing decision-making through technical analysis. It explains the methodology of combining a smaller and a larger time frame to create robust trading strategies.
Decision-Making Process:
Strategic decisions should be primarily influenced by the larger time frame, which offers a broader view of market trends.
While the smaller time frame provides more frequent updates, decisions should account for the state of the ongoing larger time frame candle, which may still be in progress.
Practical Example:
At a specific point, such as 12:15 PM, a trading period marked by the smaller time frame (e.g., from 12:00 PM to 12:15 PM) concludes, and the data becomes available. However, the corresponding period for the larger time frame (e.g., from 12:00 PM to 4:00 PM) is still open.
Decision Criteria: Strategic decisions should either wait for the completion of the current larger time frame period or rely on the data from the last completed period of the larger time frame (e.g., from 8:00 AM to 12:00 PM) for making immediate decisions. This ensures decisions are made based on complete and reliable data.
Strategy Implementation Challenges:
Live Trading vs. Backtesting: Live trading involves making decisions with ongoing data, which can be incomplete for the larger time frame. Backtesting, however, uses historical data where all periods are completed and known, avoiding issues of incomplete information.
Data Synchronization: It is essential to synchronize decisions by considering the closure of periods in the larger time frame when combining different time frames.
Best Practices:
Wait for Closure: Avoid making decisions based on incomplete larger time frame periods to ensure data integrity and prevent premature actions.
Use Historical Data from the Larger Time Frame: Decisions during the smaller time frame periods should be based on the most recent completed period of the larger time frame.
Ensure Data Consistency: The testing environment for strategies should mirror the live environment by considering the closure times of periods across different time frames.
Frontlook Bias Test#
To ensure your strategy does not rely on future data (frontlook bias), implement the following test: Test Procedure
Pick a Signal:
Select a random signal from the log file generated by your algorithm.
For example, if you are backtesting from 2020-01-01 to 2023-12-31 and a signal is generated at 2023-01-01 11:00:00, pick this signal.
Remove Future Data:
-In the OHLCV data, remove all data after 2023-01-01 11:00:00. -This ensures only data from 2020-01-01 to 2023-01-01 11:00:00 is available for the test.
Re-run the Algorithm:
Backtest the strategy using the truncated data.
Verify the Signal:
Check if the same signal is still generated at 2023-01-01 11:00:00.
If the signal is not generated, your strategy may have a frontlook bias.
By removing future data, this test ensures that the algorithm is not relying on information that would not have been available at the time of the signal.
Profit and Loss (PNL) Formula#
The Profit and Loss (PNL) formula, when you have the entry and exit prices for a trade and you open each trade with $1000, is given by:
Example of a LONG TRADE in BTC USDT#
Given:
Entry price: $35,400
Exit price: $35,800
Investment: $1000 (using a static approach)
The formula calculates PNL as:
This means that, based on the given entry and exit prices, you would make a profit of $11.2 from an investment of $1000 in this BTC/USDT trade.
Example of a SHORT TRADE in BTC USDT#
Given:
Entry price: $36,000
Exit price: $35,750
Investment: $1000 (using a static approach)
The formula calculates PNL as:
This demonstrates how the formula is applied in both LONG and SHORT trades with the specific details provided.
This means that, based on the given entry and exit prices, you would make a profit of $6.75 from the investment of $1000 in this BTC/USDT trade.
For long trades, a profit occurs when the asset’s price increases, and for short trades, a profit occurs when the price decreases. The formulas are structured to account for these directional differences in trading strategies.
Sum up the PNL values for all trades in the log to get the cumulative P&L. This standardized approach will help you guys accurately assess the profitability of your strategy. If you have any questions or need clarification, feel free to reach out to us .
Max Dip In Running Trade (Maximum Adverse Excursion)#
To calculate the maximum dip percentage in your trade, you can use the following formula:
Maximum Dip Percentage#
Example Calculation#
Consider a hypothetical trade with the following details:
Entry Price: $42,000
Lowest Price: $41,000 (this price is the lowest of low ticks between entry and exit of a running trade)
Plugging these values into the formula gives:
Thus, the maximum dip in this trade was approximately 2.38%. This is calculated by taking the difference between the entry price and the lowest price during the trade, dividing it by the entry price, and then expressing the result as a percentage.
This phenomenon works the same for both long and short trades.
You lose less on losing trades and gain relatively higher on winning trades with a slight good win rate . That’s profitable trading in a nutshell.