답변완료
진입명에 따른 entryprice 구분 여부
항상 친절한 답변 감사드립니다.
동일 종목을 다른 로직으로 진입할 때 청산도 다르게 하고자 합니다.
다음과 같이 작성한다고하면 entryprice가 각각의 로직에 맞게 구분되어 청산되는지요?
if entryname == "a" and c > entryprice*1.10 then exitlong();
if entryname == "b" and c > entryprice*1.20 then exitlong();
예를 들면 같은 종목을 "a"로 10,000에 1주 진입하였고, "b"로 10,500원에 1주 진입하였으면 현재 평단가 10,250에 2주가 있게 됩니다. 이와 같은 상황에서 위의 청산신호가 차례로 나오면 "a"신호 진입된 것 1주는 11,000에 체결되고 "b"로 진입된 것 1주는 10,500*1.2에 청산되게 되는지요? 즉 entryprice가 신호별로 구분이 되는지요?
* entryprice에 신호 구분 표시가 없는 것 같아서 질문드리는데, 혹시 구분표시를 넣을 수 있는 방법이 있는지요?
2023-09-29
758
글번호 172808
시스템
답변완료
렌코차트 관련 문의드립니다
렌코차트 관련해서 2가지 문의사항이 있습니다.
1.
input:단위호가(0.4);
var:j(0),벽돌크기(0),벽돌개수(0),방향(0),단기이평(0),중기이평(0),단기가중이평(0),중기가중이평(0),
상승(1),하락(-1),Sum(0),CSum(0);
array:고[10](0),저[10](0),렌코[500](0);
if index == 0 then
{
방향 = 0;
벽돌크기 = 단위호가;
고[0] = C;
저[0] = C;
렌코[0] = C;
}
#==========================================#
# 렌코 계산
#==========================================#
if 방향 == 0 then
{
if 저[0] - 벽돌크기 >= C then
{
벽돌개수 = int((저[0]-C)/벽돌크기);
저[0] = 저[0] - 벽돌크기 * 벽돌개수;
방향 = 하락;
for j = 499 downto 벽돌개수
{
렌코[j] = 렌코[j-벽돌개수];
}
for j = 벽돌개수 - 1 downto 0
{
렌코[j] = 렌코[j+1] - 벽돌크기;
}
}
else if 고[0] + 벽돌크기 <= C then
{
벽돌개수 = int((C-고[0])/벽돌크기);
고[0] = 고[0] + 벽돌크기 * 벽돌개수;
방향 = 상승;
for j = 499 downto 벽돌개수
{
렌코[j] = 렌코[j-벽돌개수];
}
for j = 벽돌개수 - 1 downto 0
{
렌코[j] = 렌코[j+1] + 벽돌크기;
}
}
}
else if 방향 == 하락 then
{
if 저[0] - 벽돌크기 >= C then
{
벽돌개수 = int((저[0]-C)/벽돌크기);
저[0] = 저[0] - 벽돌크기 * 벽돌개수;
for j = 499 downto 벽돌개수
{
렌코[j] = 렌코[j-벽돌개수];
}
for j = 벽돌개수 - 1 downto 0
{
렌코[j] = 렌코[j+1] - 벽돌크기;
}
}
if 저[0] + 2*벽돌크기 <= C then
{
for j = 8 downto 0
{
고[j+1] = 고[j];
}
방향 = 상승;
벽돌개수 = int((C-저[0])/벽돌크기);
고[0] = 저[0] + 벽돌크기 * 벽돌개수;
for j = 499 downto (벽돌개수-1)
{
렌코[j] = 렌코[j-(벽돌개수-1)];
}
렌코[벽돌개수-2] = 렌코[벽돌개수-1] + 2*벽돌크기;
if 벽돌개수 > 2 then
{
for j = 벽돌개수 - 3 downto 0
{
렌코[j] = 렌코[j+1] + 벽돌크기;
}
}
}
}
else if 방향 == 상승 then
{
if 고[0] + 벽돌크기 <= C then
{
벽돌개수 = int((C-고[0])/벽돌크기);
고[0] = 고[0] + 벽돌크기 * 벽돌개수;
for j = 499 downto 벽돌개수
{
렌코[j] = 렌코[j-벽돌개수];
}
for j = 벽돌개수 - 1 downto 0
{
렌코[j] = 렌코[j+1] + 벽돌크기;
}
}
if 고[0] - 2*벽돌크기 >= C then
{
for j = 8 downto 0
{
저[j+1] = 저[j];
}
방향 = 하락;
벽돌개수 = int((고[0]-C)/벽돌크기);
저[0] = 고[0] - 벽돌크기 * 벽돌개수;
for j = 499 downto (벽돌개수-1)
{
렌코[j] = 렌코[j-(벽돌개수-1)];
}
렌코[벽돌개수-2] = 렌코[벽돌개수-1] - 2*벽돌크기;
if 벽돌개수 > 2 then
{
for j = 벽돌개수 - 3 downto 0
{
렌코[j] = 렌코[j+1] - 벽돌크기;
}
}
}
}
if 방향[1]==하락 and 방향==상승 then
plot1(저[0],"렌코차트",Blue);
if 방향[1]==상승 and 방향==하락 then
plot1(고[0],"렌코차트",RED);
plot2(렌코[0],"렌코값",iff(방향==상승,Red,Blue));
위 수식을 사용해서 렌코 차트를 그리면 plot1 부분은 실제 렌코차트와 비슷하게 나오지만
최근 벽돌 몇개는 그려지지 않고
plot2 부분은 최근 벽돌 끝까지 전부 그려지지만 모양이 들쑥날쑥해서 보기가 불편합니다.
plot1을 실제 렌코차트처럼 정확하게 나오는 방법이 있을까요?
2. 렌코차트를 사용하여 포지션 정리를 하려면 어떤 수식을 써야할까요?
포지션 진입은 따로 수식이 있고
손절할때만 사용할겁니다
예)
롱 포지션을 들고있고 벽돌[0] 이 가장 최근, 벽돌[3] 이 뒤로 4번째 벽돌이라고 했을 때,
벽돌[3] & 벽돌[2] 가 상승 벽돌, 벽돌[1] & 벽돌[0] 이 하락 벽돌로 변했을 때
롱 포지션 정리
2023-09-29
744
글번호 172807
지표
답변완료
문의 드립니다
1.
input : StartTime(170000),EndTime(50000);
input : 익절틱수(0),손절틱수(30);
var : Tcond(False),entry(0);
Variables: Mom(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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 (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if Tcond == true Then
{
if L ==lowest(L,2) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,2)+lowest(L,2))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 8 Then
ExitShort();
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
2.
input : StartTime(170000),EndTime(50000);
input : 익절틱수(0),손절틱수(30);
var : Tcond(False),entry(0);
Variables: Mom(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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 (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if Tcond == true Then
if H == highest(H,2) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,2)+highest(H,2))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 8 Then
ExitLong();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
3.
input : StartTime(210000),EndTime(60000);
input : 익절틱수(0),손절틱수(40);
var : Tcond(False),entry(0);
Variables: Mom(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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 (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
}
if Tcond == true Then
{
if L ==lowest(L,2) and highest(H,2) >= lowest(L,2)+PriceScale*1 Then
{
Buy("b",AtStop,(highest(H,2)+lowest(L,2))/2);
}
if MarketPosition == 1 and BarsSinceEntry == 8 Then
ExitShort();
}
if H == highest(H,2) and lowest(L,2) <= highest(H,2)+PriceScale*1 Then
{
Sell("s",AtStop,(lowest(L,2)+highest(H,2))/2);
}
if MarketPosition == -1 and BarsSinceEntry == 8 Then
ExitLong();
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
1번 수식어 120선 위 매수신호만 진입
2번 수식어 120선 아래 매도신호만 진입
3번 수식어 1,2번의 합성으로
수정된 수식어 부탁 합니다.
미리 감사드립니다.
2023-10-03
607
글번호 172802
시스템