예스스탁
예스스탁 답변
2020-08-14 11:44:09
안녕하세요
예스스탁입니다.
분할청산 중에 추가매수가 발생하면 정률이 의미가 없어지게 됩니다.
청산이 발생하면 이후에는 추가진입이 되지 않게 했습니다.
input : 기준평균봉값(80);
input : 최초진입하락폭(0.94);
input : 추가진입하락폭(0.99);
input : MFI기간(15),MFI값(90);
input : 심리도기간(15),심리도값(80);
input : 제1매수금액(100);
input : 제2매수금액(150);
input : 제3매수금액(200);
input : 제4매수금액(250);
input : 제5매수금액(300);
input : 제6매수금액(350);
input : 제7매수금액(400);
input : 제8매수금액(450);
input : 제9매수금액(500);
input : 제10매수금액(550);
input : 제11매수금액(600);
input : 제12매수금액(600);
input : 제13매수금액(600);
input : 제14매수금액(600);
input : 제15매수금액(600);
var : mav(0,data2),MM(0,Data3),SS(0,Data3);
var : MMM(0,Data2),SSS(0,Data2),Xcnt(0,Data2),Xvol(0,data1);
mav = data2(ma(c,기준평균봉값));
MM = Data3(mfi(MFI기간));
SS = Data3(Simrido(심리도기간));
MMM = Data2(mfi(MFI기간));
SSS = Data2(Simrido(심리도기간));
if MarketPosition == 0 and data2(CrossDown(c,mav*최초진입하락폭)) then
buy("b1",atlimit,C,Floor(제1매수금액*10000/min(NextBarOpen,C)));
if MarketPosition == 1 then
{
if xcnt == 0 then
{
if MaxEntries == 1 then # 85
buy("b2",AtLimit,LatestEntryPrice(0)*추가진입하락폭,Floor(제2매수금액*10000/c));
if MaxEntries == 2 then # 80
buy("b3",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.01),Floor(제3매수금액*10000/c));
if MaxEntries == 3 then # 75
buy("b4",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.02),Floor(제4매수금액*10000/c));
if MaxEntries == 4 then # 70
buy("b5",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.03),Floor(제5매수금액*10000/c));
if MaxEntries == 5 then # 65
buy("b6",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.04),Floor(제6매수금액*10000/c));
if MaxEntries == 6 then # 85
buy("b7",AtLimit,LatestEntryPrice(0)*추가진입하락폭-0.05,Floor(제7매수금액*10000/c));
if MaxEntries == 7 then # 80
buy("b8",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.06),Floor(제8매수금액*10000/c));
if MaxEntries == 8 then # 75
buy("b9",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.07),Floor(제9매수금액*10000/c));
if MaxEntries == 9 then # 70
buy("b10",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.08),Floor(제10매수금액*10000/c));
if MaxEntries == 10 then # 65
buy("b11",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.09),Floor(제11매수금액*10000/c));
if MaxEntries == 11 then # 80
buy("b12",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.10),Floor(제12매수금액*10000/c));
if MaxEntries == 12 then # 75
buy("b13",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.11),Floor(제13매수금액*10000/c));
if MaxEntries == 13 then # 70
buy("b14",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.12),Floor(제14매수금액*10000/c));
if MaxEntries == 14 then # 65
buy("b15",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.13),Floor(제15매수금액*10000/c));
}
if MM > MFI값 or SS > 심리도값 or MMM > MFI값 or SSS > 심리도값 Then
{
xcnt = xcnt+1;
if Xcnt <= 9 Then
Xvol = Floor(MaxContracts*0.1);
else
Xvol = CurrentContracts;
if Xcnt <= 10 Then
exitlong("청산",atlimit,C,"",Xvol,2);
}
}
Else
xcnt = 0;
즐거운 하루되세요
> 이형지 님이 쓴 글입니다.
> 제목 : 청산 수식이 발생할때마다 분할 매도하는 수식 부탁드림니다.
> 국내 주식
data1 삼성전자(300분봉)
data2 Kodex200
data3 삼성전자 일봉
분할매수는 15단계에 걸쳐서 잘 작동이 되는데요...
청산는 신호 발생하면 전량 실행됨에 따라 다음과 같이 운영하고 싶습니다.
분할 청산( 10회 정률 분할 청산)
분할 매수한후
if MM > MFI값 or SS > 심리도값 or MMM > MFI값 or SSS > 심리도값
위와 같은 신호가 봉마다 발생시마다 10회 정률 분할 청산하는 수식 부탁드림니다.
예를 들면 5회에 걸쳐 1000만원을 매수한후
if MM > MFI값 or SS > 심리도값 or MMM > MFI값 or SSS > 심리도값
의 신호가 발생하는 봉마다 10분의 1씩 ( 100만원씩) 청산하는 수식 요망
-------------아 래 수 식 ------------------
input : 기준평균봉값(80);
input : 최초진입하락폭(0.94);
input : 추가진입하락폭(0.99);
input : MFI기간(15),MFI값(90);
input : 심리도기간(15),심리도값(80);
input : 제1매수금액(100);
input : 제2매수금액(150);
input : 제3매수금액(200);
input : 제4매수금액(250);
input : 제5매수금액(300);
input : 제6매수금액(350);
input : 제7매수금액(400);
input : 제8매수금액(450);
input : 제9매수금액(500);
input : 제10매수금액(550);
input : 제11매수금액(600);
input : 제12매수금액(600);
input : 제13매수금액(600);
input : 제14매수금액(600);
input : 제15매수금액(600);
var : mav(0,data2),MM(0,Data3),SS(0,Data3);
var : MMM(0,Data2),SSS(0,Data2);
mav = data2(ma(c,기준평균봉값));
MM = Data3(mfi(MFI기간));
SS = Data3(Simrido(심리도기간));
MMM = Data2(mfi(MFI기간));
SSS = Data2(Simrido(심리도기간));
if MarketPosition == 0 and data2(CrossDown(c,mav*최초진입하락폭)) then
buy("b1",atlimit,C,Floor(제1매수금액*10000/min(NextBarOpen,C)));
if MarketPosition == 1 then
{
if MaxEntries == 1 then # 85
buy("b2",AtLimit,LatestEntryPrice(0)*추가진입하락폭,Floor(제2매수금액*10000/c));
if MaxEntries == 2 then # 80
buy("b3",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.01),Floor(제3매수금액*10000/c));
if MaxEntries == 3 then # 75
buy("b4",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.02),Floor(제4매수금액*10000/c));
if MaxEntries == 4 then # 70
buy("b5",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.03),Floor(제5매수금액*10000/c));
if MaxEntries == 5 then # 65
buy("b6",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.04),Floor(제6매수금액*10000/c));
if MaxEntries == 6 then # 85
buy("b7",AtLimit,LatestEntryPrice(0)*추가진입하락폭-0.05,Floor(제7매수금액*10000/c));
if MaxEntries == 7 then # 80
buy("b8",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.06),Floor(제8매수금액*10000/c));
if MaxEntries == 8 then # 75
buy("b9",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.07),Floor(제9매수금액*10000/c));
if MaxEntries == 9 then # 70
buy("b10",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.08),Floor(제10매수금액*10000/c));
if MaxEntries == 10 then # 65
buy("b11",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.09),Floor(제11매수금액*10000/c));
if MaxEntries == 11 then # 80
buy("b12",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.10),Floor(제12매수금액*10000/c));
if MaxEntries == 12 then # 75
buy("b13",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.11),Floor(제13매수금액*10000/c));
if MaxEntries == 13 then # 70
buy("b14",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.12),Floor(제14매수금액*10000/c));
if MaxEntries == 14 then # 65
buy("b15",AtLimit,LatestEntryPrice(0)*(추가진입하락폭-0.13),Floor(제15매수금액*10000/c));
if MM > MFI값 or SS > 심리도값 or MMM > MFI값 or SSS > 심리도값 Then
exitlong("청산",atlimit,C);
}