Simple MACD, Smarter Exits - Prop Firm Strategy by Quants_HK
By Quants_HK
Performance Metrics
- Author: Quants_HK
- Symbol: CME_MINI:MES1!
- Timeframe: 1 minute
- Profit Factor: ,
Description
*Simple MACD, Smarter Exits - Prop Firm Strategy**Overview*When developing trading strategies, many traders spend considerable time improving entry signals. However, exit rules can have an equally important impact on profitability and maximum drawdown.This strategy explores how simple MACD crossover entries can be combined with a structured exit mechanism, particularly for traders researching strategies for prop firm challenges.Instead of introducing additional entry filters, the strategy combines a time-based profit check with a step-based RSI trailing exit mechanism. The objective is to limit the holding time of unsuccessful trades while allowing favorable price movements to develop further.*1. Entry Rules*The strategy uses simple MACD crossovers as entry signals:- Long: The MACD line crosses above the signal line.- Short: The MACD line crosses below the signal line.New positions are opened only when there is no existing position. Opposite MACD signals do not automatically close or reverse an existing position.*2. Time-Based Profit Check*By default, the strategy evaluates the position after eight bars.If the position has no unrealized profit based on the current closing price relative to the entry price, the position is closed.If the position is profitable based on this price comparison, the strategy records the current RSI(9) value and activates the RSI trailing exit mechanism.The initial profit check does not deduct commissions or estimated exit slippage.Unlike a conventional fixed holding period, this mechanism allows profitable positions to remain open beyond the initial eight-bar evaluation period.*3. Step-Based RSI Trailing Exit*For long positions, suppose the recorded RSI value is 53 when the trailing mechanism is activated.Using the default settings:- RSI reaches 55: The exit level is set to 53.- RSI reaches 57: The exit level increases to 55.- RSI reaches 59: The exit level increases to 57.- RSI reaches 61: The exit level increases to 59.The long position is closed when RSI falls to or below the established exit level.For short positions, the strategy applies a different trailing adjustment.Suppose the recorded RSI value is also 53:- RSI reaches 51: The exit level is set to 52.- RSI reaches 49: The exit level decreases to 51.- RSI reaches 47: The exit level decreases to 50.The short position is closed when RSI rises to or above the established exit level.After activation, the strategy records the highest RSI for long positions and the lowest RSI for short positions. The established trailing level only moves in the favorable direction.*4. Originality and Design Concept*The distinctive feature of this strategy is not the MACD entry signal or the standard RSI calculation itself, but the structure of its two-stage exit mechanism.The first stage uses holding time and unrealized price performance to determine whether a position should remain open.The second stage uses a step-based RSI trailing mechanism to manage positions that pass the initial evaluation.Unlike a conventional fixed-time exit, this approach allows the holding period to vary according to price performance and market momentum.In addition, the trailing adjustments are independently configurable for long and short positions, allowing users to investigate asymmetric exit behavior without modifying the original MACD entry signals.This combination enables users to study the relationship between holding time, momentum-based exits, profitability, and maximum drawdown.*5. Default Parameters*- MACD Fast Length: 14- MACD Slow Length: 26- MACD Signal Length: 9- Bars Before Profit Check: 8- RSI Length: 9- RSI Trigger Step: 2- Long Stop Increase Per Step: 2- Short Stop Decrease Per Step: 1The MACD parameters provide a simple crossover-based entry framework.The eight-bar holding period is used as the initial evaluation window.RSI(9) is selected as the default setting to balance responsiveness to short-term momentum changes with sensitivity to temporary price fluctuations. This parameter was selected through recent historical testing and is not intended to represent a universally optimal setting.The two-point RSI trigger step and the different trailing adjustments for long and short positions allow users to investigate how exit sensitivity affects strategy performance.All these parameters are configurable.*6. Default Strategy Properties*- Initial capital: USD 100,000- Order size: 1 contract- Pyramiding: 0- Commission: USD 1 per contract, per side- Slippage: 1 tick per applicable order- Long margin: 100%- Short margin: 100%- Order processing: On bar close- Recalculation on every tick: Disabled- Recalculation after order fills: DisabledThe initial capital and fixed contract size provide a consistent starting point for strategy evaluation.The 100% margin settings avoid assuming additional leverage. Users should ensure that capital and margin requirements are appropriate for the selected instrument.Commission and slippage are illustrative transaction cost assumptions for micro futures research and should be adjusted according to the selected instrument and actual execution costs.Bar-close calculations are used to evaluate trading signals without relying on intrabar signal changes.*7. How to Use*Apply the strategy to a standard candlestick chart. The strategy is primarily intended for short-term trading research, including micro index futures.The following elements are displayed in the indicator pane:- Aqua line: Current RSI value.- Gray line: RSI value recorded when the trailing mechanism is activated.- Orange line: Current RSI trailing exit level.- Green circles: Long trailing mechanism is active.- Red circles: Short trailing mechanism is active.Users can adjust the holding period, RSI length, trigger step, and trailing adjustments through the strategy's Inputs settings.When comparing different exit configurations, users should keep the entry parameters, instrument, timeframe, position size, and transaction costs unchanged.In addition to profitability, users should evaluate maximum drawdown, profit factor, average trade performance, margin calls, and the number of completed trades.Testing across different historical periods is also important when evaluating parameter stability.*8. Limitations*The RSI trailing exit level is based on momentum rather than an actual market price. It does not guarantee that a specific amount of profit will be retained.The first RSI exit level is established only after RSI reaches the initial favorable trigger step. Before this condition is met, the position remains open unless it is closed by the broker emulator.*中文說明**策略簡介*其實無論使用甚麼交易策略,除了研究入市訊號外,平倉準則對整個策略的盈利及Maximum Drawdown(最大回撤)亦有很大影響。尤其是要應付Prop Firm考試,除了要累積足夠的盈利,更重要的是如何控制Maximum Drawdown。這個策略主要研究如何利用最簡單的MACD黃金交叉及死亡交叉作為入市訊號,再配合持倉時間及RSI移動平倉準則,研究不同平倉方法對交易策略表現的影響。這個平倉方法的目的,是讓一些未有盈利的交易盡早平倉,但若果入市後出現單邊市,則可以保留繼續持倉的空間。*1. 入市準則*- MACD出現黃金交叉便造好。- MACD出現死亡交叉便造淡。策略只會在沒有持倉時建立新倉,持倉期間出現相反的MACD訊號,並不會直接平倉或反手。*2. 利用持倉時間設定平倉準則*預設在入市後第8根K線,策略會比較當時的收市價與入市價,檢查持倉是否有帳面盈利。若果未有盈利便立即平倉,但若果已有盈利,則會記錄當時的RSI(9)數值,並啟動RSI移動平倉機制。這個盈利檢查並未扣除交易手續費及預計平倉滑價。與固定持倉時間的平倉方法不同,這個方法容許已有盈利的交易在持倉8根K線後繼續持倉。*3. RSI移動平倉準則*假設造好後第8根K線已有盈利,而當時的RSI為53,策略便會記錄這個數值。根據預設參數:- RSI升至55,平倉水平設定為53。- RSI升至57,平倉水平提高至55。- RSI升至59,平倉水平提高至57。- RSI升至61,平倉水平提高至59。直至RSI回落至或跌穿所設定的平倉水平,策略才會發出平倉訊號。至於造淡時,則採用不同的平倉水平調整幅度。假設初始RSI同樣為53:- RSI跌至51,平倉水平設定為52。- RSI跌至49,平倉水平降低至51。- RSI跌至47,平倉水平降低至50。直至RSI回升至或升穿所設定的平倉水平,策略才會發出平倉訊號。啟動移動平倉機制後,策略會持續記錄造好時的最高RSI,或造淡時的最低RSI,而已設定的平倉水平只會向有利於持倉的方向移動。*4. 策略的設計概念及特色*這個策略的特色並非MACD或RSI本身的計算方法,而是如何將持倉時間及RSI結合成一套分兩個階段執行的平倉機制。第一個階段是利用持倉時間及價格表現,判斷是否應該繼續持倉;第二個階段則利用RSI的變化,為通過首次檢查的交易設定移動平倉準則。與固定持倉時間的平倉方法不同,這個策略會根據入市後的價格表現及市場動力,決定每宗交易的持倉時間。另外,造好及造淡時的RSI平倉水平調整幅度可以分別設定,方便大家在完全不修改入市訊號的情況下,研究不同平倉準則對交易策略表現的影響。*5. 預設參數*- MACD快速線周期:14- MACD慢速線周期:26- MACD訊號線周期:9- 首次持倉檢查:8根K線- RSI計算周期:9- RSI觸發步長:2- 造好平倉水平調整幅度:2- 造淡平倉水平調整幅度:1MACD的參數用來建立一套簡單的入市準則,而8根K線則作為首次檢查持倉表現的時間。預設使用RSI(9),主要是希望在反映短期市場動力變化的同時,減少短暫價格波動對平倉訊號的影響。這個RSI參數是根據近期歷史數據進行測試後選出的設定,並非適用於所有市況的最佳參數。不同的RSI觸發步長及平倉水平調整幅度,則可以用來研究平倉準則的敏感程度。以上所有參數均可以自行修改。*6. 預設回測設定*- 初始本金:100,000美元- 每次交易:1張合約- 不加倉- 手續費:每張合約單邊1美元- 滑價:每宗適用訂單1 Tick- 長倉保證金比例:100%- 短倉保證金比例:100%- 在K線收市時處理訂單- 不在每次Tick更新時重新計算- 不在訂單成交後立即重新計算固定本金及合約數量是為了建立一致的回測條件,而100%的保證金比例則是不假設使用額外槓桿。大家應按照所測試商品的合約價值,設定適當的本金及保證金比例。手續費及滑價為微型期貨策略研究的示例設定,大家應按照所測試的商品及實際交易成本作出調整。策略在K線收市時計算交易訊號,而非根據K線形成期間的訊號變化執行交易。*7. 使用方法*將策略套用於普通K線圖,主要用作短周期交易研究,包括微型指數期貨。圖表內不同顏色的線及標記分別代表:- 淺藍色線:當前RSI數值。- 灰色線:啟動移動平倉機制時所記錄的RSI數值。- 橙色線:當前RSI移動平倉水平。- 綠色圓點:造好時的RSI移動平倉機制已啟動。- 紅色圓點:造淡時的RSI移動平倉機制已啟動。大家可以在策略的Inputs內自行修改持倉時間、RSI計算周期、RSI觸發步長,以及造好和造淡時調整平倉水平的幅度。比較不同平倉準則時,可以先維持入市參數、交易商品、時間周期、合約數量及交易成本不變,再比較盈利、Maximum Drawdown、Profit Factor、平均每宗交易表現、Margin Call及交易次數。另外,亦應該利用不同時段的歷史數據,測試不同參數的穩定性。這個策略主要用作研究與Prop Firm考試相關的平倉方法,並非一套已加入個別Prop Firm完整考核準則的交易策略。本開源策略只供交易策略研究及教育用途,歷史回測表現並不代表未來的交易表現。