
यह एक समय चक्र पर आधारित एक बुद्धिमान रोटेशन रणनीति है, जो एक निर्दिष्ट समय अवधि के भीतर बहु-हवाई रोटेशन ट्रेडिंग करके लाभ प्राप्त करती है। रणनीति में एक लचीला स्थिति प्रबंधन तंत्र है, जो बाजार की स्थिति के अनुसार व्यापार की दिशा को स्वचालित रूप से समायोजित कर सकता है, जबकि इसमें जोखिम नियंत्रण कार्यक्षमता है। यह रणनीति बहु-हवाई द्वि-दिशात्मक ट्रेडिंग का समर्थन करती है, और यह एक मजबूत अनुकूलनशीलता के साथ एक वैकल्पिक रूप से शुरू होने वाले व्यापार मोड को चालू करती है।
रणनीति मुख्य रूप से समय चक्र और स्थिति रखने के लिए व्यापार को नियंत्रित करती है। सबसे पहले, यह inActivePeriod () फ़ंक्शन के माध्यम से निर्धारित किया जाता है कि क्या नवीनतम 500 K लाइनों के प्रभावी व्यापार क्षेत्र के भीतर है। प्रभावी अवधि के भीतर, रणनीति स्थिति रखने की स्थिति (positionHeld), स्थिति रखने का समय (barsHeld) और ठहराव का समय (barsPaused) जैसे चर के आधार पर व्यापार व्यवहार का निर्णय करती है। जब अस्थिर व्यापार मोड चालू होता है, तो रणनीति बहु-स्थानिक दिशाओं में तेजी से घूमती है; जब अस्थिर व्यापार मोड बंद होता है, तो रणनीति 3 चक्र के बाद स्थिति को समतल करती है और नए व्यापार के अवसरों की प्रतीक्षा करती है।
इस रणनीति में समय चक्र नियंत्रण और बहु-हवाई रोटेशन के माध्यम से बाजार के लाभ को प्राप्त करने के लिए एक मजबूत लचीलापन और अनुकूलन क्षमता है। हालांकि कुछ जोखिम हैं, उचित अनुकूलन और जोखिम नियंत्रण उपायों के माध्यम से रणनीति की स्थिरता और लाभप्रदता में काफी सुधार किया जा सकता है। रणनीति का मुख्य लाभ इसकी सरल और प्रभावी ट्रेडिंग तर्क में है, जो बुनियादी रणनीति के लिए आगे अनुकूलन और विस्तार के लिए अनुकूल है।
/*backtest
start: 2024-10-12 00:00:00
end: 2024-11-11 00:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Tickerly Test Strategy", overlay=true)
// Inputs
longEnabled = input.bool(true, "Enable Long Trades")
shortEnabled = input.bool(true, "Enable Short Trades")
swingEnabled = input.bool(false, "Enable Swing Trading")
// Variables
var positionHeld = 0
var barsHeld = 0
var barsPaused = 0
var lastAction = "none"
// Function to determine if we're in the last 500 bars
inActivePeriod() =>
barIndex = bar_index
lastBarIndex = last_bar_index
barIndex >= (lastBarIndex - 499)
// Main strategy logic
if inActivePeriod()
if swingEnabled
if positionHeld == 0 and barstate.isconfirmed
if lastAction != "long"
strategy.entry("Long", strategy.long)
positionHeld := 1
barsHeld := 0
lastAction := "long"
else
strategy.entry("Short", strategy.short)
positionHeld := -1
barsHeld := 0
lastAction := "short"
if positionHeld != 0
barsHeld += 1
if barsHeld >= 2
if positionHeld == 1
strategy.entry("Short", strategy.short)
positionHeld := -1
barsHeld := 0
lastAction := "short"
else
strategy.entry("Long", strategy.long)
positionHeld := 1
barsHeld := 0
lastAction := "long"
else
if positionHeld == 0 and barsPaused >= 1 and barstate.isconfirmed
if longEnabled and shortEnabled
if lastAction != "long"
strategy.entry("Long", strategy.long)
positionHeld := 1
barsHeld := 0
barsPaused := 0
lastAction := "long"
else
strategy.entry("Short", strategy.short)
positionHeld := -1
barsHeld := 0
barsPaused := 0
lastAction := "short"
else if longEnabled
strategy.entry("Long", strategy.long)
positionHeld := 1
barsHeld := 0
barsPaused := 0
lastAction := "long"
else if shortEnabled
strategy.entry("Short", strategy.short)
positionHeld := -1
barsHeld := 0
barsPaused := 0
lastAction := "short"
if positionHeld != 0
barsHeld += 1
if barsHeld >= 3
strategy.close_all()
positionHeld := 0
barsHeld := 0
barsPaused := 0 // Reset pause counter when exiting a position
else
barsPaused += 1
// Plotting active period for visual confirmation
plot(inActivePeriod() ? 1 : 0, "Active Period", color=color.new(color.blue, 80), style=plot.style_areabr)