시장 유동성 및 트렌드에 기초한 스칼핑 전략

저자:차오장날짜: 2024-01-30 15:36:33
태그:

img

전반적인 설명

이 전략은 시장 유동성, 트렌드 및 기술 지표를 종합적으로 고려하여 단기 거래 전략을 구현합니다. 이 전략은 시장 유동성이 상대적으로 좋을 때 트렌드를 따르고 포지션을 열 수 있으므로 단기 수익을 얻을 수 있습니다.

전략 원칙

  1. 기본 원칙: 이 전략은 주로 시장 유동성과 추세를 고려합니다. 시장 유동성이 좋고 추세가 나타나면 단기 거래를 수행하십시오.

  2. 시장 유동성 지표: 이 전략은 주로 MFI와 거래량 변화로 시장 유동성 지표를 사용합니다. MFI가 증가하고 거래량이 증가하면 시장 유동성이 더 좋아지고 포지션을 열기에 적합하다고 생각합니다.

  3. 트렌드 판단: 이 전략은 ADX, EMA 및 다른 지표를 결합하여 트렌드를 결정합니다. ADX와 EMA가 30보다 높을 때 트렌드가 상대적으로 강하다는 것을 의미합니다. 동시에 빠르고 느린 EMA의 황금 십자가가 발생하면 트렌드도 확인할 수 있습니다.

  4. 개시 조건: 시장 유동성이 좋고 동시에 추세가 나타나면 다른 보조 조건 (SAR 위치 판단 등) 이 충족되면 개시 신호가 생성됩니다.

  5. 수익을 취하고 손실을 중지 설정: 이 전략은 매 거래에 대해 고정 수익 (10 포인트) 및 손실을 중지 (7.5 포인트) 를 설정합니다.

이점 분석

이 전략은 다음과 같은 장점을 가지고 있습니다.

  1. 시기를 결정하기 위해 시장 유동성을 사용하십시오: 시장 유동성을 결정하기 위해 MFI와 거래량을 기반으로 시장 유동성이 낮을 때 포지션을 개설하는 것을 피하십시오.

  2. 이윤을 위한 트렌드를 따르십시오: EMA와 다른 지표를 결합하여 트렌드 방향을 결정하고 트렌드 이윤을 얻는 데 도움이 됩니다.

  3. 좋은 리스크 제어: 거래당 최대 손실을 효과적으로 제어하기 위해 고정된 수익을 취하고 손실을 중지하십시오.

  4. 상대적으로 높은 거래 빈도: 단기 전략으로서 거래 빈도는 상대적으로 높으며 단계적으로 이익을 축적하기에 적합합니다.

  5. 매개 변수 최적화를 위한 넓은 공간: 예를 들어, MA 매개 변수, 스톱 손실 및 수익 설정은 전략 성능을 향상시키기 위해 최적화 될 수 있습니다.

위험 분석

이 전략에는 또한 몇 가지 위험이 있습니다.

  1. 실제 거래 미끄러짐 제어 위험: 이론적 인 스톱 로스 및 수익을 취하는 것은 실제 거래 조건을 완전히 반영 할 수 없습니다. 실제 거래에서 미끄러짐은 상대적으로 커질 수 있습니다.

  2. 트렌드 오판 위험: 이 전략은 트렌드를 결정하기 위해 여러 지표에 크게 의존하지만 여전히 실패할 가능성이 있습니다.

  3. 과도한 거래 위험: 단기 전략으로서, 부적절한 매개 변수 설정은 과도한 거래로 이어질 수 있습니다.

  4. 시장 비정상성 위험: 극심한 시장 유동성 또는 정책 변화의 경우 이 전략이 제대로 작동하지 않을 수 있습니다.

따라서 우리는 다음과 같은 측면에서 위험을 줄일 수 있습니다.

  1. 실제 미끄러짐 요인을 고려하기 위해 정지 손실 범위를 적절히 느슨하게하십시오.

  2. 트렌드 판단 논리를 최적화하고 실패 가능성을 줄이기 위해 더 많은 지표를 도입하십시오.

  3. 오버 트레이딩을 피하기 위해 오픈 포지션 빈도 제한을 추가합니다.

  4. 비정상적인 상황에 대처하기 위해 시장 조건에 따라 매개 변수를 유연하게 조정합니다.

최적화 방향

이 전략의 최적화 방향은 다음과 같습니다.

  1. 트렌드 판단을 최적화하고 판단을 더 정확하게 하기 위해 더 많은 지표를 도입하십시오. 예를 들어 MACD 지표를 도입하십시오.

  2. 가장 좋은 매개 변수 조합을 찾기 위해 MA의 사이클 매개 변수를 최적화합니다.

  3. 스톱 로스를 개선하고 수익 전략을 취하십시오. 예를 들어 이동 스톱 로스, 간격 스톱 로스 등을 사용하십시오.

  4. 과도하게 높은 거래 빈도를 피하기 위해 거래 수에 제한을 추가하십시오. 예를 들어 하루에 최대 3 번까지 포지션을 열십시오.

  5. 시장 유동성 지표를 더 잘 찾아 포지션 개설 시기를 더 자세히 결정하십시오. 예를 들어 순 유입 지표를 도입하십시오.

  6. 최적의 매개 변수 조합을 찾기 위해 매개 변수를 자동으로 최적화하기 위해 매개 변수 최적화 기능을 추가합니다.

요약

