답변완료
매매 정지 가능할까요?
input : StartTime(120000),EndTime(151000);
var : Tcond(false,Data1);
var : C2(0,Data2);
input : 손절(2.4),익절(3.4);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
Tcond = true;
C2 = Data2(c);
if Tcond == true Then
{
#var : C2(0,Data2);
if crossup(C2,0) then
buy();
if crossdown(C2,0) then
sell();
}
SetStopEndofday(EndTime);
SetStopProfittarget(익절,PointStop);
SetStoploss(손절,PointStop);
-------------------
c2가 1보다 커지면 그날 포지션이 있다면 청산하고,
어쨋든 매매 정지하고 싶습니다. 가능할까요?
부탁드립니다.
2021-02-26
555
글번호 146662
시스템
답변완료
문의드립니다.
아래수식을 예스로 부탁합니다.
amplitude = input(title="Amplitude", defval=2)
channelDeviation = input(title="Channel Deviation", defval=2)
showArrows = input(title="Show Arrows", defval=true)
showChannels = input(title="Show Channels", defval=true)
var int trend = 0
var int nextTrend = 0
var float maxLowPrice = nz(low[1], low)
var float minHighPrice = nz(high[1], high)
var float up = 0.0
var float down = 0.0
float atrHigh = 0.0
float atrLow = 0.0
float arrowUp = na
float arrowDown = na
atr2 = atr(100) / 2
dev = channelDeviation * atr2
highPrice = high[abs(highestbars(amplitude))]
lowPrice = low[abs(lowestbars(amplitude))]
highma = sma(high, amplitude)
lowma = sma(low, amplitude)
if nextTrend == 1
maxLowPrice := max(lowPrice, maxLowPrice)
if highma < maxLowPrice and close < nz(low[1], low)
trend := 1
nextTrend := 0
minHighPrice := highPrice
else
minHighPrice := min(highPrice, minHighPrice)
if lowma > minHighPrice and close > nz(high[1], high)
trend := 0
nextTrend := 1
maxLowPrice := lowPrice
if trend == 0
if not na(trend[1]) and trend[1] != 0
up := na(down[1]) ? down : down[1]
arrowUp := up - atr2
else
up := na(up[1]) ? maxLowPrice : max(maxLowPrice, up[1])
atrHigh := up + dev
atrLow := up - dev
else
if not na(trend[1]) and trend[1] != 1
down := na(up[1]) ? up : up[1]
arrowDown := down + atr2
else
down := na(down[1]) ? minHighPrice : min(minHighPrice, down[1])
atrHigh := down + dev
atrLow := down - dev
ht = trend == 0 ? up : down
var color buyColor = color.blue
var color sellColor = color.red
htColor = trend == 0 ? buyColor : sellColor
htPlot = plot(ht, title="HalfTrend", linewidth=2, color=htColor)
atrHighPlot = plot(showChannels ? atrHigh : na, title="ATR High", style=plot.style_circles, color=sellColor)
atrLowPlot = plot(showChannels ? atrLow : na, title="ATR Low", style=plot.style_circles, color=buyColor)
fill(htPlot, atrHighPlot, title="ATR High Ribbon", color=sellColor)
fill(htPlot, atrLowPlot, title="ATR Low Ribbon", color=buyColor)
buySignal = not na(arrowUp) and (trend == 0 and trend[1] == 1)
sellSignal = not na(arrowDown) and (trend == 1 and trend[1] == 0)
plotshape(showArrows and buySignal ? atrLow : na, title="Arrow Up", style=shape.triangleup, location=location.absolute, size=size.tiny, color=buyColor)
plotshape(showArrows and sellSignal ? atrHigh : na, title="Arrow Down", style=shape.triangledown, location=location.absolute, size=size.tiny, color=sellColor)
alertcondition(buySignal, title="Alert: HalfTrend Buy", message="HalfTrend Buy")
alertcondition(sellSignal, title="Alert: HalfTrend Sell", message="HalfTrend Sell")
2021-02-25
700
글번호 146659
지표
답변완료
감사합니다....복받으실꺼에요~~~
안녕하세요?
늘 감사합니다.
문의 드립니다.
1.
아래 수식중 진입신호에 의해 진입된후
청산식에서
다음봉이 진행중일 때 강제 청산처럼 바로 해당비율로 청산되는 식으로 변경 부탁드립니다.
지금상태는 진입후 다음봉이 완성되고, 다음 봉에서 청산됩니다. 해서 수익이 발생해도 봉이 완성되지 않아 손실로 마무리 되는 경우가 있습니다.
고맙습니다.
2.
1일 1회로 진입제한이 되어 있는데,
전략에 보여지는 봉수(300) 안에 24일날 진입청산이 되어 있으면 25일 진입을 하지 않습니다.
그렇다고 전략의 봉의 갯수를 줄이면 전일 종가가 전략에 표시되지않아 다른곳에서 진입을 합니다.
해결 방법이 없을까요?
var: T1(0),ENTRY(0);
if Bdate != Bdate[1]Then
T1 = TotalTrades[1];
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = TotalTrades-T1+1;
////////////////////////////////////////////
Input : shortPeriod(5), longPeriod(20);
value1 = ma(C, shortPeriod);
value2 = ma(C, longPeriod);
if DayOpen >= DayClose(1) and Value1 < c Then
{
if entry < 1 Then
Buy("매수");
Else ExitShort();
}
# 매도청산
If CrossDown(c , value1) Then
{
if entry < 1 Then
Sell("매도");
Else ExitLong();
}
if MarketPosition == 1 Then
{
ExitLong("bx1",AtStop,EntryPrice*1.03,"",Floor(MaxContracts*0.25),1);
ExitLong("bx2",AtStop,EntryPrice*1.04,"",Floor(MaxContracts*0.25),1);
ExitLong("bx3",AtStop,EntryPrice*1.05,"",Floor(MaxContracts*0.25),1);
ExitLong("bx4",AtStop,EntryPrice*1.06,"",Floor(MaxContracts*0.25),1);
ExitLong("bx5",AtStop,EntryPrice*1.07);
if Highest(H,BarsSinceEntry) >= EntryPrice*1.01 Then
ExitLong("bx",AtStop,Highest(H,BarsSinceEntry)*0.96);
}
2021-02-25
951
글번호 146648
시스템