답변완료
문의드립니다
항상 감사드립니다~~
6분봉과 30분봉, 매수 매도 신호가 나오도록 해주세요.
1. 10번째 이전 캔들의 고가를 돌파할때 매수 신호, 저가를 깰때 매도 신호가 나오도록 해주세요. 종가가 아닌 돌파나 깰때 바로 나오도록 해주세요.
2. 현재 캔들에서 10번째 이전 캔들의 고가를 돌파하거나 저가를 깨는 일이 같이 일어날 때는 일어나는 그 시각에 해당되는 매수, 매도 신호가 나오도록 해주세요.
3. 10번째 이전 캔들의 고가 위에서 현재 캔들이 앞 캔들의 고가를 높이는 경우, 매수 신호가 나오도록 해주세요.
4. 10번째 이전 캔들의 저가 아래에서 현재 캔들이 앞 캔들의 저가를 깨는 경우 매도 신호가 나오도록 해주세요.
5. 6분봉과 30분봉이 같은 방향으로 신호가 있을 때만 그 방향으로 매수, 매도 진입하도록 해주세요.
4. 같은 방향의 신호가 있을 시 6분봉의 종가에 매수, 매도 진입합니다.
5. 같은 방향으로 진입신호가 나왔어도 아래의 경우 진입하지 않게 해주세요.
- 앞캔들의 고가를 높이거나 저가를 깨거나 하지 않고 끝난 캔들.
- 매수는 양봉 종가에만, 매도는 음봉 종가에만 진입하도록 해주세요.
6.진입한 후 익절, 손절 청산 후에 6분과 30분봉에 같은 방향 신호가 있으면 같은 조건으로 계속 거래되도록 해주세요.
아래 수식에서 수정 부탁드립니다
감사합니다~~^^
input : ntime1(6),ntime2(30),n(10);
input : StartTime(222500),EndTime(010000);
input : 익절틱수(50),손절틱수(50);
var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0);
Array : H1[50](0),L1[50](0),H2[50](0),L2[50](0);
var : Tcond(false);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
Tcond = true;
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF1 = TM%ntime1;
TF2 = TM%ntime2;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and ntime1 > 1 and TM >= TM[1]+ntime1) or
(Bdate == Bdate[1] and ntime1 == 1 and TM > TM[1]) Then
{
H1[0] = H;
L1[0] = L;
For cnt = 1 to 49
{
H1[cnt] = H1[cnt-1][1];
L1[cnt] = L1[cnt-1][1];
}
}
if H1[0] > 0 and H > H1[0] Then
H1[0] = H;
if L1[0] > 0 and L < L1[0] Then
L1[0] = L;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime2 > 1 and TF2 < TF2[1]) or
(Bdate == Bdate[1] and ntime2 > 1 and TM >= TM[1]+ntime2) or
(Bdate == Bdate[1] and ntime2 == 1 and TM > TM[1]) Then
{
H2[0] = H;
L2[0] = L;
For cnt = 1 to 49
{
H2[cnt] = H2[cnt-1][1];
L2[cnt] = L2[cnt-1][1];
}
}
if H2[0] > 0 and H > H2[0] Then
H2[0] = H;
if L2[0] > 0 and L < L2[0] Then
L2[0] = L;
if Tcond == true Then
{
if H1[n] > 0 and H2[n] > 0 and C > H1[n] and C > H2[n] and C > O Then
Buy();
if L1[n] > 0 and L2[n] > 0 and C < L1[n] and C < L2[n] and C < O Then
Sell();
if MarketPosition == 1 Then
ExitLong("bx",AtStop,L-PriceScale*1);
if MarketPosition == -1 Then
ExitShort("sx",AtStop,H+PriceScale*1);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
2021-10-23
919
글번호 153101
시스템
답변완료
수식 수정 의뢰드립니다!
안녕하세요!
아래 수식에 오타가 있는지 검증에서 에러가 발생을 합니다!
확인 좀 부탁드릴께요!
감사합니다!
Input:length(10);
Var:lastHi(0),lastLo(0),lastVertex(""),procBit(""),
sBar(0),TL1(0),TL2(0),TL3(0),
hiTLSlope(0),hiTLBeginBar(0),hiTLBeginVal(0),hiTLEndVal(0),
loTLSlope(0),loTLBeginBar(0),loTLBeginVal(0),loTLEndVal(0);
//ssssssssssssssssssssssssssssssssss
Var:hiTLBeginBN(0),loTLBeginBN(0);
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Var:PK1(0),PK2(0),PK3(0),PK4(0),PK5(0),PK6(0),PK7(0),PK8(0),PK9(0),PK10(0),
VL1(0),VL2(0),VL3(0),VL4(0),VL5(0),VL6(0),VL7(0),VL8(0),VL9(0),VL10(0),
pkBN1(0),pkBN2(0),pkBN3(0),pkBN4(0),pkBN5(0),
pkBN6(0),pkBN7(0),pkBN8(0),pkBN9(0),pkBN10(0),
vlBN1(0),vlBN2(0),vlBN3(0),vlBN4(0),vlBN5(0),
vlBN6(0),vlBN7(0),vlBN8(0),vlBN9(0),vlBN10(0);
//==========================================
Condition1 = Highest(H,length) = H and lastHi <> H;
Condition2 = Lowest (L,length) = L and lastLo <> L;
procBit = "";
If Condition1 and Condition2 Then Begin
If lastVertex = "Valley" Then Begin
If VL1 > L Then procBit = "Valley"
Else procBit = "Peak";
End
Else If lastVertex = "Peak" Then Begin
If PK1 < H Then procBit = "Peak"
Else procBit = "Valley";
End;
End
Else If Condition1 Then procBit = "Peak"
Else If Condition2 Then procBit = "Valley";
//==========================================
If procBit = "Peak" Then Begin
lastHi = H;
If lastVertex = "Valley" Then Begin
PK9 = PK8; pkBN9 = pkBN8;
PK8 = PK7; pkBN8 = pkBN7;
PK7 = PK6; pkBN7 = pkBN6;
PK6 = PK5; pkBN6 = pkBN5;
PK5 = PK4; pkBN5 = pkBN4;
PK4 = PK3; pkBN4 = pkBN3;
PK3 = PK2; pkBN3 = pkBN2;
PK2 = PK1; pkBN2 = pkBN1;
PK1 = H; pkBN1 = BarNumber;
sBar = BarNumber - vlBN1;
TL1 = TL_New(Date[sBar],Time[sBar],VL1,Date,Time,PK1);
TL_SetSize(TL1,2);
TL_SetColor(TL1,GREEN);
End
Else If PK1 < H Then Begin
PK1 = H; pkBN1 = BarNumber;
TL_SetEnd(TL1,Date,Time,PK1);
End ;
{ High Trend Line }
//ssssssssssssssssssssssssssssssssss
// 이전 단계에서는 1번 고점만 변경되어도 아래 루틴을 탔는데
// 2번 고점이 변경되지 않았으면 불필요한 계산이므로
// 2번 고점이 바뀌었을 때만 아래 루틴을 수행하도록 조건을 추가
// price는 동일 값이 나올 수 있어 비교할 수 없으나 BarNumber는 유일한 값이므로 비교 가능하다
If pkBN2[1] <> pkBN2 Then Begin
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
hiTLEndVal = 0; hiTLSlope = 0; hiTLBeginVal = 0; hiTLBeginBar = 0;
If PK2 < PK3 Then Begin
hiTLSlope = (PK2 - PK3)/(pkBN2 - pkBN3);
hiTLBeginVal = PK3;
//ssssssssssssssssssssssssssssssssss
// 2번 고점이 바뀌지 않았다면 y 절편과 기울기는 그대로이고 거리에 해당하는 hiTLBeginBar 값에 변동이 있다.
// 2번 고점이 변경되지 않았을 때의 hiTLBeginBar를 계산하려면 시작점의 BarNumber를 알면 되므로
// 새로 추가한 hiTLBeginBN 변수에 고점의 BarNumber를 넘겨준다.
hiTLBeginBN = pkBN3;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If PK2 < PK4 Then Begin
hiTLSlope = (PK2 - PK4)/(pkBN2 - pkBN4);
hiTLBeginVal = PK4;
//ssssssssssssssssssssssssssssssssss
hiTLBeginBN = pkBN4;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If PK2 < PK5 Then Begin
hiTLSlope = (PK2 - PK5)/(pkBN2 - pkBN5);
hiTLBeginVal = PK5;
//ssssssssssssssssssssssssssssssssss
hiTLBeginBN = pkBN5;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If PK2 < PK6 Then Begin
hiTLSlope = (PK2 - PK6)/(pkBN2 - pkBN6);
hiTLBeginVal = PK6;
//ssssssssssssssssssssssssssssssssss
hiTLBeginBN = pkBN6;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If PK2 < PK7 Then Begin
hiTLSlope = (PK2 - PK7)/(pkBN2 - pkBN7);
hiTLBeginVal = PK7;
//ssssssssssssssssssssssssssssssssss
hiTLBeginBN = pkBN7;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If PK2 < PK8 Then Begin
hiTLSlope = (PK2 - PK8)/(pkBN2 - pkBN8);
hiTLBeginVal = PK8;
//ssssssssssssssssssssssssssssssssss
hiTLBeginBN = pkBN8;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If PK2 < PK9 Then Begin
hiTLSlope = (PK2 - PK9)/(pkBN2 - pkBN9);
hiTLBeginVal = PK9;
//ssssssssssssssssssssssssssssssssss
hiTLBeginBN = pkBN9;
End ;
hiTLBeginBar = BarNumber - hiTLBeginBN;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
hiTLEndVal = hiTLSlope * hiTLBeginBar + hiTLBeginVal;
If hiTLEndVal > 0 Then Begin
TL2 = TL_New(Date[hiTLBeginBar],Time[hiTLBeginBar],hiTLBeginVal,Date,Time,hiTLEndVal);
TL_SetSize(TL2,1);
TL_SetColor(TL2,RED);
End ;
End
//ssssssssssssssssssssssssssssssssss
// 2번 고점이 변경되지 않았으나 고추세선의 값이 살아있다면(0으로 초기화되지 않았다면)
Else If hiTLEndVal[1] > 0 Then Begin
// 거리 = 현재 봉의 BarNumber - 시작점의 BarNumber
hiTLEndVal = hiTLSlope * (BarNumber - hiTLBeginBN) + hiTLBeginVal;
TL_SetEnd(TL2,Date,Time,hiTLEndVal);
End ;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
lastVertex = "Peak";
End ;
//==========================================
If procBit = "Valley" Then Begin
lastLo = L;
If lastVertex = "Peak" then Begin
VL9 = VL8; vlBN9 = vlBN8;
VL8 = VL7; vlBN8 = vlBN7;
VL7 = VL6; vlBN7 = vlBN6;
VL6 = VL5; vlBN6 = vlBN5;
VL5 = VL4; vlBN5 = vlBN4;
VL4 = VL3; vlBN4 = vlBN3;
VL3 = VL2; vlBN3 = vlBN2;
VL2 = VL1; vlBN2 = vlBN1;
VL1 = L; vlBN1 = BarNumber;
sBar = BarNumber - pkBN1;
TL1 = TL_New(Date[sBar],Time[sBar],PK1,Date,Time,VL1);
TL_SetSize(TL1,2);
TL_SetColor(TL1,GREEN);
End
Else If VL1 > L then Begin
VL1 = L; vlBN1 = BarNumber;
TL_SetEnd(TL1,Date,Time,VL1);
End ;
{ Low Trend Line }
//ssssssssssssssssssssssssssssssssss
If vlBN2[1] <> vlBN2 Then Begin
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
loTLEndVal = 0; loTLSlope = 0; loTLBeginVal = 0; loTLBeginBar = 0;
If VL2 > VL3 and VL3 > 0 Then Begin
loTLSlope = (VL2 - VL3)/(vlBN2 - vlBN3);
loTLBeginVal = VL3;
//ssssssssssssssssssssssssssssssssss
loTLBeginBN = vlBN3;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If VL2 > VL4 and VL4 > 0 Then Begin
loTLSlope = (VL2 - VL4)/(vlBN2 - vlBN4);
loTLBeginVal = VL4;
//ssssssssssssssssssssssssssssssssss
loTLBeginBN = vlBN4;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If VL2 > VL5 and VL5 > 0 Then Begin
loTLSlope = (VL2 - VL5)/(vlBN2 - vlBN5);
loTLBeginVal = VL5;
//ssssssssssssssssssssssssssssssssss
loTLBeginBN = vlBN5;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If VL2 > VL6 and VL6 > 0 Then Begin
loTLSlope = (VL2 - VL6)/(vlBN2 - vlBN6);
loTLBeginVal = VL6;
//ssssssssssssssssssssssssssssssssss
loTLBeginBN = vlBN6;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If VL2 > VL7 and VL7 > 0 Then Begin
loTLSlope = (VL2 - VL7)/(vlBN2 - vlBN7);
loTLBeginVal = VL7;
//ssssssssssssssssssssssssssssssssss
loTLBeginBN = vlBN7;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If VL2 > VL8 and VL8 > 0 Then Begin
loTLSlope = (VL2 - VL8)/(vlBN2 - vlBN8);
loTLBeginVal = VL8;
//ssssssssssssssssssssssssssssssssss
loTLBeginBN = vlBN8;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
End
Else If VL2 > VL9 and VL9 > 0 Then Begin
loTLSlope = (VL2 - VL9)/(vlBN2 - vlBN9);
loTLBeginVal = VL9;
//ssssssssssssssssssssssssssssssssss
loTLBeginBN = vlBN9;
End ;
loTLBeginBar = BarNumber - loTLBeginBN;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
loTLEndVal = loTLSlope * loTLBeginBar + loTLBeginVal;
If loTLEndVal > 0 Then Begin
TL3 = TL_New(Date[loTLBeginBar],Time[loTLBeginBar],loTLBeginVal,Date,Time,loTLEndVal);
TL_SetSize(TL3,1);
TL_SetColor(TL3,BLUE);
End ;
End
//ssssssssssssssssssssssssssssssssss
Else If loTLEndVal[1] > 0 Then Begin
loTLEndVal = loTLSlope * (BarNumber - loTLBeginBN) + loTLBeginVal;
TL_SetEnd(TL3,Date,Time,loTLEndVal);
End ;
//eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
lastVertex = "Valley";
End ;
2021-10-23
540
글번호 153099
지표