
Chiến lược giao dịch bóng râm bằng cách xác định các đường K có đường dài dưới hoặc đường K có đường dài trên để đánh giá thời gian thị trường có thể đảo ngược. Khi xác định đường dài dưới, hãy làm nhiều hơn; khi xác định đường dài trên, hãy làm trống. Chiến lược này chủ yếu sử dụng quy luật phổ biến của sự đảo ngược đường dài.
Lý luận cốt lõi của chiến lược giao dịch bóng là nhận diện các đường dài trên và đường dài dưới xuất hiện trong đường K. Chiến lược này tính toán kích thước thực thể đường K.corpovà kích thước đường bóngpinnaL、pinnaSCụ thể, chiến lược bao gồm các bước sau:
corpo, là giá trị tuyệt đối của chênh lệch giữa giá mở và giá đóng.pinnaL, là giá trị tuyệt đối của chênh lệch giữa giá cao nhất và giá đóng cửa.pinnaS, là giá trị tuyệt đối của chênh lệch giữa giá thấp nhất và giá đóng cửa.pinnaL > (corpo*size),sizelà một tham số có thể điều chỉnh.pinnaS > (corpo*size)。Ngoài ra, chiến lược này cũng đánh giá kích thước của sự biến động của đường K.dimLà lớn hơn giá trị tối thiểumin, để lọc loại bỏ các dòng K không thú vị có biến động quá nhỏ.
Chiến lược giao dịch bóng là một chiến lược giao dịch đường ngắn đơn giản và thực tế. Nó sử dụng quy luật phổ biến của sự đảo ngược đường dài để tạo ra tín hiệu giao dịch.
/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-11 23:59:59
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("Shadow Trading", overlay=true)
size = input(1,type=float)
pinnaL = abs(high - close)
pinnaS = abs(low-close)
scarto = input(title="Tail Tollerance", type=float, defval=0.0018)
corpo = abs(close - open)
dim = abs(high-low)
min = input(0.001)
shortE = (open + dim)
longE = (open - dim)
barcolor(dim > min and (close > open) and (pinnaL > (corpo*size)) and (open-low<scarto) ? navy : na)
longcond = (dim > min) and (close > open) and (pinnaL > (corpo*size)) and (open-low<scarto)
minimo=low+scarto
massimo=high+scarto
barcolor( dim > min and(close < open) and (pinnaS > (corpo*size)) and (high-open<scarto) ? orange: na)
shortcond = (dim > min) and(close < open) and (pinnaS > (corpo*size)) and (high-open<scarto)
//plot(shortE)
//plot(longE)
//plot(open)
ss= shortcond ? close : na
ll=longcond ? close : na
offset= input(0.00000)
DayClose = 2
closup = barssince(change(strategy.opentrades)>0) >= DayClose
longCondition = (close > open) and (pinnaL > (corpo*size)) and (open-low<scarto)
crossFlag = longcond ? 1 : 0
monthBegin = input(1,maxval = 12)
yearBegin = input(2013, maxval= 2015, minval=2000)
if(month(time)>monthBegin and year(time) >yearBegin)
if (longcond)
strategy.entry("short", strategy.short, stop = low - offset)
//strategy.close("short", when = closup)
shortCondition = (close < open) and (pinnaS > (corpo*size)) and (high-open<scarto)
if(month(time)>monthBegin and year(time) >yearBegin)
if (shortcond)
strategy.entry("long", strategy.long, stop = high + offset)
//strategy.close("long", when = closup)
Target = input(20)
Stop = input(70) //- 2
Trailing = input(0)
CQ = 100
TPP = (Target > 0) ? Target*10: na
SLP = (Stop > 0) ? Stop*10 : na
TSP = (Trailing > 0) ? Trailing : na
strategy.exit("Close Long", "long", qty_percent=CQ, profit=TPP, loss=SLP, trail_points=TSP)
strategy.exit("Close Short", "short", qty_percent=CQ, profit=TPP, loss=SLP, trail_points=TSP)