답변완료
수식 검토 부탁합니다.
항상 도와주셔서 감사합니다.
아래와 같이 수식을 작성해서 검증을 했는데 매수 매도가 안되는데 왜 그런지 모르겠습니다.
검토 부탁 드립니다.
input : StartTime(080000),EndTime(053000);
input : N(60);
input : 익절틱수(160),손절틱수(80);
var : HH(0),LL(0),PH(0),NL(0),S1(0),D1(0),count1(0),count2(0),Tcond(False),entry(0);
var : BXcond(False),SXcond(False);
var : cnt(0),bloss(0),sloss(0);
HH = highest(H,N);
LL = lowest(N,H);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else//
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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 Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
Condition3 = False;
entry = 0;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
bloss = 0;
sloss = 0;
for cnt = 1 to 3
{
if MarketPosition(cnt) == 1 and IsExitName("StopLoss",cnt) == true Then
bloss = bloss+1;
if MarketPosition(cnt) == -1 and IsExitName("StopLoss",cnt) == true Then
sloss = sloss+1;
}
BXcond = MarketPosition == 0 and (bloss == 3 or (bloss < 3 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true and C >= ExitPrice(1)));
SXcond = MarketPosition == 0 and (sloss == 3 or (sloss < 3 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true and C <= ExitPrice(1)));
#N봉 신저가발생
if L < LL[1] Then
{
Condition1 = true;
#파동카운트 0으로 초기화
count1 = 0;
#양음봉 고가 저장변수 초기화
PH = 0;
}
Else
{
#직전 고점보다 큰 양봉다음음봉 발생
if Condition1 == true and C[1] > O[1] and C < O and
(PH == 0 or (PH > 0 and H[1] > PH)) Then
{
#양봉고가 저장
PH = H[1];
#카운트
count1 = count1+1;
#6번째 매도진입
if count1 == 6 and SXcond == true Then
Sell();
}
}
#N봉 신고가발생
if H > HH[1] Then
{
Condition2 = true;
#파동카운트 0으로 초기화
count2 = 0;
#양음봉 고가 저장변수 초기화
NL = 0;
}
Else
{
#지전고점보다 큰 양봉다음음봉 발생
if Condition2 == true and C[1] < O[1] and C > O and
(NL == 0 or (NL > 0 and L[1] < NL)) Then
{
#음봉저가 저장
NL = L[1];
#카운트
count2 = count2+1;
#6번째 매수진입
if count2 == 6 and BXcond == False Then
Buy();
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
if MarketPosition == 0 and
TotalTrades> TotalTrades[1] and
IsExitName("StopProfitTarget",1) == true Then
{
if MarketPosition(1) == 1 Then
Buy("b",AtMarket);
if MarketPosition(1) == -1 Then
Sell("s",AtMarket);
}
2023-02-03
1045
글번호 165975
시스템
답변완료
호가잔량고저라인기준 상승하락지표식
안녕하세요
아래수식은 지수의 2가지이평선을 기준으로 고저라인기준 움직임을 표현한 수식인데
이수식을 호가잔량 수식으로 변경 부탁드립니다
즉 호가잔량의 최고라인이 형성되면 일직선이 되면서 그 밑으로 호가잔량이 하락, 반대로 호가잔량의 최저라인이 형성되면 일직선이 되면서 그 위로 호가잔량이 상승되는 표현이 되도록 부탁드립니다
Inputs:Period1(1);
Inputs:라인굵기(0),이평라인굵기(0);
Inputs:단기(5),중기(20);
Var:TLen1(0),TRIma1(0),Highestsince(0),Lowestsince(0);
TLen1 = Ceiling((Period1 + 1) * .5);
TRIma1 =Ema(Ema(C, TLen1), TLen1);
Var1 = ma(Close,단기)[1];
Var2 = ma(Close,중기)[1];
var5 = bids-asks;#잔량차(매수호가잔량-매도호가잔량)
If CrossUp(Var1,Var2) Then
Highestsince = Var2;
If Var2 > Highestsince Then
Highestsince = Var2;
If CrossDown(Var1,Var2) Then
Lowestsince = Var2;
If Var2 < Lowestsince Then
Lowestsince = Var2;
Plot1(Highestsince,"상단",BLACK,DEF,라인굵기);
Plot2(Lowestsince,"하단",WHITE,DEF,라인굵기);
If Var2 > Var2[1] Then
Plot3(Var2,"상하구분",RED,DEF,이평라인굵기);
Else
Plot3(Var2,"상하구분",BLUE,DEF,이평라인굵기);
If TRIma1 > TRIma1[1] Then
Plot10(TRIma1,"1일자",RED,DEF,1);
Else
Plot10(TRIma1,"1일자",BLUE,DEF,1);
2023-02-02
825
글번호 165966
지표
답변완료
수식요청합니다.
상승 추세선 변곡점에 수평선 요청합니다.(최종 변곡점에만 )
Input:전환비율(5);
Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""),TL1(0),Text1(0),ADXV1(0);
Array:고[10,4](0),저[10,4](0);
HH=H;
LL=L;
If Index==0 Then
{
고[1,1]=HH;
고[1,2]=0;
고[1,3]=sDate;
고[1,4]=sTime;
저[1,1]=LL;
저[1,2]=0;
저[1,3]=sDate;
저[1,4]=sTime;
}
If Index>0 Then
{
hiBar=hiBar+1;
loBar=loBar+1;
}
If HH[hiBar]<HH Then hiBar=0;
If LL[loBar]>LL Then loBar=0;
Condition1=저[1,1]*(1+(전환비율/100))<HH and hiBar==0;
Condition2=고[1,1]*(1-(전환비율/100))>LL and loBar==0;
처리구분="";
If Condition1 and Condition2 Then//고점과저점조건동시만족
{
If 최종꼭지점=="저점" Then
{
If 저[1,1]>LL Then 처리구분="저점처리";
Else 처리구분="고점처리";
}
Else If 최종꼭지점=="고점" Then
{
If 고[1,1]<HH Then 처리구분="고점처리";
Else 처리구분="저점처리";
}
}
Else If Condition1 Then 처리구분="고점처리";
Else If Condition2 Then 처리구분="저점처리";
If 처리구분=="고점처리" Then
{
If 최종꼭지점=="저점" Then
{
For j=10 DownTo 2
{
For jj=1 To 4
{
고[j,jj]=고[j-1,jj];
}
}
고[1,1]=HH[hiBar];
고[1,2]=Index-hiBar;
고[1,3]=sDate[hiBar];
고[1,4]=sTime[hiBar];
hiBar=-1;
loBar=-1;
TL1=TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
TL_SetSize(TL1,1);
TL_SetColor(TL1,RED);
}
Else If 고[1,1]<HH[hiBar] Then//1번고점보다높은고가출현
{
고[1,1]=HH[hiBar];
고[1,2]=Index-hiBar;
고[1,3]=sDate[hiBar];
고[1,4]=sTime[hiBar];
hiBar=-1;
loBar=-1;
TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]);
}
최종꼭지점="고점";
}
If 처리구분=="저점처리" Then
{
If 최종꼭지점=="고점" Then
{
For j=10 DownTo 2
{
For jj=1 To 4
{ 
저[j,jj]=저[j-1,jj];
}
}
저[1,1]=LL[loBar];
저[1,2]=Index-loBar;
저[1,3]=sDate[loBar];
저[1,4]=sTime[loBar];
hiBar=-1;
loBar=-1;
TL1=TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
TL_SetSize(TL1,1);
TL_SetColor(TL1,BLUE);
}
Else If 저[1,1]>LL[loBar] Then
{
저[1,1]=LL[loBar];
저[1,2]=Index-loBar;
저[1,3]=sDate[loBar];
저[1,4]=sTime[loBar];
hiBar=-1;
loBar=-1;
TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]);
}
최종꼭지점="저점";
}
2023-02-02
1080
글번호 165964
지표