안녕하세요?
아래의 수식에서 현재 매매횟수가 잘 안맞습니다.
외부변수에 지정해놓은 매매횟수보다 1회씩 더 나오는날이 많이 나오는 현상입니다.
정해놓은 횟수로 거래가 진행되었으면 합니다.
감사합니다.
inputs: Length(10), Pval(0.05),당일청산(153000);
input : 익절틱수(10), 손절틱수(10), 진입횟수(3);
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 == 0 and entry < 진입횟수 then Sell("S", AtStop, Lowest(Low, Length) - Pval) ;
if MarketPosition == 0 and entry < 진입횟수 then Buy("B", AtStop, highest(high, Length) + Pval) ;
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
SetStopEndofday(당일청산);
답변 1
예스스탁
예스스탁 답변
2024-01-18 15:53:10
안녕하세요
예스스탁입니다.
우선 진입횟수 카운트하는 부분을 다른방법으로 체크하게 수정해 드립니다.
하지만 아래 내용으로 완전히는 해당 부분을 막을수는 없습니다.
진입회수에 대한 제한은 if문에 지정해서 봉완성시로만 체크가 되는데
해당식에서 진입은 atstop타입으로 봉 미완성시에 진입하게 됩니다.
봉완성시에 무포지션이면 가격이 셋팅이 되고
가격을 셋팅해서 다음봉에서 매수진입과 매도진입을 감시하게 되는데
하나의 봉에서 매수진입과 매도진입이 모두 충족되면 청산하고 반대진입이 들어가게 되는데
이를 막을 방법이 없습니다.
inputs: Length(10), Pval(0.05),당일청산(153000);
input : 익절틱수(10), 손절틱수(10), 진입횟수(3);
var : entry(0),T1(0);
if Bdate != Bdate[1] Then
T1= TotalTrades;
entry = TotalTrades-T1;
if MarketPosition == 0 and entry < 진입횟수 then Sell("S", AtStop, Lowest(Low, Length) - Pval) ;
if MarketPosition == 0 and entry < 진입횟수 then Buy("B", AtStop, highest(high, Length) + Pval) ;
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
SetStopEndofday(당일청산);
즐거운 하루되세요
> 대구어린울프 님이 쓴 글입니다.
> 제목 : 수정 부탁드립니다.
> 안녕하세요?
아래의 수식에서 현재 매매횟수가 잘 안맞습니다.
외부변수에 지정해놓은 매매횟수보다 1회씩 더 나오는날이 많이 나오는 현상입니다.
정해놓은 횟수로 거래가 진행되었으면 합니다.
감사합니다.
inputs: Length(10), Pval(0.05),당일청산(153000);
input : 익절틱수(10), 손절틱수(10), 진입횟수(3);
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 == 0 and entry < 진입횟수 then Sell("S", AtStop, Lowest(Low, Length) - Pval) ;
if MarketPosition == 0 and entry < 진입횟수 then Buy("B", AtStop, highest(high, Length) + Pval) ;
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
SetStopEndofday(당일청산);