커뮤니티
수식 작성 감사합니다
2019-03-21 16:31:07
382
글번호 127254
피라미딩을 다른진입신호만 허용으로 설정하고 적용하시면 됩니다.
var1 = ma(C,1);
var2 = ma(C,65);
var3 = ma(C,90);
if MarketPosition <= 0 and C > var3 and crossup(var1,var3) Then
buy("b1",OnClose,def,1);
if MarketPosition == 1 then
{
if CurrentContracts > CurrentContracts[1] Then
Condition1 = false;
if H >= AvgEntryPrice+PriceScale*40 Then
Condition1 = true;
if MaxEntries == 1 and Condition1 == true and crossup(var1,var2) Then
buy("b2",OnClose,def,1);
if MaxEntries == 1 and Condition1 == true and crossup(var1,var2) Then
buy("b3",OnClose,def,2);
if MaxEntries >= 2 Then
ExitLong("bx1",AtStop,AvgEntryPrice);
if CrossDown(c,var3) Then
exitlong("bx2");
}
if MarketPosition <= 0 and C < var3 and CrossDown(var1,var3) Then
sell("s1",OnClose,def,1);
if MarketPosition == -1 then
{
if CurrentContracts > CurrentContracts[1] Then
Condition2 = false;
if L <= AvgEntryPrice-PriceScale*40 Then
Condition2 = true;
if MaxEntries == 1 and Condition2 == true and CrossDown(var1,var2) Then
sell("s2",OnClose,def,1);
if MaxEntries == 1 and Condition2 == true and CrossDown(var1,var2) Then
sell("s3",OnClose,def,2);
if MaxEntries >= 2 Then
ExitShort("sx1",AtStop,AvgEntryPrice);
if CrossUp(c,var3) Then
ExitShort("sx2");
}
즐거운 하루되세요
답변 1
예스스탁 예스스탁 답변
2019-03-21 14:39:45
안녕하세요
예스스탁입니다.
추가진입봉에서 평단가 대비 40틱 수익상태로 변경했습니다.
청산은 1이평이 90단순이평 이탈/돌파로만 지정했습니다.
var1 = ma(C,1);
var2 = ma(C,65);
var3 = ma(C,90);
if MarketPosition <= 0 and C > var3 and crossup(var1,var3) Then
buy("b1",OnClose,def,1);
if MarketPosition == 1 then
{
if MaxEntries == 1 and C > AvgEntryPrice+PriceScale*40 and crossup(var1,var2) Then
buy("b2",OnClose,def,1);
if MaxEntries == 1 and C > AvgEntryPrice+PriceScale*40 and crossup(var1,var2) Then
buy("b3",OnClose,def,2);
if CrossDown(c,var3) Then
exitlong("bx");
}
if MarketPosition <= 0 and C < var3 and CrossDown(var1,var3) Then
sell("s1",OnClose,def,1);
if MarketPosition == -1 then
{
if MaxEntries == 1 and C < AvgEntryPrice-PriceScale*40 and CrossDown(var1,var2) Then
sell("s2",OnClose,def,1);
if MaxEntries == 1 and C < AvgEntryPrice-PriceScale*40 and CrossDown(var1,var2) Then
sell("s3",OnClose,def,2);
if CrossUp(c,var3) Then
ExitShort("sx");
}
즐거운 하루되세요
> 이태리 님이 쓴 글입니다.
> 제목 : 수식 작성 감사합니다
>
여러번 수식 부탁드려서 잘 사용하고 있습니다
감사드리고요
한번 이평선 신호에 두번 매매되는 등 추가매집신호가 오류 발생해서
수식을 약간만 수정할까 합니다
일전에 추세매매 관련해서 수식 작성 받았는데요
한번 65이평선 돌파 신호에 1계약씩 체결됬음합니다
이해 돕기 위해서 사진 첨부해서 올립니다
위 그림상에
var1 = ma(C,1);녹색 단순이평선
var2 = ma(C,65);검은색 단순이평선
var3 = ma(C,90);보라색 단순이평선
1. 90일단순이평선 돌파되면 1계약 진입
2.첫번째 65단순이평선 돌파하는 매집1지점에서 1계약만 매집
(65일이평선 돌파 신호 나오고 40틱이상 수익이 발생한 상태이면)
3.두번째 65단순이평선 돌파하는 신호나오는 매집2지점에서 또 1계약만 추가 매집
(65일이평선 돌파 신호 나오고
보유분 2계약 평균수익이 40틱이상 수익이 발생한 상태이면)
4.세번째 65단순이평선 돌파하는 신호나오는 매집3지점에서 또다시1계약만 추가 매집
(65일이평선 돌파 신호 나오고
보유분 3계약 평균수익이 40틱이상 수익이 발생한 상태이면)
그리고 90일단순이평선 이탈하면 보유분 모두 청산입니다
항상 많은 도움 감사드립니다^^
아래 수식은 일전에 부탁드린 내용입니다~
안녕하세요
예스스탁입니다.
피라미딩을 다른진입신호만 허용으로 설정하고 적용하시면 됩니다.
var1 = ma(C,1);
var2 = ma(C,65);
var3 = ma(C,90);
if MarketPosition <= 0 and C > var3 and crossup(var1,var3) Then
buy("b1",OnClose,def,1);
if MarketPosition == 1 then
{
if CurrentContracts > CurrentContracts[1] Then
Condition1 = false;
if H >= AvgEntryPrice+PriceScale*40 Then
Condition1 = true;
if MaxEntries == 1 and Condition1 == true and crossup(var1,var2) Then
buy("b2",OnClose,def,1);
if MaxEntries == 1 and Condition1 == true and crossup(var1,var2) Then
buy("b3",OnClose,def,2);
if MaxEntries >= 2 Then
ExitLong("bx1",AtStop,AvgEntryPrice);
if CrossDown(c,var3) Then
exitlong("bx2");
}
if MarketPosition <= 0 and C < var3 and CrossDown(var1,var3) Then
sell("s1",OnClose,def,1);
if MarketPosition == -1 then
{
if CurrentContracts > CurrentContracts[1] Then
Condition2 = false;
if L <= AvgEntryPrice-PriceScale*40 Then
Condition2 = true;
if MaxEntries == 1 and Condition2 == true and CrossDown(var1,var2) Then
sell("s2",OnClose,def,1);
if MaxEntries == 1 and Condition2 == true and CrossDown(var1,var2) Then
sell("s3",OnClose,def,2);
if MaxEntries >= 2 Then
ExitShort("sx1",AtStop,AvgEntryPrice);
if CrossUp(c,var3) Then
ExitShort("sx2");
}
즐거운 하루되세요
> 이태리 님이 쓴 글입니다.
> 제목 : 수식 작성 부탁합니다
> 수고 하십니다~
추세매매 전략으로 매매코자 합니다
90일 이평선을 기준으로 해서
한쪽방향으로만 계속 추가매집!
90일 단순이평선 지지받고 있을때....
1일 단순이평선이 90일 단순이평선을 상향돌파시
1계약 매집진입하고 90일 단순이평선 하향이탈시 청산
추가 매집은 첫1계약보유분이 40틱이상 수익발생시부터
1일 단순이평선이 65일 단순이평선을 하향이탈했다 상향돌파시 1계약 추가매집
2계약보유분이 평균단가에 도달하거나
1일 단순이평선이 90일 단순이평선을 하향이탈시 보유분 모두 청산
3번째 추가매집도
2계약 보유분 평균수익이 40틱이상 발생시부터
1일 단순이평선이 65일 단순이평선을 하향이탈했다 상향돌파시 2계약 추가매집
4계약보유분이 평균단가에 도달하거나
1일 단순이평선이 90일 단순이평선을 하향이탈시 보유분 모두 청산
반대로
90일 단순이평선 저항받고 있을때....
1일 단순이평선이 90일 단순이평선을 하향돌파시
1계약 매집진입하고 90일 단순이평선 상향이탈시 청산
추가 매집은 첫1계약보유분이 40틱이상 수익발생시부터
1일 단순이평선이 65일 단순이평선을 상향이탈했다 하향돌파시 1계약 추가매집
2계약보유분이 평균단가에 도달하거나
1일 단순이평선이 90일 단순이평선을 상향이탈시 보유분 모두 청산
3계약째 추가매집도
2계약 보유분 평균수익이 40틱이상 발생시부터
1일 단순이평선이 65일 단순이평선을 상향이탈했다 하향돌파시 2계약 추가매집
4계약보유분이 평균단가에 도달하거나
1일 단순이평선이 90일 단순이평선을 상향이탈시 보유분 모두 청산입니다
감사합니다~
다음글
이전글