커뮤니티
수식부탁드립니다.
2017-04-27 01:26:59
204
글번호 109187
수식감사합니다. 다음 조건을 추가하고 싶습니다.
아래식에서 1,2번 조건을 추가하고 싶습니다.
1. 진입(기존식에 포함)
매수조건 추가: 5일선이 50일선 위에에 있을때
매도조건 추가: 5일선이 50일선 아래에 있을때
매수조건 만족시 -3틱 아래로 가면 매수, 매도조건에서 +3틱 위로 가면 매도
2. 청산(기존식에 포함)
진입 시 손절: 진입가 -10틱
10틱~14틱 상승시 익절: 진입가 +5틱
15틱~19틱 상승시 익절: 진입가 +10틱
20틱 이상상승 시 익절: 최고값 대비 -5틱 시 청산
3.신규식입니다 (기존식에포함안함)
5일선이 20시부터 05시 사이
시작가를 크로스업 한후 다시 클로스다운하면 매도
시작가를 크로스다운 한후 다시 크로스업하면 매수
예스스탁입니다.
data1의 오실레이터조건과 이평조건이 동시만족할때 진입하는 내용이므로
아래와 같이 작성하시면 됩니다.
input : short(12),long(26),sig(9),P1(10),P2(20);
var : MACDO1(0,data1),MACDO2(0,data2),MACDO3(0,data3);
var : mav11(0,data1),mav12(0,data1),Bcond(false,data1),Scond(false,data1);
MACDO1 = data1(MACD_OSC(short,long,sig));
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO3 = data3(MACD_OSC(short,long,sig));
mav11 = data1(ma(c,P1));
mav12 = data1(ma(c,P2));
Bcond = MACDO1 > 0 and mav11 > mav12;
Scond = MACDO1 < 0 and mav11 < mav12;
if MACDO3 > 0 and MACDO2 > 0 and Bcond == true and Bcond[1] == false then
buy("b1");
if MACDO3 < 0 and MACDO2 < 0 and Scond == true and Scond[1] == false then
sell("s1");
즐거운 하루되세요
> 바바큰 님이 쓴 글입니다.
> 제목 : 수식문의드립니다.
> 수식문의 드립니다. 감사합니다.
#진입(Data1,2,3 조건)
1.
Data3 의 MACD Oscillator 값이 >0 이고
Data2 의 MACD Oscillator 값이 >0 이고
Data1 의 MACD Oscillator 값이 Crossup 하고 10일선이 20일선을 Crossup하면 매수
(MACD Oscillator 값이 +인상태에서 10일선이 20일선을 Crossup 하면 매수)
2.
Data3 의 MACD Oscillator 값이 >0 이고
Data2 의 MACD Oscillator 값이 >0 이고
Data1 의 10일선이 20일선을 Crossup하고 MACD Oscillator 값이 Crossup 하면 매수
(10일>20일인 상태에서 MACD Oscillator 값이 +로 Crossup 하면 매수)
(1,2 매수가 같은 조건인지도 모르겠네요..)
3.
Data3 의 MACD Oscillator 값이 <0 이고
Data2 의 MACD Oscillator 값이 <0 이고
Data1 의 MACD Oscillator 값이 Crossdown 하고 10일선이 20일선을 Crossdown하면 매도
(MACD Oscillator 값이 -인상태에서 10일선이 20일선을 Crossdown 하면 매도)
4.
Data3 의 MACD Oscillator 값이 <0 이고
Data2 의 MACD Oscillator 값이 <0 이고
Data1 의 10일선이 20일선을 Crossdown하고 MACD Oscillator 값이 Crossdown 하면 매도
(10일<20일인 상태에서 MACD Oscillator 값이 -로 Crossdown 하면 매수)
(3,4 매도가 같은 조건인지도 모르겠네요..)
답변 1
예스스탁 예스스탁 답변
2017-04-27 10:25:54
안녕하세요
예스스탁입니다.
1
input : short(12),long(26),sig(9),P1(10),P2(20);
var : MACDO1(0,data1),MACDO2(0,data2),MACDO3(0,data3);
var : mav11(0,data1),mav12(0,data1),Bcond(false,data1),Scond(false,data1);
var : T(0,data1),VV(0,data1),Bentry(false,data1),Sentry(false,data1);
var : HH(0,data1),LL(0,data1);
MACDO1 = data1(MACD_OSC(short,long,sig));
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO3 = data3(MACD_OSC(short,long,sig));
mav11 = data1(ma(c,P1));
mav12 = data1(ma(c,P2));
Bcond = MACDO1 > 0 and mav11 > mav12;
Scond = MACDO1 < 0 and mav11 < mav12;
if T <= 0 and MACDO3 > 0 and MACDO2 > 0 and Bcond == true and Bcond[1] == false then{
T = 1;
VV = C;
bentry = true;
}
if T >= 0 and MACDO3 < 0 and MACDO2 < 0 and Scond == true and Scond[1] == false then{
T = -1;
VV = C;
sentry = true;
}
if T == 1 and Bentry == true Then
buy("b",Atlimit,VV-PriceScale*5);
if T == -1 and Sentry == true Then
sell("s",Atlimit,VV-PriceScale*5);
if MarketPosition == 1 Then{
Bentry = false;
HH = data1(highest(H,BarsSinceEntry));
if HH < EntryPrice+PriceScale*10 Then
ExitLong("bx1",AtStop,EntryPrice-PriceScale*10);
if HH >= EntryPrice+PriceScale*10 and HH < EntryPrice+PriceScale*15 Then
ExitLong("bx2",AtStop,EntryPrice+PriceScale*1);
if HH >= EntryPrice+PriceScale*15 and HH < EntryPrice+PriceScale*20 Then
ExitLong("bx3",AtStop,EntryPrice+PriceScale*10);
if HH >= EntryPrice+PriceScale*20 Then
ExitLong("bx4",AtStop,HH-PriceScale*3);
}
if MarketPosition == -1 Then{
Sentry = false;
LL = data1(Lowest(L,BarsSinceEntry));
if LL > EntryPrice-PriceScale*10 Then
ExitShort("sx1",AtStop,EntryPrice+PriceScale*10);
if LL <= EntryPrice-PriceScale*10 and LL > EntryPrice-PriceScale*15 Then
ExitShort("sx2",AtStop,EntryPrice-PriceScale*1);
if LL <= EntryPrice-PriceScale*15 and LL > EntryPrice-PriceScale*20 Then
ExitShort("sx3",AtStop,EntryPrice-PriceScale*10);
if LL <= EntryPrice-PriceScale*20 Then
ExitShort("sx4",AtStop,LL+PriceScale*3);
}
2
var : Tcond(False),mav(0),O1(0),count(0);
mav = ma(C,5);
if stime == 200000 or (stime > 200000 and stime[1] < 200000) Then{
Tcond = true;
O1 = Open;
count = 0;
}
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then
Tcond = false;
if Tcond == true Then{
if crossup(mav,O1) Then{
count = count+1;
if count >= 2 Then
buy();
}
if CrossDown(mav,O1) Then{
count = count+1;
if count >= 2 Then
sell();
}
}
즐거운 하루되세요
> 바바큰 님이 쓴 글입니다.
> 제목 : 수식부탁드립니다.
> 수식감사합니다. 다음 조건을 추가하고 싶습니다.
아래식에서 1,2번 조건을 추가하고 싶습니다.
1. 진입(기존식에 포함)
매수조건 추가: 5일선이 50일선 위에에 있을때
매도조건 추가: 5일선이 50일선 아래에 있을때
매수조건 만족시 -3틱 아래로 가면 매수, 매도조건에서 +3틱 위로 가면 매도
2. 청산(기존식에 포함)
진입 시 손절: 진입가 -10틱
10틱~14틱 상승시 익절: 진입가 +5틱
15틱~19틱 상승시 익절: 진입가 +10틱
20틱 이상상승 시 익절: 최고값 대비 -5틱 시 청산
3.신규식입니다 (기존식에포함안함)
5일선이 20시부터 05시 사이
시작가를 크로스업 한후 다시 클로스다운하면 매도
시작가를 크로스다운 한후 다시 크로스업하면 매수
예스스탁입니다.
data1의 오실레이터조건과 이평조건이 동시만족할때 진입하는 내용이므로
아래와 같이 작성하시면 됩니다.
input : short(12),long(26),sig(9),P1(10),P2(20);
var : MACDO1(0,data1),MACDO2(0,data2),MACDO3(0,data3);
var : mav11(0,data1),mav12(0,data1),Bcond(false,data1),Scond(false,data1);
MACDO1 = data1(MACD_OSC(short,long,sig));
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO3 = data3(MACD_OSC(short,long,sig));
mav11 = data1(ma(c,P1));
mav12 = data1(ma(c,P2));
Bcond = MACDO1 > 0 and mav11 > mav12;
Scond = MACDO1 < 0 and mav11 < mav12;
if MACDO3 > 0 and MACDO2 > 0 and Bcond == true and Bcond[1] == false then
buy("b1");
if MACDO3 < 0 and MACDO2 < 0 and Scond == true and Scond[1] == false then
sell("s1");
즐거운 하루되세요
> 바바큰 님이 쓴 글입니다.
> 제목 : 수식문의드립니다.
> 수식문의 드립니다. 감사합니다.
#진입(Data1,2,3 조건)
1.
Data3 의 MACD Oscillator 값이 >0 이고
Data2 의 MACD Oscillator 값이 >0 이고
Data1 의 MACD Oscillator 값이 Crossup 하고 10일선이 20일선을 Crossup하면 매수
(MACD Oscillator 값이 +인상태에서 10일선이 20일선을 Crossup 하면 매수)
2.
Data3 의 MACD Oscillator 값이 >0 이고
Data2 의 MACD Oscillator 값이 >0 이고
Data1 의 10일선이 20일선을 Crossup하고 MACD Oscillator 값이 Crossup 하면 매수
(10일>20일인 상태에서 MACD Oscillator 값이 +로 Crossup 하면 매수)
(1,2 매수가 같은 조건인지도 모르겠네요..)
3.
Data3 의 MACD Oscillator 값이 <0 이고
Data2 의 MACD Oscillator 값이 <0 이고
Data1 의 MACD Oscillator 값이 Crossdown 하고 10일선이 20일선을 Crossdown하면 매도
(MACD Oscillator 값이 -인상태에서 10일선이 20일선을 Crossdown 하면 매도)
4.
Data3 의 MACD Oscillator 값이 <0 이고
Data2 의 MACD Oscillator 값이 <0 이고
Data1 의 10일선이 20일선을 Crossdown하고 MACD Oscillator 값이 Crossdown 하면 매도
(10일<20일인 상태에서 MACD Oscillator 값이 -로 Crossdown 하면 매수)
(3,4 매도가 같은 조건인지도 모르겠네요..)
다음글