커뮤니티
매도 로직(2건) 요청 드립니다.
2018-07-30 07:20:12
135
글번호 120961
* 항상 많은 도움에 고맙습니다.
<요청 사항 1번 >
여러 계약이 한번에 청산 되는데 한계약만 운영 하고 싶은데 로직 수정좀 요청 드립니다.
Input : Period(20), Percent(0.2);
var : center(0),UPline(0),DNline(0);
center = ma(C, Period);
UPline = EnvelopeUp(Period, Percent);
Dnline = EnvelopeDown(Period, Percent);
VAR1 = Dnline+(UPline-Dnline)*0.9;
if crossup(c,Dnline) Then Buy("매수");
if CrossDown(c,UPline) Then sell("매도");
< 요청 사항 2 >
매매(매도,매수)후 최대 30딕 수익 이었다가 손실이 나는데...
.
30딕 수익에서 목표 수익에 못 가고 줄어 들다가 15딕 이하면
시장가 매도 로직 좀 부탁 드립니다.
Input : Period(20), Percent(0.2);
var : center(0),UPline(0),DNline(0);
center = ma(C, Period);
UPline = EnvelopeUp(Period, Percent);
Dnline = EnvelopeDown(Period, Percent);
VAR1 = Dnline+(UPline-Dnline)*0.9;
if crossup(c,Dnline) Then Buy("매수");
if CrossDown(c,UPline) Then sell("매도");
SetStopProfittarget(PriceScale*60,PointStop);
SetStopLoss(PriceScale*30,PointStop);
* 항상 고맙습니다. 좋은 하루되십시요.
- 1. 매도매수청산.png (0.33 MB)
- 2. 여러계약2.png (0.26 MB)
답변 1
예스스탁 예스스탁 답변
2018-07-30 08:41:52
안녕하세요
예스스탁입니다.
1
해당수식은 스위칭되는 수식입니다.
매수포지션 상태에서 매도진입신호가 발생하면
매수포지션을 전량 청산하고 매도로 진입
매도포지션 상태에서 매수진입신호가 발생하면
매도포지션을 전량 청산하고 매수로 진입합니다.
수식이 현재 피라미딩 설정이 되어 있습니다.
1계약만 진입하고자 하시면 파리미딩을 사용하지 않으셔야 합니다.
아니면 아래와 같이 한쪽 포지션만 거래하는 수식으로 구분해서
별도로 사용하셔야 합니다.
1-1
Input : Period(20), Percent(0.2);
var : center(0),UPline(0),DNline(0);
center = ma(C, Period);
UPline = EnvelopeUp(Period, Percent);
Dnline = EnvelopeDown(Period, Percent);
VAR1 = Dnline+(UPline-Dnline)*0.9;
if crossup(c,Dnline) Then Buy("매수",OnClose,def,1);
if CrossDown(c,UPline) Then exitlong("매수청산",OnClose,def,"",1,2);
1-2
Input : Period(20), Percent(0.2);
var : center(0),UPline(0),DNline(0);
center = ma(C, Period);
UPline = EnvelopeUp(Period, Percent);
Dnline = EnvelopeDown(Period, Percent);
VAR1 = Dnline+(UPline-Dnline)*0.9;
if crossup(c,Dnline) Then ExitShort("매도청산",OnClose,def,"",1,2);
if CrossDown(c,UPline) Then sell("매도",OnClose,def,1);
2
Input : Period(20), Percent(0.2);
var : center(0),UPline(0),DNline(0);
center = ma(C, Period);
UPline = EnvelopeUp(Period, Percent);
Dnline = EnvelopeDown(Period, Percent);
VAR1 = Dnline+(UPline-Dnline)*0.9;
if crossup(c,Dnline) Then Buy("매수");
if CrossDown(c,UPline) Then sell("매도");
SetStopProfittarget(PriceScale*60,PointStop);
SetStopLoss(PriceScale*30,PointStop);
if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*30 Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*15);
if MarketPosition == -1 and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*30 Then
ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale*15);
즐거운 하루되세요
> 요타 님이 쓴 글입니다.
> 제목 : 매도 로직(2건) 요청 드립니다.
> * 항상 많은 도움에 고맙습니다.
<요청 사항 1번 >
여러 계약이 한번에 청산 되는데 한계약만 운영 하고 싶은데 로직 수정좀 요청 드립니다.
Input : Period(20), Percent(0.2);
var : center(0),UPline(0),DNline(0);
center = ma(C, Period);
UPline = EnvelopeUp(Period, Percent);
Dnline = EnvelopeDown(Period, Percent);
VAR1 = Dnline+(UPline-Dnline)*0.9;
if crossup(c,Dnline) Then Buy("매수");
if CrossDown(c,UPline) Then sell("매도");
< 요청 사항 2 >
매매(매도,매수)후 최대 30딕 수익 이었다가 손실이 나는데...
.
30딕 수익에서 목표 수익에 못 가고 줄어 들다가 15딕 이하면
시장가 매도 로직 좀 부탁 드립니다.
Input : Period(20), Percent(0.2);
var : center(0),UPline(0),DNline(0);
center = ma(C, Period);
UPline = EnvelopeUp(Period, Percent);
Dnline = EnvelopeDown(Period, Percent);
VAR1 = Dnline+(UPline-Dnline)*0.9;
if crossup(c,Dnline) Then Buy("매수");
if CrossDown(c,UPline) Then sell("매도");
SetStopProfittarget(PriceScale*60,PointStop);
SetStopLoss(PriceScale*30,PointStop);
* 항상 고맙습니다. 좋은 하루되십시요.