커뮤니티
수식 문의드립니다~
2012-09-26 01:29:47
345
글번호 55052
condition1 = c>=100 and c<120;
condition2 = c>=110 and c<130;
condition3 = c>=120 and c<140;
condition4 = c>=140 and c<170;
condition5 = c>=150 and c<180;
condition6 = c>=160 and c<190;
if condition1==true then
buy();
if condition4==true then
sell();
if condition2==true then
buy();
if condition5==true then
sell();
if condition3==true then
buy();
if condition6==true then
sell();
---------------------------------------------------
위와 같은 식에서 condition1,2,3 중에 하나가 발생했을때 한번만 진입되게 하고 싶습니다. 즉, condition1이 발생하여 가격이 100원 이상 120원 미만이 되었을 때 매수(이후 condition4가 발생하면(가격이 140원 이상 170원 미만이 되면) 매도) 하였다면,
다른 조건들, 즉 condition2나 condition3는 조건이 발생하더라도 진입이 안되게 하고 싶습니다.
마찬가지로 condition2가 발생하였다면 condition1이나 condition3가 발생하더라도 진입이 안되게요.
허접한 질문과 수식이지만 답변 부탁드립니다. 미리 감사드립니다~^^
답변 1
예스스탁 예스스탁 답변
2012-09-26 10:13:55
안녕하세요
예스스탁입니다.
var : buycnt(0),sellcnt(0),cnt(0);
#당일 매수진입횟수, 매도진입횟수 카운트
buycnt = 0;
sellcnt = 0;
for cnt = 0 to 10{
if sdate == EntryDate and MarketPosition(cnt) == 1 Then
buycnt = buycnt+1;
if sdate == EntryDate and MarketPosition(cnt) == 1 Then
sellcnt = sellcnt+1;
}
condition1 = c>=100 and c<120;
condition2 = c>=110 and c<130;
condition3 = c>=120 and c<140;
condition4 = c>=140 and c<170;
condition5 = c>=150 and c<180;
condition6 = c>=160 and c<190;
if buycnt < 1 and condition1==true then
buy();
if sellcnt < 1 and condition4==true then
sell();
if buycnt < 1 and condition2==true then
buy();
if sellcnt < 1 and condition5==true then
sell();
if buycnt < 1 and condition3==true then
buy();
if sellcnt < 1 and condition6==true then
sell();
즐거운 하루되세요
> HaloDe 님이 쓴 글입니다.
> 제목 : 수식 문의드립니다~
> condition1 = c>=100 and c<120;
condition2 = c>=110 and c<130;
condition3 = c>=120 and c<140;
condition4 = c>=140 and c<170;
condition5 = c>=150 and c<180;
condition6 = c>=160 and c<190;
if condition1==true then
buy();
if condition4==true then
sell();
if condition2==true then
buy();
if condition5==true then
sell();
if condition3==true then
buy();
if condition6==true then
sell();
---------------------------------------------------
위와 같은 식에서 condition1,2,3 중에 하나가 발생했을때 한번만 진입되게 하고 싶습니다. 즉, condition1이 발생하여 가격이 100원 이상 120원 미만이 되었을 때 매수(이후 condition4가 발생하면(가격이 140원 이상 170원 미만이 되면) 매도) 하였다면,
다른 조건들, 즉 condition2나 condition3는 조건이 발생하더라도 진입이 안되게 하고 싶습니다.
마찬가지로 condition2가 발생하였다면 condition1이나 condition3가 발생하더라도 진입이 안되게요.
허접한 질문과 수식이지만 답변 부탁드립니다. 미리 감사드립니다~^^
다음글
이전글