feat: Add Direction Mode to v11.2 INDICATOR for LONG-only trading
- Added 'Trade Direction' dropdown (Both/Long Only/Short Only) - Default set to 'Long Only' to disable SHORT signals - Signals filtered by allowLong/allowShort before alerts fire - Debug table shows current direction mode setting - User discovered 84% win rate on LONGs - shorts need optimization - Production ready for LONG-only live trading
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
//@version=6
|
||||
indicator("Money Line v11.2 INDICATOR", shorttitle="ML v11.2", overlay=true)
|
||||
// V11.2 INDICATOR VERSION (Dec 26, 2025):
|
||||
// V11.2 INDICATOR VERSION (Jan 2, 2026):
|
||||
// Production indicator with ALERTS for n8n webhook
|
||||
// Verified backtest: +53.80% return, PF 2.617, 202 trades, 8.35% max DD
|
||||
// Added Direction Mode: Trade LONG only until SHORT settings optimized
|
||||
|
||||
// === DIRECTION MODE ===
|
||||
directionMode = input.string("Long Only", "Trade Direction", options=["Both", "Long Only", "Short Only"], group="Direction", tooltip="Set to 'Long Only' to disable SHORT signals")
|
||||
|
||||
// === CORE PARAMETERS (OPTIMIZED) ===
|
||||
atrPeriod = input.int(12, "ATR Period", minval=1, group="Core")
|
||||
@@ -157,9 +160,13 @@ sellFlip = trend == -1 and trend[1] == 1
|
||||
buyReady = ta.barssince(buyFlip) == confirmBars
|
||||
sellReady = ta.barssince(sellFlip) == confirmBars
|
||||
|
||||
// FINAL SIGNALS (all filters applied!)
|
||||
finalLongSignal = buyReady and adxOk and longBufferOk and rsiLongOk and longPositionOk and volumeOk
|
||||
finalShortSignal = sellReady and adxOk and shortBufferOk and rsiShortOk and shortPositionOk and volumeOk
|
||||
// Direction filters
|
||||
allowLong = directionMode == "Both" or directionMode == "Long Only"
|
||||
allowShort = directionMode == "Both" or directionMode == "Short Only"
|
||||
|
||||
// FINAL SIGNALS (all filters applied + direction mode!)
|
||||
finalLongSignal = buyReady and adxOk and longBufferOk and rsiLongOk and longPositionOk and volumeOk and allowLong
|
||||
finalShortSignal = sellReady and adxOk and shortBufferOk and rsiShortOk and shortPositionOk and volumeOk and allowShort
|
||||
|
||||
// =============================================================================
|
||||
// ALERT MESSAGE CONSTRUCTION
|
||||
@@ -249,9 +256,9 @@ if barstate.islast
|
||||
table.cell(dbg, 1, 4, useVolumeFilter ? (str.tostring(volumeRatio, "#.##") + "x" + (volumeOk ? " ✓" : " ✗")) : "OFF", text_color=useVolumeFilter ? (volumeOk ? color.lime : color.orange) : color.gray)
|
||||
table.cell(dbg, 0, 5, "Entry Buffer", text_color=color.white)
|
||||
table.cell(dbg, 1, 5, longBufferOk or shortBufferOk ? "OK ✓" : "—", text_color=longBufferOk or shortBufferOk ? color.lime : color.gray)
|
||||
table.cell(dbg, 0, 6, "Signal", text_color=color.white)
|
||||
table.cell(dbg, 1, 6, finalLongSignal ? "BUY!" : finalShortSignal ? "SELL!" : "—", text_color=finalLongSignal ? color.lime : finalShortSignal ? color.red : color.gray)
|
||||
table.cell(dbg, 0, 7, "Version", text_color=color.white)
|
||||
table.cell(dbg, 1, 7, indicatorVersion, text_color=color.yellow)
|
||||
table.cell(dbg, 0, 8, "Params", text_color=color.white)
|
||||
table.cell(dbg, 1, 8, "Flip:" + str.tostring(flipThreshold) + "% Buf:" + str.tostring(entryBufferATR), text_color=color.gray)
|
||||
table.cell(dbg, 0, 6, "Direction", text_color=color.white)
|
||||
table.cell(dbg, 1, 6, directionMode, text_color=directionMode == "Long Only" ? color.lime : directionMode == "Short Only" ? color.red : color.yellow)
|
||||
table.cell(dbg, 0, 7, "Signal", text_color=color.white)
|
||||
table.cell(dbg, 1, 7, finalLongSignal ? "BUY!" : finalShortSignal ? "SELL!" : "—", text_color=finalLongSignal ? color.lime : finalShortSignal ? color.red : color.gray)
|
||||
table.cell(dbg, 0, 8, "Version", text_color=color.white)
|
||||
table.cell(dbg, 1, 8, indicatorVersion, text_color=color.yellow)
|
||||
|
||||
Reference in New Issue
Block a user