커뮤니티

부탁드립니다.

프로필 이미지
데몬
2014-08-08 01:36:56
173
글번호 77512
답변완료
안녕하세요 ^^ 데몬입니다. 아래 로직에 대해 매거래 손익을 profit 배열에 넣고 싶습니다. 실제거래가 발생하지 않을때도 가상의 손익을 트래킹하려고요. 늘 감사드립니다. Array : profit[100](0); bet = 1; var1 = 100; var2 = 103; if ((stime[1] < 120000 and stime >= 120000) and stime < 130000) then { if C > var1 and C > var2 Then buy("b",AtMarket,DEF,bet); if C < var1 and C < var2 Then sell("s",AtMarket,DEF,bet); } if (stime[1] < 140000 and stime >= 140000) then { ExitLong(); ExitShort(); } SetStopLoss(1,PointStop); SetStopTrailing(2,3,PointStop);
사용자 함수
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-08-08 12:44:05

안녕하세요 예스스탁입니다. var : bet(0),pst(0),EP(0),cnt(0); Array : profit[100](0); bet = 1; var1 = 100; var2 = 103; if ((stime[1] < 120000 and stime >= 120000) and stime < 130000) then { if Pst <= 0 and C > var1 and C > var2 Then{ if Pst == -1 Then{ profit[0] = EP-C; for cnt = 1 to 99{ Profit[cnt] = Profit[cnt-1][1]; } } Pst = 1; EP = C; buy("b",AtMarket,DEF,bet); } if Pst >= 0 and C < var1 and C < var2 Then { if Pst == 1 Then{ profit[0] = C-EP; for cnt = 1 to 99{ Profit[cnt] = Profit[cnt-1][1]; } } Pst = -1; EP = C; sell("s",AtMarket,DEF,bet); } } if (stime[1] < 140000 and stime >= 140000) then { ExitLong(); ExitShort(); if Pst == 1 Then{ profit[0] = C-EP; for cnt = 1 to 99{ Profit[cnt] = Profit[cnt-1][1]; } } if Pst == -1 Then{ profit[0] = EP-C; for cnt = 1 to 99{ Profit[cnt] = Profit[cnt-1][1]; } } } if Pst == 1 and H >= EP+1 Then{ if Pst == 1 Then{ profit[0] = 1; for cnt = 1 to 99{ Profit[cnt] = Profit[cnt-1][1]; } } } if Pst == -1 and L <= EP-1 Then{ if Pst == 1 Then{ profit[0] = 1; for cnt = 1 to 99{ Profit[cnt] = Profit[cnt-1][1]; } } } SetStopLoss(1,PointStop); SetStopTrailing(2,3,PointStop); 즐거운 하루되세요 > 데몬 님이 쓴 글입니다. > 제목 : 부탁드립니다. > 안녕하세요 ^^ 데몬입니다. 아래 로직에 대해 매거래 손익을 profit 배열에 넣고 싶습니다. 실제거래가 발생하지 않을때도 가상의 손익을 트래킹하려고요. 늘 감사드립니다. Array : profit[100](0); bet = 1; var1 = 100; var2 = 103; if ((stime[1] < 120000 and stime >= 120000) and stime < 130000) then { if C > var1 and C > var2 Then buy("b",AtMarket,DEF,bet); if C < var1 and C < var2 Then sell("s",AtMarket,DEF,bet); } if (stime[1] < 140000 and stime >= 140000) then { ExitLong(); ExitShort(); } SetStopLoss(1,PointStop); SetStopTrailing(2,3,PointStop);