代做High Grade Copper Futures (HG) Trading Strategy调试R语言程序

High Grade Copper Futures (HG) Trading Strategy

Overview

Forecasting

Directional signal comes from a 3-factor regression using China Caixin PMI, USD index (DXY), and LME copper inventory levels for daily price movements in copper.

Roll-Yield Management

Manage the cost of carry (contango/backwardation). Profits from the above forecasting signal can be wiped out by roll costs. The model will damp the position size based on carry filters preventing headwinds.

Data Sourcing / Contract Specs

HG Copper Contract

· Contract Size – 25,000 lbs

· Quote – USD/Pound

· Minimum Tick - $0.0005/lb

· Tick Value - $12.5 per contract per tick

· Point Value - $250 per $0.01/lb move

Data Required

Dependent Variables

· HG1 – Log-difference of the COMEX HG front continuous price times 100 (forecasted value by the model)

Independent Variables

· DXY – Log-difference of the USD index times 100

· PMI – Level change in the Caixin manufacturing PMI (linearly interpolate the monthly values to find daily)

· STOCKS – Log-difference of LME inventories on-warrant copper stocks times 100

All of these are available on FactSet

Carry Filter Inputs

· Daily settlement prices for the front-month and second-deferred HG contracts (this will indicate contango/backwardation)

Risk and Roll Data

· Daily high, low, close data for the 14-day average true range (ATR)

· First day notice (FND) and Last Trade Day (LTD) for all historical HG contracts.

Trading Plan

Entry Criteria

Entry signals are checked once per day, only using available data before the market open to generate signal for the day

Signal

The model will be as follows 

· Regression will be run over a historical window (2 years, or another) to find the betas

· Each morning, the script. will enter the new values of DXY, PMI, and STOCKS to generate a new HG1 return

· Singal is generated when it hits a threshold (for example +0.1%)

o Take long position if forecasted return (HG1) > 0.1%

o Take short position if forecasted return < 0.1%

o Hold / Do nothing if forecast is between -0.1% and 0.1%, i.e. do not have any position

Carry / Roll Yield Filter

If the decision is something other than neutral, the model will check the carry filter before sizing the trade. This avoids bad trades

Long Entry Filter

· If Spread (Contango) is > $0.01/lb but < $0.02/lb, position size is halved.

· If Spread (Contango) is > $0.02/lb, position size is quartered or stand aside (no trade).

· If Spread is <=$0.01/lb or in backwardation, we take the full position size.

Short Entry Filter

· If Spread (Backwardation) is < $0.01/lb but < $0.02/lb, position size is halved.

· If Spread (Backwardation) is < $0.02/lb, position size is quartered or stand aside (no trade).

· If Spread is >=$0.01/lb or in contango, we take the full position size.

Contract Selection & Roll Logic:

Active Contract

We will always hold the first-deferred month contract to reduce delivery risk.

Roll Execution

We must exit our current position and enter the new first-deferred month (which is the old second-deferred month) exactly five trading days before the front month's First Notice Day (FND)

Trade Exit Criteria

Stop-Loss (Risk Management)

· Our primary stop-loss will be a trailing stop based on the 14-day Average True Range (ATR).

· Stop Distance: The stop will be placed at 1.5 times the 14-day ATR from the current price.

Signal Reversal (Exit)

· A long position is closed if the Forecasted Return from the 3-factor model flips to Hold/Neutral or Short Entry.

· A short position is closed if the Forecasted Return flips to Hold/Neutral or Long Entry.

Rolls (Forced Exit)

· All positions are automatically exited 5 trading days before FND, as per the roll logic.

Position Size Determination

Sizing is rules-based and anchored to a fixed-dollar risk budget per trade.

Variables

Account_Equity: Total capital.

Risk_Percent: The percentage of equity to risk per trade (e.g., 1.0%).

Max_Risk_Dollars: Account_Equity * Risk_Percent.

Sizing Algorithm

1. Calculate ATR: Compute the current 14-day ATR of HG futures.

2. Define Stop Distance: Stop_Distance_per_lb = 1.5 * ATR.

3. Calculate Risk per Contract: Dollar_Risk_per_Contract = Stop_Distance_per_lb * 25,000.

a. Example: $0.0675/lb * 25,000 lbs = $1,687.50 risk per contract.

4. Calculate Base Position Size: Base_Contracts = floor( Max_Risk_Dollars / Dollar_Risk_per_Contract ) .

a. Example: floor($100,000 / $1,687.50) = 59 contracts.

5. Apply Carry Damping (Edge):

a. Final_Contracts = Base_Contracts * (Carry Filter Multiplier).

b. Example: If the Spread is > $0.02/lb (strong contango), the multiplier is 0.25. The script. would size down from 59 contracts to floor (59 * 0.25) = 14 contracts.

Trade Execution Rules

Order Types

· Stop-Limit orders for all stops, as Stop-Market orders risk slippage in thin markets.

· The limit offset will be rules-based: Limit Band = max(4 ticks, 1.5 * average overnight spread), as derived from the logic in the manual .

Execution Timing (Script. Rules):

· Blackout Periods: The script. will be prohibited from executing trades during two high-risk periods identified in the manual:

o The Settlement Window.

o The "exact minute" of major data releases, such as the PMI data our model uses or FOMC announcements.

· Liquidity: The script. will prioritise execution during the "thick" U.S. day session.

Extra Logic – For ease of understanding

Currently in a long Position:

· And the new signal is long: do nothing. continue to hold long position.

· And the new signal is neutral: exit long position ( flatten the book) and hold cash.

· And the new signal is short: exit long position and enter a new short position (subject to the carry filter).

Currently in a short Position:

· And the new signal is short: do nothing. continue to hold short position.

· And the new signal is neutral: exit short position (flatten book).

· And the new signal is long: exit short position and enter a new long position (subject to the carry filter).

Currently in NO Position (Neutral/Cash):

· And the new signal is neutral: do nothing.

· And the new signal is long: enter a new long position (sized by the carry filter).

· And the new signal is short: enter a new short position (sized by the carry filter).

Backtesting & Strategy Refinement (For Part B)

Backtesting (Part A):

We will backtest this strategy, making sure to log P&L from two separate sources

1. Directional P&L (from the price change)

2. Roll P&L (from the cost/gain of rolling the contract).

This will prove our dual edge by showing:

1. The predictive power of the 3-factor model.

2. The P&L saved (or earned) by the carry-filter and roll-management logic.

· Refinement (Part B):

Since our baseline model is already advanced, our refinements can be sophisticated:

· Optimize Thresholds: We can optimize the Forecasted Return threshold (e.g., is 0.10% the best?) and the Carry Filter thresholds (e.g., is $0.01/lb$ the best?).

Data Required:

1. Daily HLC for the First-Deferred (M2) HG Contract (for ATR).

2. Daily Settlement Price for the Second-Deferred (M3) HG Contract (for the carry spread).

3. Daily Settlement Price for the Front Continuous HG Contract (for the HG1 variable).

4. Daily Level for the DXY.

5. Daily Tonnage for LME On-Warrant Copper Stocks.

6. Monthly Level for China Caixin Manufacturing PMI.

7. Reference Calendar of First Notice Days (FNDs) for all historical HG contracts.

Assumed Transaction Costs (Direct Cost + Slippage [Spread Costs])

Total Transaction Cost (For Your Model)

Deduct the sum of these two costs from every round-turn trade (every time a position is opened and closed).

· Total Cost = (Direct Costs) + (Indirect Costs)

· Total Cost $7.50 (Commissions) + $25.00 (Slippage)

·  $32.50 per contract, per round-turn trade.

 

 

 

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图