답변완료
부탁드립니다
안녕하세요
예스스탁입니다.
input : 일정배수(5),단기(10),장기(60);
var : atrv(0),mm(0),hh(0),ll(0);
atrv=((avg(max(max(H-L,abs(C[1]-H)),abs(C[1]-L)),단기,1)/C[1]*100+
avg(max(max(H-L,abs(C[1]-H)),abs(C[1]-L)),장기,1)/C[1]*100)/2)*일정배수;
mm=(DayClose(20)+DayClose(19)+DayClose(18)+DayClose(17)+DayClose(16)+DayClose(15)+
DayClose(14)+DayClose(13)+DayClose(12)+DayClose(11)+DayClose(10)+DayClose(9)+
DayClose(8)+DayClose(7)+DayClose(6)+DayClose(5)+DayClose(4)+DayClose(3)+
DayClose(2)+DayClose(1))/20;
hh = mm+mm*atrv/100;
ll = mm-mm*atrv/100;
if MarketPosition == 0 and CrossUp(C,ll) and C[1] < ll[1] Then
Buy("b");
if MarketPosition == 1 and C < LatestEntryPrice(0) Then
Buy("bb");
if MarketPosition == 1 and CrossUp(c,hh) Then
ExitLong();
이 식을 시뮬레이션 돌렸을때 만약 종가에 hh라인보다 밑에 있어도 매도한걸로 잡힐까요?
아니라고 하면 시뮬레이션돌릴때 주가가 hh라인에 닿았을때 매도했다고 인식할수 있는 식 부탁드리고요
hh라인은 움직이지 않으니 시초에 hh라인에 매도를 걸어두는 식이 있다면 그것도 부탁드립니다
2023-09-19
1102
글번호 172563
시스템
답변완료
피라미딩 매매가 잘안됩니다.
if stime == 090000 Then
Buy("buy1",AtMarket,DEF,10);
if stime == 093000 Then
Buy("buy2",AtMarket,DEF,20);
if stime == 100000 Then
Sell("sell1",AtMarket,DEF,10);
if stime == 103000 Then
sell("sell2",AtMarket,DEF,20);
라는 전략식이 있습니다.
피라미딩에 모든 신호 진입으로 세팅하면
의도한건 9시에 10만큼 사고 9시30분에 수량 20만큼사고
그럼 총 30개샀으면
10시에 수량 10만큼 팔고
10시30분에 남은 20개를 마져파는 전략을 구현했는데
실제로 9시에 10개사고 9시 30분에 20개사고
10시에 다팔아버립니다.
원하는데로 구현하려면 어떻게해야하나요?
2023-09-19
999
글번호 172561
시스템
답변완료
부탁드립니다.
적용가능하도록 변형 부탁 드립니다.
indicator("Purple Cloud [MMD]",overlay=true, timeframe="", timeframe_gaps=true)
x1 = input(21, "Period")
alpha = input.float(1, "Alpha", step = 0.1)
mmdband=input(true,'MMD Bands')
x2 = ta.atr(x1) * alpha
xh = close + x2
xl = close - x2
a1=ta.vwma(hl2*volume,math.ceil(x1/4))/ta.vwma(volume,math.ceil(x1/4))
a2=ta.vwma(hl2*volume,math.ceil(x1/2))/ta.vwma(volume,math.ceil(x1/2))
a3=2*a1-a2
a4=ta.vwma(a3,x1)
b1 = 0.0
b1 := na(b1[1]) ? ta.sma(close, x1) : (b1[1] * (x1 - 1) + close) / x1
buy = a4<=xl and close>b1
sell = a4>=xh and close<b1
xs = 0
xs := buy ? 1 : sell ? -1 : xs[1]
barcolor( color = xs==1 ? color.purple :xs==-1? color.orange:na)
plotshape(buy and xs != xs[1], title = "BUY", text = 'B', style = shape.labelup, location = location.belowbar, color= color.purple, textcolor = color.white, size = size.tiny)
plotshape(sell and xs != xs[1], title = "SELL", text = 'S', style = shape.labeldown, location = location.abovebar, color= color.orange, textcolor = color.white, size = size.tiny)
xx1 = if close < open
low
else
high
xx2 = if close[1] < open[1]
low[1]
else
high[1]
xx3 = if close[2] < open[2]
low[2]
else
high[2]
xx4 = if close[3] < open[3]
low[3]
else
high[3]
xx5 = if close[4] < open[4]
low[4]
else
high[4]
xx6 = if close[5] < open[5]
low[5]
else
high[5]
xx7 = if close[6] < open[6]
low[6]
else
high[6]
xx8 = if close[7] < open[7]
low[7]
else
high[7]
xx9 = if close[8] < open[8]
low[8]
else
high[8]
xx10 = if close[9] < open[9]
low[9]
else
high[9]
xx11 = if close[10] < open[10]
low[10]
else
high[10]
xx12 = if close[11] < open[11]
low[11]
else
high[11]
xx13 = if close[12] < open[12]
low[12]
else
high[12]
xx14 = if close[13] < open[13]
low[13]
else
high[13]
xx15 = if close[14] < open[14]
low[14]
else
high[14]
xx16 = if close[15] < open[15]
low[15]
else
high[15]
y1=(xx1+xx2+xx3+xx4+xx5+xx6+xx7+xx8+xx9+xx10+xx11+xx12+xx13+xx14+xx15+xx16)/16
aa=2*ta.ema(y1,2)-ta.ema(y1,4)
aa1=ta.highest(high,16)
aa2=ta.lowest(low,16)
aa3=(aa1-aa2)*0.618
plot(aa+aa3,color=mmdband?color.purple:na,transp=40)
plot(aa-aa3,color=mmdband?color.orange:na,transp=40)
plot(aa,color=mmdband?color.black:na,transp=40)
alertcondition(buy and xs != xs[1], "PC Long", "PC Long")
alertcondition(sell and xs != xs[1], "PC Short", "PC Short")
2023-09-18
1179
글번호 172559
지표