안녕하세요. 항상 도움에 감사드립니다.
질문1
여러개의 진입수식이 있을때
각 진입수식당 하루에 한번이하로 진입하는 수식을 만들고 싶습니다.
예를 들어 아래와 같이 5개의 진입수식이 있을 때 이 로직은 0 ~ 5회의 진입횟수를 가지게 되겠죠.
if 조건1 then
buy("매수1");
if 조건2 then
buy("매수2");
if 조건3 then
buy("매수3");
if 조건4 then
buy("매수4");
if 조건5 then
buy("매수5");
질문2 - 질문1의 좀 더 심화된 질문
질문1의 경우 같은봉에 여러가지 중복 진입하는 경우가 생길 겁니다.
이를 방지하기 위해서 1개의 봉에 여러개 신호가 발생할 경우 하나의 로직만 진입하게 하고 싶습니다. 질문1처럼 모든 진입수식이 하루에 한번만 진입하는 건 똑같으나 5개의 진입수식이 동시진입없이 순차적으로 진입하게 되는거죠.
잘 부탁드립니다.
답변 1
예스스탁
예스스탁 답변
2020-11-16 10:59:24
안녕하세요
예스스탁입니다.
1
각 진입의 이름을 이용해 제어하셔야 합니다.
var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0);
if Bdate != Bdate[1] Then
{
Bcnt1 = 0;
Bcnt2 = 0;
Bcnt3 = 0;
Bcnt4 = 0;
Bcnt5 = 0;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수1" Then
Bcnt1 = Bcnt1+1;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수2" Then
Bcnt2 = Bcnt2+1;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수3" Then
Bcnt3 = Bcnt3+1;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수4" Then
Bcnt4 = Bcnt4+1;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수5" Then
Bcnt5 = Bcnt5+1;
if Bcnt1 < 1 and 조건1 then
buy("매수1");
if Bcnt2 < 1 and 조건2 then
buy("매수2");
if Bcnt3 < 1 and 조건3 then
buy("매수3");
if Bcnt4 < 1 and 조건4 then
buy("매수4");
if Bcnt5 < 1 and 조건5 then
buy("매수5");
2
var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0),count(0);
if Bdate != Bdate[1] Then
{
Bcnt1 = 0;
Bcnt2 = 0;
Bcnt3 = 0;
Bcnt4 = 0;
Bcnt5 = 0;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수1" Then
Bcnt1 = Bcnt1+1;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수2" Then
Bcnt2 = Bcnt2+1;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수3" Then
Bcnt3 = Bcnt3+1;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수4" Then
Bcnt4 = Bcnt4+1;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수5" Then
Bcnt5 = Bcnt5+1;
count = 0;
if count == 0 and Bcnt1 < 1 and 조건1 then
{
count = count+1;
buy("매수1");
}
if count == 0 and Bcnt2 < 1 and 조건2 then
{
count = count+1;
buy("매수2");
}
if count == 0 and Bcnt3 < 1 and 조건3 then
{
count = count+1;
buy("매수3");
}
if count == 0 and Bcnt4 < 1 and 조건4 then
{
count = count+1;
buy("매수4");
}
if count == 0 and Bcnt5 < 1 and 조건5 then
{
count = count+1;
buy("매수5");
}
즐거운 하루되세요
> 탄탄시스템 님이 쓴 글입니다.
> 제목 : 시스템문의
> 안녕하세요. 항상 도움에 감사드립니다.
질문1
여러개의 진입수식이 있을때
각 진입수식당 하루에 한번이하로 진입하는 수식을 만들고 싶습니다.
예를 들어 아래와 같이 5개의 진입수식이 있을 때 이 로직은 0 ~ 5회의 진입횟수를 가지게 되겠죠.
if 조건1 then
buy("매수1");
if 조건2 then
buy("매수2");
if 조건3 then
buy("매수3");
if 조건4 then
buy("매수4");
if 조건5 then
buy("매수5");
질문2 - 질문1의 좀 더 심화된 질문
질문1의 경우 같은봉에 여러가지 중복 진입하는 경우가 생길 겁니다.
이를 방지하기 위해서 1개의 봉에 여러개 신호가 발생할 경우 하나의 로직만 진입하게 하고 싶습니다. 질문1처럼 모든 진입수식이 하루에 한번만 진입하는 건 똑같으나 5개의 진입수식이 동시진입없이 순차적으로 진입하게 되는거죠.
잘 부탁드립니다.