
이 전략은 간단한 이동 평균 ((SMA) 의 교차에 기반한 긴 선의 포착 전략이다. 그것은 다양한 주기의 SMA를 계산하여, 단기 SMA에 장기 SMA를 착용 할 때 구매 신호를 생성하여 포착 작업을 수행한다. 동시에, 그것은 진입 가격의 일정한 비율에 따라 스톱 손실을 설정하고, 포지션에 대한 위험을 관리한다.
이 전략은 주로 SMA 지표의 금강포크크 교차 신호를 기반으로 시장에 진입할 시기를 판단한다. 구체적으로, 9일선과 21일선인 두 개의 다른 기간의 SMA를 각각 계산한다. 단기 9일선이 아래에서 더 긴 21일선을 뚫을 때, 즉 주가가 상반기 단계에서 상승 단계로 진입하는 것은 후추의 좋은 시점에 속하며, 이 전략은 구매 신호를 생성하여 후추 작업을 수행한다.
또한, 전략은 입시 가격의 1.5%와 1%의 두 비율에 따라 스톱 포스트와 스톱 손실을 동적으로 설정합니다. 즉, 스톱 포스트는 입시 가격보다 1.5% 높고, 스톱 손실은 입시 가격보다 1% 낮습니다. 이 방법으로, 포지션에 대한 상쇄 손실 비율을 설정할 수 있습니다.
이 전략은 SMA 교차를 기반으로 한 중장선 추적 전략이다. SMA 지표를 사용하여 시장의 흐름을 판단하고, 스톱 스톱 손실 제어 위험을 설정한다. 장점은 간단하고 쉽게 실행할 수 있으며, 정량 거래 초보자에게 적합하다. 또한 다른 지표 필터링 신호를 추가하고, 스톱 스톱을 동적으로 추적하고, 시장의 변동에 따라 스톱 스톱을 조정하는 등의 최적화 할 수있는 공간이 있습니다.
/*backtest
start: 2023-01-28 00:00:00
end: 2024-02-03 00:00:00
period: 1d
basePeriod: 1h
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/
// © Masterdata
//@version=5
strategy("Simple MA Crossover Long Strategy v5", overlay=true)
// Define the short and long moving averages
shortMa = ta.sma(close, 9)
longMa = ta.sma(close, 21)
// Plot the moving averages on the chart
plot(shortMa, color=color.green)
plot(longMa, color=color.orange)
// Generate a long entry signal when the short MA crosses over the long MA
longCondition = ta.crossover(shortMa, longMa)
if (longCondition)
strategy.entry("Long", strategy.long)
// Define the take profit and stop loss as a percentage of the entry price
takeProfitPerc = 1.5 / 100 // Take profit at 1.5% above entry price
stopLossPerc = 1.0 / 100 // Stop loss at 1.0% below entry price
// Calculate the take profit and stop loss price levels dynamically
takeProfitLevel = strategy.position_avg_price * (1 + takeProfitPerc)
stopLossLevel = strategy.position_avg_price * (1 - stopLossPerc)
// Set the take profit and stop loss for the trade
if (longCondition)
strategy.exit("Take Profit/Stop Loss", "Long", limit=takeProfitLevel, stop=stopLossLevel)