
Chiến lược này có những ưu điểm như đơn giản, logic rõ ràng và dễ hiểu.
Lý luận phán đoán cốt lõi của chiến lược dựa trên 4 quy tắc hình dạng K-line sau:
Khi đáp ứng cùng một lúc với 4 quy tắc trên, thực hiện các hoạt động mở vị trí đa hướng.
Ngoài ra, chiến lược cũng đặt điểm dừng lỗ và vị trí dừng lỗ, khi giá kích hoạt điều kiện dừng lỗ hoặc dừng lỗ, thực hiện các hoạt động thanh toán.
Chiến lược này có một số ưu điểm:
Những rủi ro cần lưu ý chính là:
Bạn có thể giảm thiểu rủi ro bằng cách:
Chiến lược này có thể được tối ưu hóa như sau:
Chiến lược này thực hiện nhiều giao dịch đột phá thông qua quy tắc phán đoán hình dạng K đơn giản, mặc dù có một số không gian cải tiến, nhưng xét đến sự đơn giản và trực tiếp, chiến lược này là một chiến lược dài hạn rất phù hợp để người mới bắt đầu hiểu và sử dụng. Bằng cách tối ưu hóa liên tục, có thể làm cho hiệu quả chiến lược trở nên tuyệt vời hơn.
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TheQuantScience
//@version=5
strategy("SimpleBarPattern_LongOnly", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, currency = currency.EUR, initial_capital = 1000, commission_type = strategy.commission.percent, commission_value = 0.03)
// Make input options that configure backtest date range
startDate = input.int(title="Start Date",
defval=1, minval=1, maxval=31)
startMonth = input.int(title="Start Month",
defval=1, minval=1, maxval=12)
startYear = input.int(title="Start Year",
defval=2017, minval=1800, maxval=2100)
endDate = input.int(title="End Date",
defval=8, minval=1, maxval=31)
endMonth = input.int(title="End Month",
defval=3, minval=1, maxval=12)
endYear = input.int(title="End Year",
defval=2022, minval=1800, maxval=2100)
// Look if the close time of the current bar
// Falls inside the date range
inDateRange = true
// Setting Conditions
ConditionA = low < open
ConditionB = low < low[1]
ConditionC = close > open
ConditionD = close > open[1] and close > close[1]
FirstCondition = ConditionA and ConditionB
SecondCondition = ConditionC and ConditionD
IsLong = FirstCondition and SecondCondition
TakeProfit_long = input(4.00)
StopLoss_long = input(4.00)
Profit = TakeProfit_long*close/100/syminfo.mintick
Loss = StopLoss_long*close/100/syminfo.mintick
EntryCondition = IsLong and inDateRange
// Trade Entry&Exit Condition
if EntryCondition and strategy.opentrades == 0
strategy.entry(id = 'Open_Long', direction = strategy.long)
strategy.exit(id = "Close_Long", from_entry = 'Open_Long', profit = Profit, loss = Loss)