Spezifikation
3B Strategy
Overview
While the spec breaks this down into step by step details, the model itself is low complexity, as its all done within 3 candles and simple exit criteria (no scaling, etc), intentionally done so for short time to market and management.
Assumptions:
-
The strategy should run for one-to-many accounts, ideally avoiding a trade copier and keeping all control in our code.
-
Multiple trades can be live at once and are independent of any other trade. (meaning we could be both long and short the same instrument).
-
3 candle pattern Setup: We will have a 3 candle pattern that this strategy is based on - for our purposes we will refer to those 3 candles as C1, C2, C3.
-
C1 - Order Block (OB) as defined in below spec.
-
C2 - The close of this candle determines if C1 is an OB or not, details below.
-
C3 - in this strategy only C3 can be the Entry candle - Entry order would be at the opening price of the order block (C1).
-
Orderblock identification logic (C1):
-
Bullish OB : A candle is identified as Bullish OB if it closes lower than its open (meaning the Bullish OB is a red candle itself), followed by a subsequent candle (C2) closing above the high of the OB candle (meaning for Bullish OB, C2 is a green candle)
-
Bearish OB: A candle is identified as Bearish OB if it closes higher than its open (meaning the Bearish OB is a green candle itself), followed by a subsequent candle (C2) closing below the low of the OB candle (meaning for Bearish OB, C2 is a red candle)
-
Entry Conditions (C3) - Once the OB is identified, and OCO order should be placed that exists only for the life of this C3 candle. If the trade is not triggered before the C3 candle closes, then the OB candle is no longer active for trading the 3B setup and the order is canceled.
-
For Bullish OBs
-
Order Type: OCO - one cancels the other
-
Direction: Long
-
Entry Price = OB (C1) Open
-
Stop: Lowest low of C1/C2.
-
Exit Target: 1R. (ex. If we enter long at 100, stop at 90, target would be 110)
-
Size (Number of Contracts): Percent of Account size will be used to calculate the number of contracts to enter. This is defaulted to 10% See Appendix for Size calculation details for each instrument.
-
For Bearish OBs
-
Order Type: OCO - one cancels the other
-
Direction: Short
-
Entry Price = OB (C1 Open
-
Stop: Highest high of C1/C2.
-
Exit Target: 1R. (ex. If we enter short at 100, stop at 120, target would be 80)
-
Size (Number of Contracts): Percent of Account size will be used to calculate the number of contracts to enter. This is defaulted to 10% See Appendix for Size calculation details for each instrument.
-
TimeFrames and instruments in scope: we will want to apply this setup to a number of tickers and timeframes for those tickers. Whether that is best achieved by setting up this strategy one by one for each ticker/time frame combination, or if this one script can be configured for all the combinations is TBD based on the preference would be for whichever provides a more stable/high performing result.. Most probably the time frames are 5 Minutes, 15 Minutes and 1 Hour
-
Protection Features - as we are dealing with trading, we need to have robust protection features in place to ensure we dont get run-away behaviors. As such we need to place parameters is for:
-
Max allowable trade Size - a dollar figure set by the user, default is $10000
Appendix
Trade Size Calculation (number of contracts):
We will calculate trade size based on percentage of total account size, ex. 10% of account size. This will give us a dollar value of what we have as maximum (max) risk.
We will then take this max risk number and use it to calculate the number of contracts to trade based on the instrument and the matrix below.
Detailed Steps:
-
1. Requesting Account Size:
-
2. Determining Max Trade Size:
-
Calculate the dollar amount to risk by multiplying the account size by the user-defined percentage, Ex 10%
-
3. Instrument-Specific Calculation:
-
For each trade, use the calculated dollar amount to risk, along with the instrument's tick size and tick value, to determine the number of contracts or shares to trade.
-
The formula for this calculation is:
-
Trade Size (Number of Contracts = Dollars risk per Trade / (Stop size in Tricks * Tick Value)
Instrument/Tick Size/Tick Value Matrix:
Instrument | Tick Size | Tick Value (USD) |
---|---|---|
MES (Micro E-mini S&P 500 Futures) | 0.25 | $1.25 |
MNQ (Micro E-mini NASDAQ-100 Futures) | 0.25 | $0.50 |
MCL (Micro Crude Oil Futures) | 0.01 | $0.10 |
MGC (Micro Gold Futures) | 0.10 | $1.00 |
M2K (Micro E-mini Russell 2000 Futures) | 0.10 | $0.50 |
MYM (Micro E-mini Dow Jones Futures) | 1.00 | $0.50 |
Example calculation:
To calculate the number of contracts to trade for the MNQ (Micro E-mini NASDAQ-100 Futures) with a $100 maximum risk size, and a 10 tick stop size, we'll use the formula for trade size:
Let's define:
-
Dollar Risk per Trade: $100
-
Stop Size in Ticks: We'll need to define this based on your strategy. For this example, let's assume a stop size of 10 ticks.
-
Tick Value for MNQ: $0.50 per tick
Given these values, we can calculate the number of MNQ contracts to trade to not exceed a $100 risk.
Let's perform this calculation
Based on the given parameters ($100 maximum risk size, 10 tick stop size, and a tick value of $0.50 for MNQ), you would trade 20 contracts of the MNQ (Micro E-mini NASDAQ-100 Futures) to not exceed a $100 risk.
Example 1: Bullish OB Entry, Target hit.
March 22, 2024, 4:05am EST, 5 minute chart
Example 2: Bearish OB Entry, Target hit.
March 21, 2024, 12:25pm EST, 5 minute chart
Example 3: Bullish OB Entry, Trade failed, Stop Hit:
March 22, 2024, 10:40am EST, 5 minute chart
Example 4: Bearish OB Entry, Trade failed, Stop Hit:
March 22, 2024, 13:30pm EST, 5 minute chart