답변완료
질문 드립니다.
아래와 같은 방법으로
c,c2,c3,c4 의 상수를 앞에 곱해야하는데,
방법 있을까요?
---------------------------
파이썬 예제
w1 = np.array([[ 7.6870495e-01, -4.5000097e-01, -5.0288552e-01, -5.8628911e-01,-7.8140247e-01],
[-2.2677729e-01, -1.3227734e-01, -1.6453594e-01, -4.4095448e-01,-6.2959242e-01],
[-3.9802355e-01, -1.3464031e-01, 3.8020921e-01, -1.3022888e-01,-7.7714334e-04],
[ 6.9682324e-01, 1.8243028e-01, 5.3357744e-01, 6.5138638e-01,-6.7072177e-01]])
b1 = np.array([ 0.00463578, 0.00594319, 0.00514426, -0.00606843, 0.00222296])
w2 = np.array([[ 0.5617929 , 0.33208025, 0.13907313, 0.47333008, -0.3797783 ,-0.28105068],
[ 0.33742946, 0.12592183, 0.01064893, 0.52772814, -0.6247222 ,0.69132566],
[ 0.14056782, 0.49507526, 0.4480095 , 0.68785197, -0.72289205,-0.6297876 ],
[ 0.19173265, 0.12094978, -0.4096364 , 0.03867307, 0.59292454,-0.12875453],
[-0.49488088, -0.08192482, 0.17502253, -0.05582228, -0.23403022,0.17012648]])
b2 = np.array([ 0.00170565, 0.0005993 , 0.00020622, 0.0013302 , -0.00105772,0.00132773])
w3 = np.array([[-0.22596964],
[-0.05365248],
[-0.14615695],
[ 0.32034966],
[-0.47812763],
[-0.11717749]])
b3 = np.array([-0.00013015])
# x = ([[c],[c2],[c3],[c4]])
# ((x(w1)+b1)w2+b2)w3+b3
# (xw1w2+b1w2+b2)w3+b3
# xw1w2w3 + b1w2w3 + b2w3 + b3
w = np.dot(np.dot(w1,w2),w3)
b = np.dot(np.dot(b1,w2),w3)+np.dot(b2,w3)+b3
print(w)
print(b)
x = np.dot(x,w)+b
2023-01-28
954
글번호 165787
시스템
답변완료
수식 문의드립니다
input : 시작시간(090000),종료시간(0);
input : Period1(1),Period2(2),Period3(3),Period4(4),Period5(5),Period6(6),Period7(7),Period8(8),Period9(9),Period10(10),Period11(11),Period12(12),Period15(15),Period20(20),Period25(25),Period30(30),Period35(35),Period40(40),Period52(52),Period70(70),Period80(80),
Period105(105),Period140(140),Period150(150),Period210(210),Period280(280),Period300(300),Period450(450),Period480(480),Period520(520),Period560(560),Period600(600),Period840(840),Period900(900),Period1120(1120),Period1200(1200),Period1800(1800),Period2400(2400),Period2800(2800),Period3000(3000),Period3600(3600),Period4800(4800),Period7200(7200),
Period58(58),Period60(60),Period62(62),Period82(82),Period84(84),Period28(70),Period31(11),Period32(24),Period33(5),
Period41(35),Period42(35),Period43(35),Period48(15),Period1001(850),Period1002(520),Period1003(480),Period1008(36),aa4(0.4),aa5(0.5),aa6(0.8),익절틱수s4(111),손절틱수s4(91);
var : mav1(0),mav2(0),mav3(0),mav4(0),mav5(0),mav6(0),mav7(0),mav8(0),mav9(0),mav10(0),mav11(0),mav12(0),mav15(0),mav20(0),mav25(0),mav30(0),mav35(0),mav40(0),mav52(0),mav70(0),mav80(0),mav105(0),mav140(0),mav150(0),mav210(0),mav280(0),mav300(0),mav450(0),mav480(0),mav520(0),mav560(0),mav600(0),
mav840(0),mav900(0),mav1120(0),mav1200(0),mav1800(0),mav2400(0),mav2800(0),mav3000(0),mav3600(0),mav4800(0),mav7200(0),
mav58(0),mav60(0),mav62(0),mav82(0),mav84(0),mav28(0),mav31(0),mav32(0),mav33(0),
mav41(0),mav42(0),mav43(0),mav48(0),mav1001(0),mav1002(0),mav1003(0),mav1008(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
var : T(0);
var : ii(0);
var : BE1(0),BE2(0),BE3(0),BE4(0),BE5(0);
var : SE1(0),SE2(0),SE3(0),SE4(0),SE5(0);
mav1 = ma(c, Period1);
mav2 = ma(c, Period2);
mav3 = ma(c, Period3);
mav4 = ma(c, Period4);
mav5 = ma(c, Period5);
mav6 = ma(c, Period6);
mav7 = ma(c, Period7);
mav8 = ma(c, Period8);
mav9 = ma(c, Period9);
mav10 = ma(c, Period10);
mav11 = ma(c, Period11);
mav12 = ma(c, Period12);
mav15 = ma(c, Period15);
mav20 = ma(c, Period20);
mav25 = ma(c, Period25);
mav30 = ma(c, Period30);
mav35 = ma(c, Period35);
mav40 = ma(c, Period40);
mav52 = ma(c, Period52);
mav70 = ma(c, Period70);
mav80 = ma(c, Period80);
mav105 = ma(c, Period105);
mav140 = ma(c, Period140);
mav150 = ma(c, Period150);
mav210 = ma(c, Period210);
mav280 = ma(c, Period280);
mav300 = ma(c, Period300);
mav450 = ma(c, Period450);
mav480 = ma(c, Period480);
mav520 = ma(c, Period520);
mav560 = ma(c, Period560);
mav600 = ma(c, Period600);
mav840 = ma(c, Period840);
mav900 = ma(c, Period900);
mav1120 = ma(c, Period1120);
mav1200 = ma(c, Period1200);
mav1800 = ma(c, Period1800);
mav2400 = ma(c, Period2400);
mav2800 = ma(c, Period2800);
mav3000 = ma(c, Period3000);
mav3600 = ma(c, Period3600);
mav4800 = ma(c, Period4800);
mav7200 = ma(c, Period7200);
mav58 = ma(c, Period58);
mav60 = ma(c, Period60);
mav62 = ma(c, Period62);
mav82 = ma(c, Period82);
mav84 = ma(c, Period84);
mav28 = ma(c, Period28);
mav31 = ma(c, Period31);
mav32 = ma(c, Period32);
mav33 = ma(c, Period33);
mav41 = ma(c, Period41);
mav42 = ma(c, Period42);
mav43 = ma(c, Period43);
mav48 = ma(c, Period48);
mav1001 = ma(c, Period1001);
mav1002 = ma(c, Period1002);
mav1003 = ma(c, Period1003);
mav1008 = ma(c, Period1008);
var1 = abs(c-mav70);
var2 = abs(mav10-mav20);
var3 = abs(mav20-mav35);
var4 = abs(mav35-mav70);
var5 = abs(mav70-mav140);
var6 = abs(mav140-mav280);
var7 = abs(mav280-mav560);
var8 = abs(mav560-mav1120);
var9 = abs(mav1120-mav1800);
input : Atime(30),P1(2),P2(3),P3(5),P4(10),P5(20),P6(40);
var : TF(0),cnt(0),sum1(0),bmav2(0),sum2(0),bmav3(0),sum3(0),bmav5(0),sum4(0),bmav10(0),sum5(0),bmav20(0),sum6(0),bmav40(0);
Array : CC[500](0);
TF = TimeToMinutes(stime)%Atime;
if dayindex() == 0 or (TF < TF[1] and stime > stime[1]) Then
{
for cnt = 1 to 499
{
CC[cnt] = CC[cnt-1][1];
}
}
CC[0] = C;
if CC[P6-1] > 0 then
{
sum1 = 0;
sum2 = 0;
sum3 = 0;
sum4 = 0;
sum5 = 0;
sum6 = 0;
for cnt = 0 to P6
{
if cnt < P1 Then
sum1 = sum1+CC[cnt];
if cnt < P2 Then
sum2 = sum2+CC[cnt];
if cnt < P3 Then
sum3 = sum3+CC[cnt];
if cnt < P4 Then
sum4 = sum4+CC[cnt];
if cnt < P5 Then
sum5 = sum5+CC[cnt];
if cnt < P6 Then
sum6 = sum6+CC[cnt];
}
Bmav2 = sum1/P1;
Bmav3 = sum2/P2;
Bmav5 = sum3/P3;
Bmav10 = sum4/P4;
Bmav20 = sum5/P5;
Bmav40 = sum6/P6;
}
if (sdate != sdate[1] and stime >= 시작시간) or
(sdate == sdate[1] and (Stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간))) Then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if TotalTrades > TotalTrades[1] then
{
BXcond = false;
SXcond = false;
if (IsExitName("bl",0) == true or IsExitName("bp",0) == true or IsExitName("bx",0) == true or IsExitName("bx",0) == true) Then
BXcond = true;
if (IsExitName("sl",0) == true or IsExitName("sp",0) == true or IsExitName("sx",0) == true or IsExitName("sx",0) == true) Then
SXcond = true;
}
if Tcond == true then
{
if MarketPosition >= 0 Then
if mav3600 < c and mav7200 > mav4800 and mav4800 > mav2400 and mav2400 < mav1200 and mav1200 < mav600 and mav1200 < mav300 and ((mav4800 < mav600)or (mav4800 < mav300)) and
mav7200[1] > mav7200 and mav4800[1] > mav4800 and
mav2400[1] < mav2400 and mav1200[1] < mav1200 and mav900[3] > mav900[2] and mav900[2] > mav900[1] and mav900[1] > mav900 and mav300[1] > mav300 and
mav150[1] > mav150 and mav80[1] > mav80 and mav40[1] > mav40 and mav20[1] > mav20 and mav10[1] > mav10 and Bmav40 > Bmav20 and Bmav20 > Bmav10 Then
{
if CurrentContracts < 1 Then
sell("s4",OnClose,def,1);
}
if MarketPosition == -1 then
{
#s3
if mav3000[1] < mav3000 and mav2400[1] < mav2400 and mav1200[1] < mav1200 and mav150[1] < mav150 and mav80[1] < mav80 Then
{
ExitShort("s4-1",OnClose,def,"s4");
}
Else if mav2400[1] > mav2400 and mav600[20] > mav600 and mav600[3] > mav600[2] and mav600[2] < mav600[1] and mav600[1] < mav600 Then
{
ExitShort("s4-2",OnClose,def,"s4");
}
Else if mav2400[1] > mav2400 and mav600 > mav300 and mav300[30] > mav300 and mav300[3] < mav300[2] and mav300[2] < mav300[1] and mav300[1] < mav300 Then
{
ExitShort("s4-3",OnClose,def,"s4");
}
Else
{
if mav2400[1] > mav2400 and mav900 > mav600 and mav600 > mav300 and crossuP(mav80,mav150) Then
ExitShort("s4-4",OnClose,def,"s4");
}
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수s4,"s4");
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수s4,"s4");
}
}
위 수식을 활용하여 시뮬레이션차트 30틱에서 건수 900,000바 환경에서 익절틱수s4(변수이름)을 변수편집을 이용하여 최소60, 최대120, 증가 1로 설정하여 시뮬레이션하면
왜 1개의 값만 나오고 시뮬레이션할 때 마다 다른 값이 나오는지 궁금합니다
실제로 범위내에서 다른 값을 적용하면 시뮬레이션에서 나오 값보다 높은값이 나오는지 궁금합니다
몇일을 찾았으나 원인을 알 수 없어요
감사합니다.
2023-01-28
1048
글번호 165786
시스템
답변완료
문의 드립니다.~~~~
수고하십니다.
다음 추세선식에서
각각의 상승추세선은 고점과 저점의 차이가 a틱이상(빨강)
각각의 하락추세선은 b틱이상(파랑)으로 설정하고 싶습니다.
Input:length(12);
input : N(2),첫진입틱수(10),추가진입틱수(50);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),TL_Val1(0),TL_Val2(0),color(0);
var:T(0),B(0),Bx(0),S(0),Sx(0);
Array:고점[10,2](0),저점[10,2](0);
처리구분 = "";
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If 저점[1,1] > L Then 처리구분 = "저점처리";
If 고점[1,1] < H Then 처리구분 = "고점처리";
}
Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리";
Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
T = 1;
lastHiVal = H;
If 고점[1,2] < 저점[1,2] Then
{
For j = 10 DownTo 2
{
고점[j,1] = 고점[j-1,1];
고점[j,2] = 고점[j-1,2];
}
}
If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then
{
고점[1,1] = H;
고점[1,2] = Index;
sBar = Index - 저점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then
TL_Delete(TL2);
}
if 고점[1,1] > 고점[2,1] or 고점[2,1] == 0 Then{
color = RED;
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL_SetColor(TL1,color);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(고점[1,1],2));
Text_SetStyle(Text1, 2, 1);
If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then
{
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
}
}
}
If 처리구분 == "저점처리" Then
{
T = -1;
lastLoVal = L;
If 저점[1,2] < 고점[1,2] Then
{
For j = 10 DownTo 2
{
저점[j,1] = 저점[j-1,1];
저점[j,2] = 저점[j-1,2];
}
}
If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then
{
저점[1,1] = L;
저점[1,2] = Index;
sBar = Index - 고점[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then
TL_Delete(TL3);
}
if 저점[1,1] < 저점[2,1] or 저점[2,1] == 0 Then{
color = blue;
}
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL_SetColor(TL1,color);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1])/PriceScale,0)+NewLine+NumToStr(저점[1,1],2));
Text_SetStyle(Text1, 2, 0);
If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then
{
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
}
}
}
TL_SetSize(TL1,3);
#상승구간의 마지막저점 저장
if Color == RED Then
{
var1 = 저점[2,1];
}
#하락구간의 마지막 고점 저장
if Color == BLUE Then
{
var2 = 고점[2,1];
}
2023-01-28
568
글번호 165784
시스템