커뮤니티

문의

프로필 이미지
목마와숙녀
2019-04-10 10:09:23
223
글번호 127750
답변완료
5개까지 피라미딩으로 진입하는 수식입니다. 설정한 목표점에 도달하면 하나씩 익절하는 수식을 요청드리며 익절하는 순서는 역순(마지막에 진입한 것부터 익절)과 처음에 진입한 것부터 익절하는 방법 2가지 부탁드립니다. 역순 input : ntime(090000); input : pyra(0.50),N(5); input : 역순익절5(0.50),역순익절4(1.00),역순익절3(1.50),역순익절2(2.00),역순익절1(2.50); 진입순 input : ntime(090000); input : pyra(-0.50),N(5); input : 익절1(2.50),익절2(2.00),익절3(1.50),익절4(1.00),익절5(0.50); **************************************************************************** input : ntime(090000); input : pyra(0.5),N(5); if stime == ntime or (stime > ntime and stime[1] < ntime) Then buy(); if MarketPosition == 1 and MaxContracts < N Then buy("bb",AtStop,LatestEntryPrice(0)+Pyra);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-04-10 11:52:07

안녕하세요 예스스탁입니다. 1 진입의 순서로 청산을 하기 위해서는 각 진입별로 이름을 별도로 부여해서 청산에 그이름을 지정해야 합니다. 진입횟수는 변수처리로 해결할수 없고 진입횟수별로 수식내에 직접 추가하셔야 합니다. N이 5회이므로 5회를 예시로 작성해 드립니다. 2 마지막 진입이후에 일정폭씩 상승하면 청산하므로 진입순,역순 별도 외부변수는 필요하지 않습니다. 청산함수에 진입명을 지정하면 해당 이름의 신호에 대해 청산합니다. 3 진입순 input : ntime(090000); input : pyra(0.50); input : 익절1(0.50),익절2(1.00),익절3(1.50),익절4(2.00),익절5(2.50); if stime == ntime or (stime > ntime and stime[1] < ntime) Then buy("b1"); if MarketPosition == 1 Then { if MaxContracts == 1 Then buy("b2",AtStop,LatestEntryPrice(0)+Pyra); if MaxContracts == 2 Then buy("b3",AtStop,LatestEntryPrice(0)+Pyra); if MaxContracts == 3 Then buy("b4",AtStop,LatestEntryPrice(0)+Pyra); if MaxContracts == 4 Then buy("b5",AtStop,LatestEntryPrice(0)+Pyra); if MaxEntries == 5 then { ExitLong("bx1",atlimit,LatestEntryPrice(0)+익절1,"b1"); ExitLong("bx2",atlimit,LatestEntryPrice(0)+익절2,"b2"); ExitLong("bx3",atlimit,LatestEntryPrice(0)+익절3,"b3"); ExitLong("bx4",atlimit,LatestEntryPrice(0)+익절4,"b4"); ExitLong("bx5",atlimit,LatestEntryPrice(0)+익절5,"b5"); } } 4 역순 input : ntime(090000); input : pyra(0.50); input : 익절1(0.50),익절2(1.00),익절3(1.50),익절4(2.00),익절5(2.50); if stime == ntime or (stime > ntime and stime[1] < ntime) Then buy("b1"); if MarketPosition == 1 Then { if MaxContracts == 1 Then buy("b2",AtStop,LatestEntryPrice(0)+Pyra); if MaxContracts == 2 Then buy("b3",AtStop,LatestEntryPrice(0)+Pyra); if MaxContracts == 3 Then buy("b4",AtStop,LatestEntryPrice(0)+Pyra); if MaxContracts == 4 Then buy("b5",AtStop,LatestEntryPrice(0)+Pyra); if MaxEntries == 5 then { ExitLong("bx1",atlimit,LatestEntryPrice(0)+익절1,"b5"); ExitLong("bx2",atlimit,LatestEntryPrice(0)+익절2,"b4"); ExitLong("bx3",atlimit,LatestEntryPrice(0)+익절3,"b3"); ExitLong("bx4",atlimit,LatestEntryPrice(0)+익절4,"b2"); ExitLong("bx5",atlimit,LatestEntryPrice(0)+익절5,"b1"); } } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 5개까지 피라미딩으로 진입하는 수식입니다. 설정한 목표점에 도달하면 하나씩 익절하는 수식을 요청드리며 익절하는 순서는 역순(마지막에 진입한 것부터 익절)과 처음에 진입한 것부터 익절하는 방법 2가지 부탁드립니다. 역순 input : ntime(090000); input : pyra(0.50),N(5); input : 역순익절5(0.50),역순익절4(1.00),역순익절3(1.50),역순익절2(2.00),역순익절1(2.50); 진입순 input : ntime(090000); input : pyra(-0.50),N(5); input : 익절1(2.50),익절2(2.00),익절3(1.50),익절4(1.00),익절5(0.50); **************************************************************************** input : ntime(090000); input : pyra(0.5),N(5); if stime == ntime or (stime > ntime and stime[1] < ntime) Then buy(); if MarketPosition == 1 and MaxContracts < N Then buy("bb",AtStop,LatestEntryPrice(0)+Pyra);