커뮤니티
수식 문의드립니다.
2005-10-19 14:26:28
1350
글번호 8578
수고하십니다.
아래 식에서 "청산수량3"를 추가해서
매수후 10% 상승(수익)하면 "청산수량3"을 청산하도록 수식을 수정해주시면 감사하겠습니다.
감사합니다.
input : Short(5),Long(20),손절청산횟수(3),손절가(10),매수수량(10),청산수량1(5),청산수량2(5);
var : cnt(0);
if date != date[1] then
cnt = 0;
SetStopEndofday(1500);
if cnt < 손절청산횟수 then{
if (crossup(c,ma(c,short)) and C > MA(c,long)) or
(crossup(c,ma(c,long)) and C > MA(c,short)) or
(crossup(c,ma(c,short)) and crossup(C, MA(c,long))) then
buy("매수",onclose,def,매수수량);
}
if Marketposition() == 1 then{
if Crossdown(c,ma(c,short)) then
exitlong("청산1", OnClose, DEF, "", 청산수량1, 1);
if Crossdown(c,ma(c,long)) then
exitlong("청산2", OnClose, DEF, "", 청산수량2, 1);
if crossdown(c,entryprice()*(1-손절가/100)) then{
exitlong("손절");
cnt = cnt +1;
}
}
답변 2
예스스탁 예스스탁 답변
2005-10-20 10:01:48
안녕하세요
예스스탁입니다.
문의하신 식은 다음과 같습니다.
input : Short(5),Long(20),손절청산횟수(3),손절가(10),목표수익(10),매수수량(10),청산수량1(5),청산수량2(5);
var : cnt(0);
if date != date[1] then
cnt = 0;
SetStopEndofday(1500);
if cnt < 손절청산횟수 then{
if (crossup(c,ma(c,short)) and C > MA(c,long)) or
(crossup(c,ma(c,long)) and C > MA(c,short)) or
(crossup(c,ma(c,short)) and crossup(C, MA(c,long))) then
buy("매수",onclose,def,매수수량);
}
if Marketposition() == 1 then{
if Crossdown(c,ma(c,short)) then
exitlong("청산1", OnClose, DEF, "", 청산수량1, 1);
if Crossdown(c,ma(c,long)) then
exitlong("청산2", OnClose, DEF, "", 청산수량2, 1);
if crossup(c,entryprice()*(1+목표수익/100)) then
exitlong("목표수익");
if crossdown(c,entryprice()*(1-손절가/100)) then{
exitlong("손절");
cnt = cnt +1;
}
}
즐거운 하루되세요
> CJ_coco 님이 쓴 글입니다.
> 제목 : 수식 문의드립니다.
> 수고하십니다.
아래 식에서 "청산수량3"를 추가해서
매수후 10% 상승(수익)하면 "청산수량3"을 청산하도록 수식을 수정해주시면 감사하겠습니다.
감사합니다.
input : Short(5),Long(20),손절청산횟수(3),손절가(10),매수수량(10),청산수량1(5),청산수량2(5);
var : cnt(0);
if date != date[1] then
cnt = 0;
SetStopEndofday(1500);
if cnt < 손절청산횟수 then{
if (crossup(c,ma(c,short)) and C > MA(c,long)) or
(crossup(c,ma(c,long)) and C > MA(c,short)) or
(crossup(c,ma(c,short)) and crossup(C, MA(c,long))) then
buy("매수",onclose,def,매수수량);
}
if Marketposition() == 1 then{
if Crossdown(c,ma(c,short)) then
exitlong("청산1", OnClose, DEF, "", 청산수량1, 1);
if Crossdown(c,ma(c,long)) then
exitlong("청산2", OnClose, DEF, "", 청산수량2, 1);
if crossdown(c,entryprice()*(1-손절가/100)) then{
exitlong("손절");
cnt = cnt +1;
}
}
회원
2005-10-20 22:51:45
자꾸 부탁해서 죄송합니다.
아래 식대로 하면 10% 상승하면 10개 모두 청산이 됩니다.
이렇게 수정을 해주세요
아래 내용중에서 매수수량(10)개 진입후에 현재 2단계청산에서 3단계 청산으로 변경하려고합니다.
1.진입가대비 10%상승하면 2개청산
2."청산1"에 의해 4개청산
3."청산2"에 의한 4개청산
아래 식에서 10%상승하면 10개 진입중에 2개를 청산하고 나머지 8개는 아래수식대로 청산이 되면 됩니다.
부탁합니다
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수식 문의드립니다.
> 안녕하세요
예스스탁입니다.
문의하신 식은 다음과 같습니다.
input : Short(5),Long(20),손절청산횟수(3),손절가(10),목표수익(10),매수수량(10),청산수량1(5),청산수량2(5);
var : cnt(0);
if date != date[1] then
cnt = 0;
SetStopEndofday(1500);
if cnt < 손절청산횟수 then{
if (crossup(c,ma(c,short)) and C > MA(c,long)) or
(crossup(c,ma(c,long)) and C > MA(c,short)) or
(crossup(c,ma(c,short)) and crossup(C, MA(c,long))) then
buy("매수",onclose,def,매수수량);
}
if Marketposition() == 1 then{
if Crossdown(c,ma(c,short)) then
exitlong("청산1", OnClose, DEF, "", 청산수량1, 1);
if Crossdown(c,ma(c,long)) then
exitlong("청산2", OnClose, DEF, "", 청산수량2, 1);
if crossup(c,entryprice()*(1+목표수익/100)) then
exitlong("목표수익");
if crossdown(c,entryprice()*(1-손절가/100)) then{
exitlong("손절");
cnt = cnt +1;
}
}
즐거운 하루되세요
> CJ_coco 님이 쓴 글입니다.
> 제목 : 수식 문의드립니다.
> 수고하십니다.
아래 식에서 "청산수량3"를 추가해서
매수후 10% 상승(수익)하면 "청산수량3"을 청산하도록 수식을 수정해주시면 감사하겠습니다.
감사합니다.
input : Short(5),Long(20),손절청산횟수(3),손절가(10),매수수량(10),청산수량1(5),청산수량2(5);
var : cnt(0);
if date != date[1] then
cnt = 0;
SetStopEndofday(1500);
if cnt < 손절청산횟수 then{
if (crossup(c,ma(c,short)) and C > MA(c,long)) or
(crossup(c,ma(c,long)) and C > MA(c,short)) or
(crossup(c,ma(c,short)) and crossup(C, MA(c,long))) then
buy("매수",onclose,def,매수수량);
}
if Marketposition() == 1 then{
if Crossdown(c,ma(c,short)) then
exitlong("청산1", OnClose, DEF, "", 청산수량1, 1);
if Crossdown(c,ma(c,long)) then
exitlong("청산2", OnClose, DEF, "", 청산수량2, 1);
if crossdown(c,entryprice()*(1-손절가/100)) then{
exitlong("손절");
cnt = cnt +1;
}
}