예스스탁
예스스탁 답변
2021-01-04 13:46:42
안녕하세요
예스스탁입니다.
현재수식에서 매수1,매수2,매수3은 한봉에 하나만 발생하게 됩니다.
해당 진입이 한봉에 2개이상 발생할수 없습니다.
2번 내용만 수정해 드립니다. 매수1~3 중 가장 낮은 진입가를 기준으로 동작하게 변경해 드립니다.
INPUT : 매수(0), 매도조건(1);
var : cond(False),LP(0);
var1 = ma(C,3);
var2 = ma(C,5);
var3 = ma(C,10);
var4 = ma(C,60);
value1 = 0;
if value1 == 0 and C < Var4 and CrossDown(c,var3) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수3");
}
}
if value1 == 0 and C < var4 and CrossDown(c,var2) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수2");
}
}
if value1 == 0 and C < Var4 and CrossDown(c,var1) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수1");
}
}
if MarketPosition == 1 Then
{
if 매수 == 1 Then
Cond = true;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수1" Then
{
LP = LatestEntryPrice(0);
Condition1 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수2" Then
{
LP = LatestEntryPrice(0);
Condition2 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수3" Then
{
LP = LatestEntryPrice(0);
Condition3 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수4" Then
{
Condition4 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수5" Then
{
Condition5 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수6" Then
{
Condition6 = true;
}
if Condition3 == true or Condition2 == true or Condition1 == true Then
{
if Condition4 == False Then
Buy("매수4",AtLimit,LP*0.97);
if Condition4 == true and Condition5 == False Then
Buy("매수5",AtLimit,LP*0.95);
if Condition4 == true and Condition5 == true and Condition6 == False Then
Buy("매수6",AtLimit,LP*0.90);
}
if 매도조건 == 1 Then
{
ExitLong("bx1",AtLimit,AvgEntryPrice*1.05,"",Floor(MaxContracts*0.2),1);
ExitLong("bx2",AtLimit,AvgEntryPrice*1.08,"",Floor(MaxContracts*0.5),1);
ExitLong("bx3",AtLimit,AvgEntryPrice*1.10);
}
if 매도조건 == 2 Then
{
ExitLong("bx",AtLimit,AvgEntryPrice*1.15);
}
}
Else
{
Condition1 = False;
Condition2 = False;
Condition3 = False;
}
즐거운 하루되세요
> 쭈니오빠 님이 쓴 글입니다.
> 제목 : 시스템질문
> 안녕하세요~
<질문1>
아래수식에서
매수 4,5,6의 매수에 있어 매수1,2,3이 한봉에 2개이상 매수되는경우
작동을 안하는것 같은데요 수정부탁드립니다
<질문2>
아래수식에서
매수3가 매수되었을때만 매수4,매수5,매수6이 중복 매수되지 않도록 되어있는데요
매수1, 매수2, 매수3 어떤것이 매수되더라도
매수된값들을 체크하여 최저가로 매수된 가격을 기준으로
매수4, 매수5, 매수6가 순차적으로 매수되도록 변경하고 싶습니다
*매수는 매수조건이 동일가격에서 만족되더라도 항상 중복매수되지 않도록부탁드립니다
감사합니다~
INPUT : 매수(0), 매도조건(1);
var : cond(False),LP(0);
var1 = ma(C,3);
var2 = ma(C,5);
var3 = ma(C,10);
var4 = ma(C,60);
value1 = 0;
if value1 == 0 and C < Var4 and CrossDown(c,var3) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수3");
}
}
if value1 == 0 and C < var4 and CrossDown(c,var2) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수2");
}
}
if value1 == 0 and C < Var4 and CrossDown(c,var1) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수1");
}
}
if MarketPosition == 1 Then
{
if 매수 == 1 Then
Cond = true;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수1" Then
{
LP = LatestEntryPrice(0);
Condition1 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수2" Then
{
LP = LatestEntryPrice(0);
Condition2 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수3" Then
{
LP = LatestEntryPrice(0);
Condition3 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수4" Then
{
LP = LatestEntryPrice(0);
Condition4 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수5" Then
{
LP = LatestEntryPrice(0);
Condition5 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수6" Then
{
LP = LatestEntryPrice(0);
Condition6 = true;
}
if Condition3 == true Then
{
if Condition4 == False Then
Buy("매수4",AtLimit,LP*0.97);
if Condition4 == true and Condition5 == False Then
Buy("매수5",AtLimit,LP*0.95);
if Condition4 == true and Condition5 == true and Condition6 == False Then
Buy("매수6",AtLimit,LP*0.90);
}
if 매도조건 == 1 Then
{
ExitLong("bx1",AtLimit,AvgEntryPrice*1.05,"",Floor(MaxContracts*0.2),1);
ExitLong("bx2",AtLimit,AvgEntryPrice*1.08,"",Floor(MaxContracts*0.5),1);
ExitLong("bx3",AtLimit,AvgEntryPrice*1.10);
}
if 매도조건 == 2 Then
{
ExitLong("bx",AtLimit,AvgEntryPrice*1.15);
}
}
Else
{
Condition1 = False;
Condition2 = False;
Condition3 = False;
}