이 전략은 시장 유동성 및 트렌드 등의 요인을 포괄적으로 고려합니다. 단기적으로 수익을 얻습니다. 전통적인 트렌드 전략과 비교했을 때, 이 전략의 가장 큰 혁신은 시장 유동성이 좋지 않을 때 포지션을 열지 않도록 시장 유동성 지표의 도입입니다. 이에 따라이 전략에는 또한 특정 실제 세계 제어 위험과 트렌드 잘못된 판단 위험이 있습니다. 더 많은 지표, 최적화 매개 변수 및 위험 관리를 도입함으로써이 전략을 지속적으로 개선 할 수 있습니다.


/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 2h
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/
// © trent777brown

//@version=5
strategy("scalping with market facilitation", overlay=true, margin_long=100, margin_short=100)


MFI0 = (high - low) / volume
MFI1 = (high[1] - low[1]) / volume[1]

MFIplus = MFI0 > MFI1
MFIminus = MFI0 < MFI1

//Current Trend-(Changed mean to trend)-revised
trendplus = hl2 > high[1]
trendzero = hl2 < high[1] and hl2 > low[1]  //addition of script
trendminus = hl2 < low[1]  //changed high to low

//Volume +/-
volplus = volume > volume[1]
volminus = volume < volume[1]

//Period Control by Buyers or Sellers is determined with reference to Price action of the period 
//divided into 3 sectors, sector 1 is the Top third, Sector 2 is the middle third, 
//and sector 3 is the Bottom third of the period. Control classifications are: Extremes(11, 33), Neutral(22), 
//Climbers(31,21,32) Open lower than Close, and Drifters(13,23,12)Close lower than Open

//value0 = low
//value1 = ((high - low)/3)
//value2 = ((high - low)/3)*2
//value3 = high

//o1 = (open >= (((high - low)/3) * 2) + low)
//c1 = (close >= (((high - low)/3) * 2) + low)
//o2 = (open <= o1) 
//c2 = (close <= c1)
//o3 = (open <= ((high - low)/3) + low)
//c3 = (close <= ((high - low)/3) + low)

//sector2 = if((high - low)/3) + low and sector2 <= (((high - low)/3)*2) + low

//sector3 = if((high - low)/3) + low and >= low


//Extremes-Full Control of Period by Buyers or Sellers 
//pg79 notes an 85% chance that the current trend will change in the next 1 to 5 bars
b11 = open >= (high - low) / 3 * 2 + low and close >= (high - low) / 3 * 2 + low  //Extreme Buyer Control:Chartruse
b33 = open <= (high - low) / 3 + low and close <= (high - low) / 3 + low  //Extreme Seller Control:Crimson
//Neutral pg80
b22 = open >= (high - low) / 3 + low and open <= (high - low) / 3 * 2 and close >= (high - low) / 3 + low and open <= (high - low) / 3 * 2  //Bracketed Price Control
//Climber-Open lower than Close pg81
b31 = open <= (high - low) / 3 + low and close >= (high - low) / 3 * 2 + low  //Strong Buyer Control:Dark Green
b21 = open >= (high - low) / 3 + low and open <= (high - low) / 3 * 2 and close >= (high - low) / 3 * 2 + low  //Moderate Buyer Control:Green
b32 = open <= (high - low) / 3 + low and close >= (high - low) / 3 + low and open <= (high - low) / 3 * 2  //Weak Buyer Control:Light Green
//Drifter-Close lower than Open pg81
b13 = open >= (high - low) / 3 * 2 + low and close <= (high - low) / 3 + low  //Strong Seller Control:Dark Red
b23 = open >= (high - low) / 3 + low and open <= (high - low) / 3 * 2 and close <= (high - low) / 3 + low  //Moderate Seller Control:Red
b12 = open >= (high - low) / 3 * 2 + low and close >= (high - low) / 3 + low and open <= (high - low) / 3 * 2  //Weak Seller Control:Light Red/Pink

 

//


psar= ta.sar(.09, .2, .2)

ema8= ta.ema(hlc3, 8)

ema13h= ta.ema(high, 13)
ema13l= ta.ema(low, 13)
ema13= ta.ema(close, 13)

ema55= ta.ema(close, 100)

[dip, dim, adx]= ta.dmi(5, 5)
adxema=ta.ema(adx, 3)
[macdl, sigl, histl]= ta.macd(close, 8, 13, 5)
obv= ta.obv
obvema= ta.ema(obv, 8)
obvema55= ta.ema(obv, 55)
mfigreen= MFIplus and volplus
adx_x_over= ta.crossover(adx, adxema) and adx >= 25
barssincemfi= ta.barssince(mfigreen)










longtrig2= adx > 30 and adx > adxema and barssincemfi <= 4 


shorttrig2= adx > 30 and adx > adxema and barssincemfi <= 4 


long= macdl > sigl and obv > obvema55 and ema8 > ema55   and psar < low and trendplus//and ema13l > ema55//and open > hull200 and close > hull200

short= macdl < sigl and obv < obvema55 and ema8 < ema55 and psar > high and trendminus//and ema13h < ema55//open < hull200 and close < hull200


//plot(hull200, color=color.red, linewidth=3)
plot(ema13h, color=color.gray, linewidth=3)
plot(ema13l, color=color.gray, linewidth=3)

plot(ema13, color=color.blue, linewidth=3)
//
plot(ema55, color=color.white, linewidth=3)
plot(psar, color=color.white, style=plot.style_circles)
plotshape(mfigreen, color=color.yellow, style=shape.flag, location=location.belowbar, size= size.tiny)
longCondition = long
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long, 1,  when= longtrig2)
    strategy.exit("exit long", "My Long Entry Id", profit= 100, loss= 75)
shortCondition = short
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short, 1,  when= shorttrig2)
    strategy.exit("exit short", "My Short Entry Id", profit= 100, loss= 75)


더 많은