
この戦略は,単純移動平均に基づくトレンド追跡と反転取引戦略である. 1日線と4日線の均線交差を使用して,トレンドの方向を判断し,購入と販売の信号を生成する.
1日線が上から下から4日線を交差すると,売り信号が生じます. 1日線が下から4日線を交差すると,買い信号が生じます. このように,急速な移動平均と遅い移動平均の交差によって市場のトレンドの転換点を判断し,利益を得ます.
入札後,ストップ・ロースとストップ・ストップを設定する. ストップ・ロースは入札価格より10ポイント下,ストップ・ストップは入札価格より100ポイント上を設定する. これにより,損失を制限し,利益をロックする.
平均線パラメータの調整,動的止損停止機構の設定,または他の指標判断の追加により,これらのリスクを軽減することができます.
この戦略は,全体として典型的な二均線取引戦略である.これは,快慢均線交差判断トレンドターニングポイントを使用し,ストップ・ストップ・コントロールリスクを設定し,シンプルで実用的で,容易に理解し,初心者向けである.パラメータを調整し,最適化することで,異なる市場環境に適応し,効果を高めるために他の指標のフィルターを追加することもできる.全体として,この戦略は,入門学習戦略として非常に良い.
/*backtest
start: 2023-11-19 00:00:00
end: 2023-12-19 00:00:00
period: 1h
basePeriod: 15m
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/
// © cesarpieres72
//@version=5
strategy("300% STRATEGY", overlay=true, margin_long=10, margin_short=10)
var float lastLongOrderPrice = na
var float lastShortOrderPrice = na
longCondition = ta.crossover(ta.sma(close, 1), ta.sma(close, 4))
if (longCondition)
strategy.entry("Long Entry", strategy.long) // Enter long
shortCondition = ta.crossunder(ta.sma(close, 1), ta.sma(close, 4))
if (shortCondition)
strategy.entry("Short Entry", strategy.short) // Enter short
if (longCondition)
lastLongOrderPrice := close
if (shortCondition)
lastShortOrderPrice := close
// Calculate stop loss and take profit based on the last executed order's price
stopLossLong = lastLongOrderPrice - 170 // 10 USDT lower than the last long order price
takeProfitLong = lastLongOrderPrice + 150 // 100 USDT higher than the last long order price
stopLossShort = lastShortOrderPrice + 170 // 10 USDT higher than the last short order price
takeProfitShort = lastShortOrderPrice - 150 // 100 USDT lower than the last short order price
// Apply stop loss and take profit to long positions
strategy.exit("Long Exit", from_entry="Long Entry", stop=stopLossLong, limit=takeProfitLong)
// Apply stop loss and take profit to short positions
strategy.exit("Short Exit", from_entry="Short Entry", stop=stopLossShort, limit=takeProfitShort)