
Ý tưởng chính của chiến lược này là sử dụng điểm cao thấp của thị trường châu Á làm điểm phá vỡ, trong vài giờ sau khi thị trường châu Âu và Mỹ mở cửa, nếu giá vượt qua điểm cao của thị trường châu Á, hãy làm nhiều hơn và phá vỡ điểm thấp của thị trường châu Á. Đồng thời thiết lập dừng lỗ và dừng, kiểm soát rủi ro. Chiến lược này chỉ mở một giao dịch mỗi ngày, số lượng mở cửa đồng thời tối đa là 100.000.
Chiến lược này sử dụng các điểm cao thấp của thị trường châu Á làm điểm phá vỡ để giao dịch, phù hợp để sử dụng trên các giống có xu hướng rõ rệt hơn của thị trường châu Âu và Mỹ. Tuy nhiên, cũng có một số hạn chế về số điểm dừng lỗ cố định và các phương thức nhập cảnh phá vỡ tiêu chuẩn. Bằng cách giới thiệu một số chỉ số động và xu hướng, chiến lược có thể được tối ưu hóa để có hiệu quả tốt hơn.
/*backtest
start: 2024-02-27 00:00:00
end: 2024-03-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Asia Session", overlay=true)
var hourSessionStart = input(19, "Asia session start hour", minval=0, maxval=23)
var hourSessionStop = input(1, "Asia session end hour", minval=0, maxval=23)
var offsetHours = input(3, "Offset hours after Asia session end")
var float hi = na
var float lo = na
var float plotHi = na
var float plotLo = na
var bool inSession = na
var bool enteringSession = na
var bool exitingSession = na
inSession := (hour >= hourSessionStart or hour < hourSessionStop)
enteringSession := inSession and not inSession[1]
exitingSession := not inSession and inSession[1]
if enteringSession
plotLo := na
plotHi := na
if inSession
lo := min(low, nz(lo, 1.0e23))
hi := max(high, nz(hi))
if exitingSession
plotLo := lo
plotHi := hi
lo := na
hi := na
bgcolor(inSession ? color.blue : na)
plot(plotLo, "Asia session Low", color.red, style=plot.style_linebr)
plot(plotHi, "Asia session High", color.green, style=plot.style_linebr)
// Implementazione delle condizioni di entrata
var float asiaSessionLow = na
var float asiaSessionHigh = na
var int maxTrades = 100000 // Impostiamo il massimo numero di operazioni contemporanee
var int tradesOpened = 0 // Variabile per tenere traccia del numero di operazioni aperte
var bool tradeOpened = false
var bool operationClosed = false // Nuova variabile per tenere traccia dello stato di chiusura dell'operazione
// Calcolo del range asiatico
if (inSession)
asiaSessionLow := lo
asiaSessionHigh := hi
// Apertura di un solo trade al giorno
if (enteringSession)
tradeOpened := false
// Condizioni di entrata
var float stopLoss = 300 * syminfo.mintick
var float takeProfit = 300 * syminfo.mintick
if (not tradeOpened and not operationClosed and close < asiaSessionLow and tradesOpened < maxTrades and hour >= hourSessionStop + offsetHours)
strategy.entry("Buy", strategy.long)
tradeOpened := true
tradesOpened := tradesOpened + 1 // Incrementiamo il contatore delle operazioni aperte
if (not tradeOpened and not operationClosed and close > asiaSessionHigh and tradesOpened < maxTrades and hour >= hourSessionStop + offsetHours)
strategy.entry("Sell", strategy.short)
tradeOpened := true
tradesOpened := tradesOpened + 1 // Incrementiamo il contatore delle operazioni aperte
// Impostazione dello stop loss e del take profit
strategy.exit("Stop Loss / Take Profit", "Buy", stop=close - stopLoss, limit=close + takeProfit)
strategy.exit("Stop Loss / Take Profit", "Sell", stop=close + stopLoss, limit=close - takeProfit)