
Đây là một hệ thống chiến lược giao dịch thông minh dựa trên chỉ số trung bình di chuyển ((EMA)). Chiến lược này sử dụng tín hiệu chéo của EMA ngắn hạn và dài hạn, kết hợp giá với mối quan hệ của EMA ngắn hạn để xác định xu hướng thị trường và cơ hội giao dịch. Chiến lược này sử dụng phát triển hỗ trợ AI để tự động hóa giao dịch thông qua phân tích động lực của chuyển động giá.
Logic cốt lõi của chiến lược này dựa trên các thành phần chính sau:
Đây là một chiến lược theo dõi xu hướng có cấu trúc, logic rõ ràng. Bằng cách sử dụng các chỉ số EMA, việc nắm bắt hiệu quả về xu hướng thị trường được thực hiện.
/*backtest
start: 2024-12-19 00:00:00
end: 2024-12-25 08:00:00
period: 45m
basePeriod: 45m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Jerryorange
//@version=6
strategy("Smart EMA Algo", overlay=true)
// Inputs
emaShortLength = input.int(9, title="Short EMA Length", minval=1)
emaLongLength = input.int(21, title="Long EMA Length", minval=1)
src = input(close, title="Source")
// EMA Calculations
emaShort = ta.ema(src, emaShortLength)
emaLong = ta.ema(src, emaLongLength)
// Market Direction
isUptrend = emaShort > emaLong
isDowntrend = emaShort < emaLong
// Entry Conditions
longCondition = isUptrend and ta.crossover(close, emaShort)
shortCondition = isDowntrend and ta.crossunder(close, emaShort)
// Exit Conditions
exitLong = ta.crossunder(close, emaShort)
exitShort = ta.crossover(close, emaShort)
// Strategy Logic
if (longCondition)
strategy.entry("Buy", strategy.long)
if (shortCondition)
strategy.entry("Sell", strategy.short)
if (exitLong)
strategy.close("Buy")
if (exitShort)
strategy.close("Sell")
// Plot EMAs
plot(emaShort, color=color.blue, title="Short EMA")
plot(emaLong, color=color.red, title="Long EMA")