
이 전략은 두 세트의 다른 변수의 EMA 지표를 계산하여 구매 신호를 두 세트의 EMA 지표에 금이 교차 할 때 설정하고 판매 신호를 다른 두 세트의 EMA 지표에 사망이 교차 할 때 설정하여 효율적인 단선 거래 전략을 구현합니다.
이 전략은 4개의 EMA 지표를 사용한다. 각각 9주기 EMA1, 26주기 EMA2, 100주기 EMA3 및 55주기 EMA4이다. 구매 신호가 EMA1 위에 EMA2를 통과하도록 설정되면, 단선 EMA 위에 긴 EMA를 통과하는 것을 나타내는 전형적인 골드 크로스 신호에 속한다. 판매 신호가 EMA3 아래 EMA4를 통과하도록 설정되면, 사망 교차에 속한다.
이 전략은 전체적으로 매우 전형적이고 효과적인 짧은 라인 거래 전략이다. 장점은 빠르게 들어가고 빨리 나가고, 스칼핑에 적합하며, 수익의 여지가 크다. 동시에 몇 가지 위험이 있으며, 주의해야 한다. 파라미터를 적절히 조정하고, 다른 지표가 신호 필터링을 보조하면, 매우 실용적인 짧은 라인 거래 전략이 될 수 있다.
/*backtest
start: 2023-01-05 00:00:00
end: 2024-01-11 00:00:00
period: 1d
basePeriod: 1h
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/
// © YukalMoon
//@version=5
strategy(title="EMA SCALPEUR", overlay=true, initial_capital = 1000)
//// input controls
EMA_L = input.int (title = "EMA_L", defval = 9, minval = 1, maxval = 100, step =1)
EMA_L2 = input.int (title = "EMA_L2", defval = 26, minval = 1, maxval = 100, step =1)
EMA_S = input.int (title = "EMA_S", defval = 100, minval = 1, maxval = 100, step =1)
EMA_S2 = input.int (title = "EMA_S2", defval = 55, minval = 1, maxval = 100, step =1)
/// mise en place de ema
shortest = ta.ema(close, 9)
short = ta.ema(close, 26)
longer = ta.ema(close, 100)
longest = ta.ema(close, 55)
plot(shortest, color = color.red)
plot(short, color = color.orange)
plot(longer, color = color.aqua)
plot(longest, color = color.yellow)
plot(close)
//// trading indicators
EMA1 = ta.ema (close,EMA_L)
EMA2 = ta.ema (close,EMA_L2)
EMA3 = ta.ema (close, EMA_S)
EMA4 = ta.ema (close, EMA_S2)
buy = ta.crossover(EMA1, EMA2)
//sell = ta.crossunder(EMA1, EMA2)
buyexit = ta.crossunder(EMA3, EMA4)
//sellexit = ta.crossover(EMA3, EMA4)
/////strategy
strategy.entry ("long", strategy.long, when = buy, comment = "EXIT-LONG")
//strategy.entry ("short", strategy.short, when = sell, comment = "ENTER-SHORT")
///// market exit
strategy.close ("long", when = buyexit, comment = "ENTER-LONG")
//strategy.close ("short", when = sellexit, comment = "EXIT-SHORT")