예스스탁
예스스탁 답변
2020-12-30 13:42:17
안녕하세요
예스스탁입니다.
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;
}
새해 좋은일만 가득하시기 바랍니다.
> 쭈니오빠 님이 쓴 글입니다.
> 제목 : 시스템질문
> 아래수식에서
매수1과 매수2와 매수3의 조건이 2개이상 동시 만족되는경우
같은 가격에서 매수가 중복으로 이뤄지는데
한번만 매수되게 할수는 없을까요?
매수1과 매수2 값이 중복된경우 매수2가 매수되게,,,
매수1과 매수3 값이 중복된경우 매수3가 매수되게,,,
매수2와 매수3 값이 중복된경우 매수3가 매수되게,,,
매수1,2,3가 모두 중복된경우 매수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);
if C < Var4 and CrossDown(c,var1) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
Buy("매수1");
}
if C < var4 and CrossDown(c,var2) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
Buy("매수2");
}
if C < Var4 and CrossDown(c,var3) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
Buy("매수3");
}
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;
}