커뮤니티
확인부탁드립니다.
2017-09-26 16:26:42
172
글번호 113112
확인좀 부탁드립니다.
아래 청산식에서 파라볼릭 Crossup, down 시 실제매매에서 청산 신호는 발생하지만 실제로는 청산이 되지 않고 있습니다. 확인 부탁드립니다.
(틱 차트를 사용중이며, 프로그램을 끄고 다시 켜면 파라볼릭 신호에 의해 청산된 것으로 나옵니다.)
input : short(12),long(26),sig(9),P1(3),P2(30),P3(120);
input : af(0.02),maxaf(0.2);
input : 시작시간(110000), 종료시간(170000);
input : 진입회수(1);
var : mav1(0,data1),mav2(0,data1),mav3(0,data1);
var : Tcond(False,data1),Bcount(0,data1),Scount(0,data1);
var : MACDO2(0,data2), MACDO1(0,data1);
var : BH(0),SL(0);
var : para(0);
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO1 = data1(MACD_OSC(short,long,sig));
mav1 = data1(ma(c,P1));
mav2 = data1(ma(c,P2));
mav3 = data1(ma(c,P3));
para = sar(af,maxaf);
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Bcount = 0;
Scount = 0;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
//진입회수
if MarketPosition != MarketPosition[1] and MarketPosition == 1 Then
Bcount = Bcount+1;
if MarketPosition != MarketPosition[1] and MarketPosition == -1 Then
Scount = Scount+1;
//진입
if Tcond == true Then{
if Bcount < 진입회수 and Crossup(mav2,mav3) Then buy("Buy");
if Scount < 진입회수 and CrossDown(mav2,mav3) Then sell("Sell");
}
//청산1
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if BH >= EntryPrice+PriceScale*70 and BH < EntryPrice+PriceScale*80 Then
ExitLong("B익절1",AtStop,BH-PriceScale*70);
if BH >= EntryPrice+PriceScale*80 and CrossDown(C,para) Then
ExitLong("B익절Pa");
ExitLong("B손절",AtStop,EntryPrice-PriceScale*60);
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if SL <= EntryPrice-PriceScale*70 and SL > EntryPrice-PriceScale*80 Then
ExitShort("S익절1",AtStop,SL+PriceScale*70);
if SL <= EntryPrice-PriceScale*80 and CrossUp(C,para) Then
ExitShort("S익절Pa");
ExitShort("S손절",AtStop,EntryPrice+PriceScale*60);
}
if 종료시간 <= sTime or sTime < 시작시간 then {
if MarketPosition == 1 then{
ExitLong("B장종료");
}
if MarketPosition == -1 then{
ExitShort("S장종료");
}
}
답변 1
예스스탁 예스스탁 답변
2017-09-27 13:21:03
안녕하세요
예스스탁입니다.
수식에 참조데이터가 사용되면
사용하는 변수를 선언할때도 데이터 번호르 지정해 주셔야 하며
계산식이나 함수도 데이터 번호로 묶어 어떤 데이터 기준인지 지정하셔야 합니다.
input : short(12),long(26),sig(9),P1(3),P2(30),P3(120);
input : af(0.02),maxaf(0.2);
input : 시작시간(110000), 종료시간(170000);
input : 진입회수(1);
var : mav1(0,data1),mav2(0,data1),mav3(0,data1);
var : Tcond(False,data1),Bcount(0,data1),Scount(0,data1);
var : MACDO2(0,data2), MACDO1(0,data1);
var : BH(0,data1),SL(0,data1);
var : para(0,data1);
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO1 = data1(MACD_OSC(short,long,sig));
mav1 = data1(ma(c,P1));
mav2 = data1(ma(c,P2));
mav3 = data1(ma(c,P3));
para = data1(sar(af,maxaf));
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Bcount = 0;
Scount = 0;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
//진입회수
if MarketPosition != MarketPosition[1] and MarketPosition == 1 Then
Bcount = Bcount+1;
if MarketPosition != MarketPosition[1] and MarketPosition == -1 Then
Scount = Scount+1;
//진입
if Tcond == true Then{
if Bcount < 진입회수 and Crossup(mav2,mav3) Then buy("Buy");
if Scount < 진입회수 and CrossDown(mav2,mav3) Then sell("Sell");
}
//청산1
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if BH >= EntryPrice+PriceScale*70 and BH < EntryPrice+PriceScale*80 Then
ExitLong("B익절1",AtStop,BH-PriceScale*70);
if BH >= EntryPrice+PriceScale*80 and CrossDown(C,para) Then
ExitLong("B익절Pa");
ExitLong("B손절",AtStop,EntryPrice-PriceScale*60);
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if SL <= EntryPrice-PriceScale*70 and SL > EntryPrice-PriceScale*80 Then
ExitShort("S익절1",AtStop,SL+PriceScale*70);
if SL <= EntryPrice-PriceScale*80 and CrossUp(C,para) Then
ExitShort("S익절Pa");
ExitShort("S손절",AtStop,EntryPrice+PriceScale*60);
}
if 종료시간 <= sTime or sTime < 시작시간 then {
if MarketPosition == 1 then{
ExitLong("B장종료");
}
if MarketPosition == -1 then{
ExitShort("S장종료");
}
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 확인부탁드립니다.
> 확인좀 부탁드립니다.
아래 청산식에서 파라볼릭 Crossup, down 시 실제매매에서 청산 신호는 발생하지만 실제로는 청산이 되지 않고 있습니다. 확인 부탁드립니다.
(틱 차트를 사용중이며, 프로그램을 끄고 다시 켜면 파라볼릭 신호에 의해 청산된 것으로 나옵니다.)
input : short(12),long(26),sig(9),P1(3),P2(30),P3(120);
input : af(0.02),maxaf(0.2);
input : 시작시간(110000), 종료시간(170000);
input : 진입회수(1);
var : mav1(0,data1),mav2(0,data1),mav3(0,data1);
var : Tcond(False,data1),Bcount(0,data1),Scount(0,data1);
var : MACDO2(0,data2), MACDO1(0,data1);
var : BH(0),SL(0);
var : para(0);
MACDO2 = data2(MACD_OSC(short,long,sig));
MACDO1 = data1(MACD_OSC(short,long,sig));
mav1 = data1(ma(c,P1));
mav2 = data1(ma(c,P2));
mav3 = data1(ma(c,P3));
para = sar(af,maxaf);
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Bcount = 0;
Scount = 0;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
//진입회수
if MarketPosition != MarketPosition[1] and MarketPosition == 1 Then
Bcount = Bcount+1;
if MarketPosition != MarketPosition[1] and MarketPosition == -1 Then
Scount = Scount+1;
//진입
if Tcond == true Then{
if Bcount < 진입회수 and Crossup(mav2,mav3) Then buy("Buy");
if Scount < 진입회수 and CrossDown(mav2,mav3) Then sell("Sell");
}
//청산1
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if BH >= EntryPrice+PriceScale*70 and BH < EntryPrice+PriceScale*80 Then
ExitLong("B익절1",AtStop,BH-PriceScale*70);
if BH >= EntryPrice+PriceScale*80 and CrossDown(C,para) Then
ExitLong("B익절Pa");
ExitLong("B손절",AtStop,EntryPrice-PriceScale*60);
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if SL <= EntryPrice-PriceScale*70 and SL > EntryPrice-PriceScale*80 Then
ExitShort("S익절1",AtStop,SL+PriceScale*70);
if SL <= EntryPrice-PriceScale*80 and CrossUp(C,para) Then
ExitShort("S익절Pa");
ExitShort("S손절",AtStop,EntryPrice+PriceScale*60);
}
if 종료시간 <= sTime or sTime < 시작시간 then {
if MarketPosition == 1 then{
ExitLong("B장종료");
}
if MarketPosition == -1 then{
ExitShort("S장종료");
}
}
다음글
이전글