답변완료
일봉기준 매매 분할매매 전략중 아래의 문제점 수정 부탁드립니다.
안녕하세요?
항상 감사드립니다.
다름이 아니라 아래의 일봉기준으로 분할매매 하는 수식중에서
아침 9시에 매수해서 상승시 구간별로 매도하고, 하락시 손절후에 다시 아래에서 구간별로
재매수 한후에 상승시 구간별로 매도하는 전략입니다.
문의1) 아침 시가에 k값 이상 상승시에 매수한 수량은 이상 없이 상승하면 구간별로 익절이 잘되고 있습니다. 그런데 아침 9시에 시작과 동시에 하락하여 b1,b2등에서 매수한 수량은 매수후 10~20% 상승했다가 0%대로 내려와도 매도를 하지 않고 결국 -1% 손절을 하거나 종가에 매도를 합니다.
# 수식에 문제가 있다면 수정을 수탁드립니다.
# 그리고 그 이유에 대한 설명도 부탁드립니다.
----------------------------------------------------------------------
.
.
//매수조건 생략
.
.
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
bh = h;
bm = CurrentContracts[1];
}
if h > bh Then
bh = h;
#상승시 구간익절
if bh < AvgEntryPrice*상승1구간익절 Then
ExitLong("1구간익절",AtLimit,AvgEntryPrice*상승1구간익절,"",round((bm*0.25),f),1);
if bh < AvgEntryPrice*상승2구간익절 Then
ExitLong("2구간익절",AtLimit,AvgEntryPrice*상승2구간익절,"",round((bm*0.25),f),1);
if bh < AvgEntryPrice*상승3구간익절 Then
ExitLong("3구간익절",AtLimit,AvgEntryPrice*상승3구간익절,"",round((bm*0.25),f),1);
if bh < AvgEntryPrice*상승4구간익절 Then
ExitLong("4구간익절",AtLimit,AvgEntryPrice*상승4구간익절);
if CountIf(CurrentContracts < CurrentContracts[1],BarsSinceEntry) >= 1 Then
ExitLong("bx",AtStop,LatestEntryPrice(0)*0.98);
# 하락시 분할매수
Buy("b1",AtLimit,NextBarOpen*하락1구간매수,Round((mm*원금대비_매수비율)/C,f));
Buy("b2",AtLimit,NextBarOpen*하락2구간매수,Round((mm*원금대비_매수비율)/C,f));
Buy("b3",AtLimit,NextBarOpen*하락3구간매수,Round((mm*원금대비_매수비율)/C,f));
}
SetStopLoss(StopLoss,PercentStop); #손절
EXITLONG("매도",ATMARKET); #변동 없을 경우 종가매도
2022-11-28
1310
글번호 164198
시스템
답변완료
지표수식 변환 요청드립니다
트레이딩뷰 수식을 예스 보조지표로 변환부탁드립니다..
//===========
//@version=5
//[SHK] STC colored indicator
//https://www.tradingview.com/u/shayankm/
indicator(title='[SHK] Schaff Trend Cycle (STC)', shorttitle='STC', overlay=false)
EEEEEE = input(12, 'Length')
BBBB = input(26, 'FastLength')
BBBBB = input(50, 'SlowLength')
AAAA(BBB, BBBB, BBBBB) =>
fastMA = ta.ema(BBB, BBBB)
slowMA = ta.ema(BBB, BBBBB)
AAAA = fastMA - slowMA
AAAA
AAAAA(EEEEEE, BBBB, BBBBB) =>
AAA = input(0.5)
var CCCCC = 0.0
var DDD = 0.0
var DDDDDD = 0.0
var EEEEE = 0.0
BBBBBB = AAAA(close, BBBB, BBBBB)
CCC = ta.lowest(BBBBBB, EEEEEE)
CCCC = ta.highest(BBBBBB, EEEEEE) - CCC
CCCCC := CCCC > 0 ? (BBBBBB - CCC) / CCCC * 100 : nz(CCCCC[1])
DDD := na(DDD[1]) ? CCCCC : DDD[1] + AAA * (CCCCC - DDD[1])
DDDD = ta.lowest(DDD, EEEEEE)
DDDDD = ta.highest(DDD, EEEEEE) - DDDD
DDDDDD := DDDDD > 0 ? (DDD - DDDD) / DDDDD * 100 : nz(DDDDDD[1])
EEEEE := na(EEEEE[1]) ? DDDDDD : EEEEE[1] + AAA * (DDDDDD - EEEEE[1])
EEEEE
mAAAAA = AAAAA(EEEEEE, BBBB, BBBBB)
mColor = mAAAAA > mAAAAA[1] ? color.new(color.green, 20) : color.new(color.red, 20)
if mAAAAA[3] <= mAAAAA[2] and mAAAAA[2] > mAAAAA[1] and mAAAAA > 75
alert("Red", alert.freq_once_per_bar)
if mAAAAA[3] >= mAAAAA[2] and mAAAAA[2] < mAAAAA[1] and mAAAAA < 25
alert("Green", alert.freq_once_per_bar)
plot(mAAAAA, color=mColor, title='STC', linewidth=2)
ul = plot(25, color=color.new(color.gray, 70))
ll = plot(75, color=color.new(color.gray, 70))
fill(ul, ll, color=color.new(color.gray, 96))
//
감사합니다.
2022-11-28
1555
글번호 164195
지표
답변완료
슈퍼트렌드 동그라미
input : Factor(7),Pd(10),highPd(1),lowPd(1);
var : sp(0),th(0),ll(0),myh(0),myl(0),up(0),dn(0),ii(0),Trendup(0),trenddown(0),Trend(0);
var : Tsl(0),linecolor(0);
sp = (H+L+c)/3;
th = high;
for ii = 1 to Pd*highPd
{
if th < high[ii] Then
th = high[ii];
}
ll = low;
for ii=1 to Pd*lowPd
{
if ll > low[ii] Then
ll = low[ii];
}
myh = ma(high,Pd)*0.4+th*0.6;
myl = (ma(sp,Pd)*0.5+ll*0.5);
Up = myl-(Factor*atr(Pd)*0.8 );
Dn = (myh+(Factor*atr(Pd) ));
TrendUp = iff(sp[1]>TrendUp[1], max(Up,TrendUp[1]) , Up);
TrendDown = iff(sp[1]<TrendDown[1], min(Dn,TrendDown[1]) , Dn);
Trend = iff(sp > TrendDown[1] , 1, iff(sp< TrendUp[1] , -1, Trend[1]));
Tsl = IFF(Trend==1, TrendUp, TrendDown);
linecolor = IFF(Trend == 1 , Red , Blue);
plot1(Tsl,"SuperTrend",linecolor);
양음 전환시마다 차트에 동그라미 표시. 감사합니다.
2022-11-27
1304
글번호 164194
지표