답변완료
문의
청산수식에 트레일링스탑을 추가했더니 첨부파일처럼 오류가 발생합니다.
수정하여 주십시요.
항상 고맙습니다.
******************************************************************************************
안녕하세요
예스스탁입니다.
문의하신 내용은 각 포지션 진입이 첫진입인지 두번째 인지로 구분하시면 됩니다.
input : 손절1(1.25),손절2(2.50);
input : 손절3(2.50),손절4(1.25);
var : entry(0);
if Bdate != Bdate[1] Then
entry = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if MarketPosition == 1 Then
{
//매수진입이 첫진입일때
if entry == 1 Then
SetStopLoss(손절1,PointStop);
Else //매수진입이 두번째진입일때
SetStopLoss(손절3,PointStop);
}
if MarketPosition == -1 Then
{
//매도진입이 첫진입일때
if entry == 1 Then
SetStopLoss(손절2,PointStop);
Else //매수진입이 두번째진입일때
SetStopLoss(손절4,PointStop);
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
> 1) 청산수식 부탁드립니다.
리버스 거래이고
진입은 2번 입니다. ( 매수진입명 "a", 매도진입명 "b" )
매수신호가 먼저 나오면 매수거래 매도거래 하고 거래 종료
매도신호가 먼저 나오면 매도거래 매수거래 하고 거래 종료
매수신호가 먼저 나왔을 때와 매도신호가 먼저 나왔을 때를
구분하여 손절을 적용하고 싶습니다.
input : 손절1(1.25),손절2(2.50);
input : 손절3(2.50),손절4(1.25);
매수진입이 먼저 발생했을 때
진입명이 "a"
SetStopLoss(손절1,PointStop);
진입명이 "b"
SetStopLoss(손절2,PointStop);
매도진입이 먼저 발생했을 때
진입명이 "a"
SetStopLoss(손절3,PointStop);
진입명이 "b"
SetStopLoss(손절4,PointStop);
항상 고맙습니다.
2025-03-19
328
글번호 189312
시스템
답변완료
종목검색식 요청드립니다.
아래 키움수식의 종목을 검색하는 검색식을 만들고 싶습니다. 도움 부탁드립니다.
* 조건값 : short(90),mid(26),long(52),percent(5)
* 키움수식
max( avg(C,short), avg(C,mid), avg(C,long)) <
min( avg(C,short), avg(C,mid), avg(C,long)) * (1+Percent/100) &&
C > highest(H(1),5) && C(1) <= highest(H(2),5)
항상 감사합니다.^^
2025-03-18
291
글번호 189310
종목검색
답변완료
수식 변환을 부탁드려요
다음 TradingView 수식을 YesTrader로 부탁드립니다.
// © BigBeluga
//@version=6
indicator("Peak Reaction Zones [BigBeluga]", overlay = true, max_labels_count = 500, max_bars_back = 500)
var high_i = int(na)
var high_v = float(na)
var low_i = int(na)
var low_v = float(na)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
lookback = input(72)
multiplier = input.float(1, "Zones Width", step = 0.1, inline = "h/l")
high_col = input.color(color.red, "", inline = "h/l")
low_col = input.color(color.lime, "", inline = "h/l")
// }
// CALCULATIONS――――――――――{
highest = ta.highest(lookback)
lowest = ta.lowest(lookback)
atr = ta.atr(200) * multiplier
if high[1] == highest[1] and high < highest
high_i := bar_index-1
high_v := high[1]
if low[1] == lowest[1] and low > lowest
low_i := bar_index-1
low_v := low[1]
draw_zone(x, y, h_l, color)=>
dist = h_l ? -atr : atr
line.delete(line.new(x, y, bar_index, y, color = color, style = line.style_solid, width = 2)[1])
line.delete(line.new(x+3, y+dist, bar_index, y+dist, color = color, style = line.style_dashed)[1])
label.delete(label.new(bar_index, y, str.tostring(y, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = color)[1])
// }
// PLOT // CALCULATIONS――――――――――{
if barstate.islast
size = bar_index - (high_i > low_i ? low_i : high_i)
draw_zone(high_i, high_v, true, high_col)
draw_zone(low_i, low_v, false, low_col)
mid = math.avg(high_v, low_v)
mid_index = bar_index - size/2
line.delete(line.new(mid_index, mid, bar_index, mid, color = chart.fg_color, style = line.style_dashed)[1])
label.delete(label.new(bar_index, mid, str.tostring(mid, "#,###.####"), color = color(na), style = label.style_label_left, textcolor = chart.fg_color)[1])
for i = 0 to size
index = bar_index-i-2
if low[i+3] > low_v+atr and low[i+2] < low_v+atr and high[i+1] > low_v+atr and index > low_i
label.new(index, low[i+2], "", style = label.style_label_up, color = low_col, size = size.tiny)
if high[i+3] < high_v-atr and high[i+2] > high_v-atr and low[i+1] < high_v-atr and index > high_i
label.new(index, high[i+2], "", style = label.style_label_down, color = high_col, size = size.tiny)
// }
2025-03-18
430
글번호 189307
지표