
The main idea of this strategy is to use the high and low points of the Asian session as breakout points. Within a few hours after the European and American markets open, if the price breaks above the Asian session high, it goes long; if it breaks below the Asian session low, it goes short. Stop loss and take profit are set to control risk. The strategy only opens one trade per day, with a maximum of 100,000 simultaneous positions.
This strategy uses the high and low points of the Asian session as breakout points for trading and is suitable for use on varieties with obvious trends in the European and American markets. However, fixed-point stop loss and take profit and standard breakout entry methods also have some limitations. By introducing some dynamic and trend-based indicators, the strategy can be optimized to obtain better results.
/*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)