답변완료
시스템 진입신호시간과 스탑로스
input : short(12),long(26),sig(9);
var : S1(0),D1(0),TM(0),EP1(0),EP2(0),EP3(0);
var : macdv(0,Data1),macds(0,Data1);
var : macdv1(0,Data2),macds1(0,Data2);
var : macdv2(0,Data3),macds2(0,Data3);
macdv = data1(macd(short,long));
macds = data1(Ema(macdv,sig));
macdv1 = data2(macd(short,long));
macds1 = data2(Ema(macdv1,sig));
macdv2 = data3(macd(short,long));
macds2 = data3(Ema(macdv2,sig));
if MarketPosition <= 0 and CrossUp(MACDV,0) and MACDV1 > 0 and MACDV2 > 0 Then
Buy();
if MarketPosition >= 0 and CrossDown(MACDV,0) and MACDV1 < 0 and MACDV2 < 0 Then
Sell();
if MarketPosition == 1 and CrossDown(MACDV,0) Then
ExitLong();
if MarketPosition == -1 and CrossUp(MACDV,0) Then
ExitShort();
input : 당일청산시간(020000),익절틱수(100),손절틱수(100),최소수익틱수(30),이익보존틱수(10);
if sDate != sDate[1] Then
SetStopEndofday(055000);
if Bdate != Bdate[1] Then
SetStopEndofday(0);
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소수익틱수 Then
ExitLong("bx",AtStop,EntryPrice+PriceScale*이익보존틱수);
}
if MarketPosition == -1 Then
{
if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소수익틱수 Then
ExitShort("sx",AtStop,EntryPrice-PriceScale*이익보존틱수);
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
------------------------------------------------------------------------------------
&&&위 시스템코딩 작성에 감사드리며 변수에보면 익절틱,손절틱,최소틱,이익보존틱
총4개로 돼있어 좀어렵습니다
트레일링스탑으로 수정이 나을것 같습니다
50틱 수익을바란다면 70틱에감시를해놓고 20틱하락이런식으로
손절틱,감시틱,되돌림틱,
현재 분봉3개혼합입니다 진입분봉 데이터분봉2개 macd 0선이상이상 일치전략입니다
데이터분봉에 매수시는 macd골든크로스 상태 매도시는 데드크로스 상태 추가요
<5분봉 0선돌파 30분봉60분봉 0선위에있으나 데드크로스진행은 비추세로보고 진입시점아님
5분봉 0선돌파 30분봉60분봉 0선위에 있고 골든크로스진행은 추세로보고 진입시점
매도는 위의 내용 반대입니다>
지금 당일청산기능과 다른주기데이터조합은 유용합니다
해외선물은 23시간 횡보낮시간에 피하고자 당일청산시간같은
진입도 시작시간 추가가 가능한지 문의드립니다
감사합니다
2025-04-29
240
글번호 190479
시스템
답변완료
지표 변환 문의드립니다.
귀사의 무궁한 발전을 기원합니다
안녕하세요,수고 많으십니다
트레이딩뷰 지표 변환해 주시면 대단히 감사하겠습니다.
주석이 좀 많네요.
챠트상에 봉그리기 비쥬얼은 구현하기 힘들면 넘어가시고, 매수,매도 신호만 ▲, ▼ 이런식으로 넣어 주시면 안될까요. 글자가 깨지면 수식은 첨부화일에 있어요.
+++++++++
//@version=6
indicator(title="Adaptive Trend Flow [QuantAlgo]", overlay=true, max_labels_count=500)
// ╔════════════════════════════════╗ //
// ║ USER-DEFINED SETTINGS ║ //
// ╚════════════════════════════════╝ //
// Input Groups
var string trend_settings = "════════ Trend Settings ════════"
var string visual_settings = "════════ Visualization Settings ════════"
// Tooltips
tooltip_length = "Length of the trend calculation period. Higher values create smoother signals."
tooltip_smooth = "Smoothing period for volatility. Higher values reduce noise."
tooltip_sens = "Multiplier for volatility bands. Higher values create wider bands."
tooltip_bars = "Enable/disable bar coloring based on trend direction"
tooltip_bg = "Enable/disable background gradient coloring"
tooltip_signals = "Enable/disable signal markers on trend changes"
// Trend Settings
length = input.int(10, "Main Length", minval=2,
group=trend_settings, tooltip=tooltip_length)
smooth_len = input.int(14, "Smoothing Length", minval=2,
group=trend_settings, tooltip=tooltip_smooth)
sensitivity = input.float(2.0, "Sensitivity", step=0.1,
group=trend_settings, tooltip=tooltip_sens)
// Visualization Settings
bullcolor = input.color(#00ffaa, "Bullish Color", group=visual_settings)
bearcolor = input.color(#ff0000, "Bearish Color", group=visual_settings)
showbars = input.bool(true, "Color Bars?", group=visual_settings, tooltip=tooltip_bars)
showbg = input.bool(true, "Background Color?", group=visual_settings, tooltip=tooltip_bg)
showsignals = input.bool(true, "Show Signals?", group=visual_settings, tooltip=tooltip_signals)
// ╔════════════════════════════════╗ //
// ║ TREND CALCULATIONS ║ //
// ╚════════════════════════════════╝ //
calculate_trend_levels() =>
typical = hlc3
fast_ema = ta.ema(typical, length)
slow_ema = ta.ema(typical, length * 2)
basis = (fast_ema + slow_ema) / 2
vol = ta.stdev(typical, length)
smooth_vol = ta.ema(vol, smooth_len)
upper = basis + (smooth_vol * sensitivity)
lower = basis - (smooth_vol * sensitivity)
[basis, upper, lower]
get_trend_state(upper, lower, basis) =>
var float prev_level = na
var int trend = 0
if na(prev_level)
trend := close > basis ? 1 : -1
prev_level := trend == 1 ? lower : upper
if trend == 1
if close < lower
trend := -1
prev_level := upper
else
prev_level := lower
else
if close > upper
trend := 1
prev_level := lower
else
prev_level := upper
[trend, prev_level]
[basis, upper, lower] = calculate_trend_levels()
[trend, level] = get_trend_state(upper, lower, basis)
// ╔════════════════════════════════╗ //
// ║ VISUALIZATION ║ //
// ╚════════════════════════════════╝ //
// Signal detection
long_signal = trend == 1 and trend[1] == -1
short_signal = trend == -1 and trend[1] == 1
// Plot average/basis line
p2 = plot(basis, color=trend == 1 ? bullcolor : bearcolor, linewidth=2)
// Plot trend line with breaks
p1 = plot(level,
color=close > level ? bullcolor : bearcolor,
linewidth=2,
style=plot.style_linebr)
// Plot additional trend line
plot(level,
color=close > level ? bullcolor : bearcolor,
linewidth=2,
style=plot.style_linebr)
// Add labels for crossovers
if showsignals and ta.crossunder(close, level)
label.new(bar_index, level, "𝑺",
color=bearcolor,
textcolor=chart.fg_color,
style=label.style_label_lower_right)
if showsignals and ta.crossover(close, level)
label.new(bar_index, level, "𝑳",
color=bullcolor,
textcolor=chart.bg_color,
style=label.style_label_upper_right)
// Background gradient coloring
var float intensity = 0.0
var int prev_trend = 0
// Reset intensity on trend change
if trend != prev_trend
intensity := 0.0
prev_trend := trend
// Increment intensity based on trend
intensity := trend == 1 ? math.min(intensity + 1, 20) : trend == -1 ? math.min(intensity + 1, 20) : intensity
// Calculate gradient colors
color grad_color = trend == 1 ?
color.from_gradient(intensity, 0, 20, color.new(bullcolor, 95), color.new(bullcolor, 80)) :
color.from_gradient(intensity, 0, 20, color.new(bearcolor, 95), color.new(bearcolor, 80))
bgcolor(showbg ? grad_color : na)
// Fill between the lines
fill(p1, p2, level, basis, trend == 1 ? bullcolor : bearcolor, na)
fill(p1, p2, level, basis, trend == 1 ? bullcolor : bearcolor, na)
// Bar Coloring
barcolor(showbars ? (trend == 1 ? color.new(bullcolor, 15) : color.new(bearcolor, 15)) : na)
// ╔════════════════════════════════╗ //
// ║ ALERTS ║ //
// ╚════════════════════════════════╝ //
alertcondition(long_signal, title="Adaptive Trend Flow Long",
message="Adaptive Trend Flow Long {{exchange}}:{{ticker}}")
alertcondition(short_signal, title="Adaptive Trend Flow Short",
message="Adaptive Trend Flow Short {{exchange}}:{{ticker}}")
// ╔════════════════════════════════╗ //
// ║ CREATED BY ║ //
// ╚════════════════════════════════╝ //
2025-04-28
315
글번호 190477
지표