답변완료
수식 검토 부탁합니다.
해외 선물 거래
1. 시작시간:08:03 종료시간:익일 05:57
2. 시작시간 부터 거래를 하다가 당일 목표 수익이나 손실에 도달하면 더 이상 거래를 하지 않도록 하려고 수식을 작성 하였는데 목표 수익이나 손실에 도달하여도 거래가 계속 됩니다. 아래 수식 검토 부탁 드립니다.
==========================================================================
input : starttime(080300),Endtime(055700);
input : 타주기분(30),P(5),Period(5),period1(10),Period2(20);
input : 익절포인트수1(200),익절포인트수2(120),익절포인트수3(60),익절포인트수4(160),손절포인트수1(80),손절포인트수2(60),손절포인트수3(375),당일수익포인트수(950),당일손실포인트수(500);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),entry(0),bbup(0),bbdn(0),avgv1(0),avgv2(0);
var : sum1(0),mav1(0),sum2(0),mav2(0),sum3(0),mav3(0),avgv(0),Tcond(False),t(30),PROc(0);
Array : CC[100](0);
Input : af(0.02), maxAF(0.2);
Var : value(0),value1(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
value = sar(af,maxAF);
Input : shortPeriod(12), longPeriod(26);
value1 = MACD(shortPeriod, longPeriod);
INPUT : LENGTH(20);
VAR : TCHAN(0), BCHAN(0);
TCHAN = HIGHEST(HIGH, LENGTH)[1];
BCHAN = LOWEST(LOW, LENGTH)[1];
PROC = PROC(Period1);
avgv = ma(c,Period);
avgv1 =ma(c,Period1);
avgv2 =ma(c,Period2);
bbup = BollBandUp(20,2);
bbdn = BollBandDown(20,2);
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
entry = 0;
Condition3 = False;
}
{
if D1 > 0 then
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
for cnt = 1 to 99
{
CC[cnt] = CC[cnt-1][1];
}
}
CC[0] = C;
if CC[P+2] > 0 then
{
sum1 = 0;
sum2 = 0;
sum3 = 0;
for cnt = 0 to P-1
{
sum1 = sum1 + CC[cnt];
sum2 = sum2 + CC[cnt+1];
sum3 = sum3 + CC[cnt+2];
}
mav1 = sum1/P;
mav2 = sum2/P;
mav3 = sum3/P;
}
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
{
SetStopEndofday(0);
Tcond = true;
}
당일수익 = PriceScale*당일수익포인트수;
당일손실 = PriceScale*당일손실포인트수;
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
}
if Xcond == false and Tcond == true then
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then
{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
}
{
if MarketPosition >= 0 and mav1<mav2-2 and c>=avgv and !(avgv1[1]<avgv1 and avgv2[1]<avgv2 and avgv[1]<avgv)
and !(avgv>avgv1 and avgv1>avgv2)Then
{
#진입청산식1.
#진입청산식2
#진입청산식3
#
#
#진입청산식6
if sTime >= 080300 and sTime < 160000 Then
{
SetStopProfittarget(PriceScale*익절포인트수3,PointStop);
SetStopLoss(PriceScale*손절포인트수3,PointStop);
}
Else if sTime >= 200000 or sTime < 060000 Then
{
SetStopProfittarget(PriceScale*익절포인트수1,PointStop);
SetStopLoss(PriceScale*손절포인트수3,PointStop);
}
Else
{
SetStopProfittarget(PriceScale*익절포인트수2,PointStop);
SetStopLoss(PriceScale*손절포인트수3,PointStop);
}
}
}
2024-04-14
1140
글번호 178548
시스템
답변완료
종목검색부탁드립니다
5분봉 검색
가 =
대금S=sum(V*C);
VV=sum(V);
대금20=대금S-대금S(기간);
VV20=VV-VV(기간);
대금20/VV20;
기간 20
D1 2.0
나 =
(highest(high,shortPeriod)+lowest(low,shortPeriod))/2;
다 =
(highest(high,midPeriod)+lowest(low,midPeriod))/2;
(나,다)shortPeriod 9
midPeriod 26
longPeriod 52
CrossUP((나,다), 가)가를돌파한종목
[OR] //(그리고)
(나,다)라인이 (가)라인 위에 있는종목
[AND]
(나,다)라인이 > 가격이동평균(10, 20)
위조건을 만족한 종목 검색식과 ,위조건을 만족한 봉을 강조하고싶습니다 강조식도 부탁드립니다
강사합니다
고맙습니다
즐거운 하루 되세요
2024-04-14
978
글번호 178546
종목검색