커뮤니티
사용하고 있는 수식에서 전일 상승(하락)관련 인자를 반영하고 싶습니다.
2019-05-27 07:00:23
208
글번호 128987
아래 수식을 사용하고 있는데 여기에 다음 기능을 반영하고 싶습니다.
(참고 아래수식은 해외선물,30분봉기준입니다.)
1. 전일(일봉기준) 5% 상승시 매도진입만 활성화 (매수진입은 조건도달시에도 비활성화)
전일(일봉기준) -10%하락시 매수진입만 활성화 ( 매도진입은 조건도달시에도 비활성화)
-------------------------
Input : af(0.02), maxAF(0.2);
Input : P1(15000),P2(37000);
Input : Period(20), Percent1(0.7),Percent2(0.7);
Input : 음봉틱수1(1),음봉틱수2(3);
Input : 청산양봉틱수1(3),청산양봉틱수2(8);
Input : M1(2),M2(0);
input : 즉시익절1(395),즉시손절1(170),봉완성손절1(65);
input : 즉시익절2(60),즉시손절2(60),봉완성손절2(55);
Var : S1(0,data1),S2(0,data2); # 30분봉:S1 30분봉:S2
var : center(0,data1),UPline(0,data1),DNline(0,data1); # 엔벨로프
var : T(0,data1);
center = data1(ma(C, Period));
UPline = data1(EnvelopeUp(Period, Percent1));
Dnline = data1(EnvelopeDown(Period, Percent2));
S1 = data1(CSar(af,maxAF));
S2 = data2(CSar(af,maxAF));
if data1(crossup(c,S1)) Then
T = 1;
if data1(CrossDown(c,S1)) Then
T = -1;
if T == 1 and data1(C>upline and V >= P1 and c > dayopen) and data2(C > S2) Then
{
T = 3;
buy("매수",AtLimit,C-PriceScale*음봉틱수1);
}
if T == -1 and data1(C<dnline and V >= P2 and c < dayopen ) and data2(C < S2) Then
{
T = -3;
sell("매도",AtLimit,C+PriceScale*음봉틱수2);
}
if MarketPosition == 1 then
{
ExitLong("즉시익절1",AtLimit,EntryPrice+PriceScale*즉시익절1);
if BarsSinceEntry >= M1 and c[1]>c[2] Then
ExitLong("봉완성익절1",AtLimit,C+PriceScale*청산양봉틱수1);
ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1);
if c <= EntryPrice-PriceScale*봉완성손절1 Then
ExitLong("봉완성손절1");
}
if MarketPosition == -1 then
{
ExitShort("즉시익절2",AtLimit,EntryPrice-PriceScale*즉시익절2);
if BarsSinceEntry >= M2 and c[1]<c[2] Then
ExitShort("봉완성익절2",AtLimit,C-PriceScale*청산양봉틱수2);
ExitShort("즉시손절2",AtStop,EntryPrice+PriceScale*즉시손절2);
if c >= EntryPrice+PriceScale*봉완성손절2 Then
ExitShort("봉완성손절2");
}
if bdate != bdate[1] Then
SetStopEndofday(0);
if sdate != sdate[1] and DayOfWeek(sdate) == 6 Then
SetStopEndofday(050000);
답변 1
예스스탁 예스스탁 답변
2019-05-28 14:55:07
안녕하세요
예스스탁입니다.
Input : af(0.02), maxAF(0.2);
Input : P1(15000),P2(37000);
Input : Period(20), Percent1(0.7),Percent2(0.7);
Input : 음봉틱수1(1),음봉틱수2(3);
Input : 청산양봉틱수1(3),청산양봉틱수2(8);
Input : M1(2),M2(0);
input : 즉시익절1(395),즉시손절1(170),봉완성손절1(65);
input : 즉시익절2(60),즉시손절2(60),봉완성손절2(55);
Var : S1(0,data1),S2(0,data2); # 30분봉:S1 30분봉:S2
var : center(0,data1),UPline(0,data1),DNline(0,data1); # 엔벨로프
var : T(0,data1);
center = data1(ma(C, Period));
UPline = data1(EnvelopeUp(Period, Percent1));
Dnline = data1(EnvelopeDown(Period, Percent2));
S1 = data1(CSar(af,maxAF));
S2 = data2(CSar(af,maxAF));
if data1(crossup(c,S1)) Then
T = 1;
if data1(CrossDown(c,S1)) Then
T = -1;
if T == 1 and data1(C>upline and V >= P1 and c > dayopen) and data2(C > S2) Then
{
T = 3;
if data1(c < dayclose(1)*1.05) Then
buy("매수",AtLimit,C-PriceScale*음봉틱수1);
}
if T == -1 and data1(C<dnline and V >= P2 and c < dayopen ) and data2(C < S2) Then
{
T = -3;
if c > DayClose(1)*0.90 Then
sell("매도",AtLimit,C+PriceScale*음봉틱수2);
}
if MarketPosition == 1 then
{
ExitLong("즉시익절1",AtLimit,EntryPrice+PriceScale*즉시익절1);
if BarsSinceEntry >= M1 and c[1]>c[2] Then
ExitLong("봉완성익절1",AtLimit,C+PriceScale*청산양봉틱수1);
ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1);
if c <= EntryPrice-PriceScale*봉완성손절1 Then
ExitLong("봉완성손절1");
}
if MarketPosition == -1 then
{
ExitShort("즉시익절2",AtLimit,EntryPrice-PriceScale*즉시익절2);
if BarsSinceEntry >= M2 and c[1]<c[2] Then
ExitShort("봉완성익절2",AtLimit,C-PriceScale*청산양봉틱수2);
ExitShort("즉시손절2",AtStop,EntryPrice+PriceScale*즉시손절2);
if c >= EntryPrice+PriceScale*봉완성손절2 Then
ExitShort("봉완성손절2");
}
if bdate != bdate[1] Then
SetStopEndofday(0);
if sdate != sdate[1] and DayOfWeek(sdate) == 6 Then
SetStopEndofday(050000);
즐거운 하루되세요
> 이형지 님이 쓴 글입니다.
> 제목 : 사용하고 있는 수식에서 전일 상승(하락)관련 인자를 반영하고 싶습니다.
>
아래 수식을 사용하고 있는데 여기에 다음 기능을 반영하고 싶습니다.
(참고 아래수식은 해외선물,30분봉기준입니다.)
1. 전일(일봉기준) 5% 상승시 매도진입만 활성화 (매수진입은 조건도달시에도 비활성화)
전일(일봉기준) -10%하락시 매수진입만 활성화 ( 매도진입은 조건도달시에도 비활성화)
-------------------------
Input : af(0.02), maxAF(0.2);
Input : P1(15000),P2(37000);
Input : Period(20), Percent1(0.7),Percent2(0.7);
Input : 음봉틱수1(1),음봉틱수2(3);
Input : 청산양봉틱수1(3),청산양봉틱수2(8);
Input : M1(2),M2(0);
input : 즉시익절1(395),즉시손절1(170),봉완성손절1(65);
input : 즉시익절2(60),즉시손절2(60),봉완성손절2(55);
Var : S1(0,data1),S2(0,data2); # 30분봉:S1 30분봉:S2
var : center(0,data1),UPline(0,data1),DNline(0,data1); # 엔벨로프
var : T(0,data1);
center = data1(ma(C, Period));
UPline = data1(EnvelopeUp(Period, Percent1));
Dnline = data1(EnvelopeDown(Period, Percent2));
S1 = data1(CSar(af,maxAF));
S2 = data2(CSar(af,maxAF));
if data1(crossup(c,S1)) Then
T = 1;
if data1(CrossDown(c,S1)) Then
T = -1;
if T == 1 and data1(C>upline and V >= P1 and c > dayopen) and data2(C > S2) Then
{
T = 3;
buy("매수",AtLimit,C-PriceScale*음봉틱수1);
}
if T == -1 and data1(C<dnline and V >= P2 and c < dayopen ) and data2(C < S2) Then
{
T = -3;
sell("매도",AtLimit,C+PriceScale*음봉틱수2);
}
if MarketPosition == 1 then
{
ExitLong("즉시익절1",AtLimit,EntryPrice+PriceScale*즉시익절1);
if BarsSinceEntry >= M1 and c[1]>c[2] Then
ExitLong("봉완성익절1",AtLimit,C+PriceScale*청산양봉틱수1);
ExitLong("즉시손절1",AtStop,EntryPrice-PriceScale*즉시손절1);
if c <= EntryPrice-PriceScale*봉완성손절1 Then
ExitLong("봉완성손절1");
}
if MarketPosition == -1 then
{
ExitShort("즉시익절2",AtLimit,EntryPrice-PriceScale*즉시익절2);
if BarsSinceEntry >= M2 and c[1]<c[2] Then
ExitShort("봉완성익절2",AtLimit,C-PriceScale*청산양봉틱수2);
ExitShort("즉시손절2",AtStop,EntryPrice+PriceScale*즉시손절2);
if c >= EntryPrice+PriceScale*봉완성손절2 Then
ExitShort("봉완성손절2");
}
if bdate != bdate[1] Then
SetStopEndofday(0);
if sdate != sdate[1] and DayOfWeek(sdate) == 6 Then
SetStopEndofday(050000);
다음글