커뮤니티

문의드려요

프로필 이미지
쿠루드
2013-09-03 12:32:02
90
글번호 67121
답변완료
아래 간단한 식을 좀 추가하고 싶습니다. 먼저 수익청산과 손절은 아래식을 그대로 따르되, 차트에 진입가, 목표가, 손절가만 수평선과함께 가격 표시하고 싶습니다. 그러니까...진입후 n틱 목표가, m틱 손실가를 가정해서 진입가, 손절가, 목표가를 수평선과 함께 차트에 표시하는 수식으로 수정 부탁합니다. 감사합니다. Input : shortPeriod(15); value1 = ema(C, shortPeriod); if c>value1 and value1 > value1[1] and value1[1] <= value1[2] then buy(); if MarketPosition == 1 and c<value1 and value1 < value1[1] Then ExitLong("매수청산"); if c<value1 and value1 < value1[1] and value1[1] >= value1[2] then sell(); if MarketPosition == -1 and c>value1 and value1 > value1[1] Then ExitShort("매도청산");
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-09-03 15:13:49

안녕하세요 예스스탁입니다. Input : shortPeriod(15),Ptick(10),Ltick(10); value1 = ema(C, shortPeriod); if c>value1 and value1 > value1[1] and value1[1] <= value1[2] then buy(); if MarketPosition == 1 and c<value1 and value1 < value1[1] Then ExitLong("매수청산"); if c<value1 and value1 < value1[1] and value1[1] >= value1[2] then sell(); if MarketPosition == -1 and c>value1 and value1 > value1[1] Then ExitShort("매도청산"); TL_Delete(var1); TL_Delete(var2); TL_Delete(var3); if MarketPosition == 1 Then{ var1 = TL_New(EntryDate,EntryTime,EntryPrice,sdate,stime,EntryPrice); var2 = TL_New(EntryDate,EntryTime,EntryPrice+PriceScale*Ptick,sdate,stime,EntryPrice+PriceScale*Ptick); var3 = TL_New(EntryDate,EntryTime,EntryPrice-PriceScale*Ltick,sdate,stime,EntryPrice-PriceScale*Ltick); } if MarketPosition == -1 Then{ var1 = TL_New(EntryDate,EntryTime,EntryPrice,sdate,stime,EntryPrice); var2 = TL_New(EntryDate,EntryTime,EntryPrice-PriceScale*Ptick,sdate,stime,EntryPrice-PriceScale*Ptick); var3 = TL_New(EntryDate,EntryTime,EntryPrice+PriceScale*Ltick,sdate,stime,EntryPrice+PriceScale*Ltick); } 시스템식에서는 plot명령어가 사용될수 없어 추세선 함수를 이용하셔야 합니다. 추세선 함수는 완성봉에서만 그려지므로 차트상 마지막봉에는 그려지지 않습니다. 이용에 참고하시기 바랍니다. 위 추세선은 최근 진입만 기록합니다 즐거운 하루되세요 > 쿠루드 님이 쓴 글입니다. > 제목 : 문의드려요 > 아래 간단한 식을 좀 추가하고 싶습니다. 먼저 수익청산과 손절은 아래식을 그대로 따르되, 차트에 진입가, 목표가, 손절가만 수평선과함께 가격 표시하고 싶습니다. 그러니까...진입후 n틱 목표가, m틱 손실가를 가정해서 진입가, 손절가, 목표가를 수평선과 함께 차트에 표시하는 수식으로 수정 부탁합니다. 감사합니다. Input : shortPeriod(15); value1 = ema(C, shortPeriod); if c>value1 and value1 > value1[1] and value1[1] <= value1[2] then buy(); if MarketPosition == 1 and c<value1 and value1 < value1[1] Then ExitLong("매수청산"); if c<value1 and value1 < value1[1] and value1[1] >= value1[2] then sell(); if MarketPosition == -1 and c>value1 and value1 > value1[1] Then ExitShort("매도청산");