예스스탁
예스스탁 답변
2024-01-19 09:31:04
안녕하세요
예스스탁입니다.
수식에 에러가 없습니다.
첫진입에 조건을 알수 없으니
첫매수진입조건과 첫매도진입조건으로 지정한 곳에 조건내용을 넣으시라는 의미로
한글이 들어가 있을 뿐입니다.
해당 내용 삭제하고 올려드립니다;.
1
input : 매수매도(1);#매수1, 매도-1
input : 추가진입(20),최대누적진입(10),전체익절(20),최소수익(10),트레일링(5);
var : BE(0),SE(0);
var1 = (추가진입/PointValue)*PriceScale;
Var2 = (전체익절/PointValue)*PriceScale;
Var3 = (최소수익/PointValue)*PriceScale;
Var4 = (트레일링/PointValue)*PriceScale;
if 매수매도 == 1 and MarketPosition == 0 and TotalTrades == TotalTrades[1] Then
Buy("b",OnClose,Def,1);
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
BE = BE+1;
Buy("bb",AtLimit,EntryPrice(0)-(var1*BE),1);
if MaxEntries == 1 and highest(H,BarsSinceEntry) >= EntryPrice+Var3 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-Var4);
if MaxEntries >= 최대누적진입 Then
{
ExitLong("bx",AtStop,EntryPrice(0)-(var1*BE),"",1,1);
}
ExitLong("Bp",AtLimit,AvgEntryPrice+Var2);
}
Else
BE = 0;
if 매수매도 == -1 and MarketPosition == 0 and TotalTrades == TotalTrades[1] Then
Sell("s",OnClose,Def,1);
if MarketPosition == -1 Then
{
if CurrentContracts > CurrentContracts[1] Then
SE = SE+1;
Sell("ss",AtLimit,EntryPrice(0)+(var1*SE),1);
if MaxEntries == 1 and lowest(L,BarsSinceEntry) <= EntryPrice-Var3 Then
ExitShort("str",AtStop,lowest(L,BarsSinceEntry)+Var4);
if MaxEntries >= 최대누적진입 Then
{
ExitShort("sx",AtStop,EntryPrice(0)+(var1*SE),"",1,1);
}
ExitShort("Sp",AtLimit,AvgEntryPrice-Var2);
}
Else
SE = 0;
2
input : 매수매도(1);#매수1, 매도-1
input : 추가진입(20),최대누적진입(10),전체익절(20),최소수익(10),트레일링(5),익절(10);
var : BE(0),SE(0),S(0);
var1 = (추가진입/PointValue)*PriceScale;
Var2 = (전체익절/PointValue)*PriceScale;
Var3 = (최소수익/PointValue)*PriceScale;
Var4 = (트레일링/PointValue)*PriceScale;
Var5 = (익절/PointValue)*PriceScale;
if 매수매도 == 1 and MarketPosition == 0 and TotalTrades == TotalTrades[1] Then
Buy("b",OnClose,Def,1);
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
S = 1;
BE = LatestEntryPrice(0);
}
if CurrentContracts < CurrentContracts[1] Then
{
S = -1;
BE = LatestExitPrice(0);
}
Buy("bb",AtLimit,BE-var1,1);
if MaxEntries == 1 and highest(H,BarsSinceEntry) >= EntryPrice+Var3 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-Var4);
if S == 1 and MaxEntries >= 2 Then
ExitLong("bp1",AtLimit,BE+Var5,"",1,1);
ExitLong("Bp",AtLimit,AvgEntryPrice+Var2);
}
if 매수매도 == 1 and MarketPosition == 0 and TotalTrades == TotalTrades[1] Then
Sell("s",OnClose,Def,1);
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
S = 1;
SE = LatestEntryPrice(0);
}
if CurrentContracts < CurrentContracts[1] Then
{
S = -1;
SE = LatestExitPrice(0);
}
Sell("ss",AtLimit,SE+var1,1);
if MaxEntries == 1 and lowest(L,BarsSinceEntry) <= EntryPrice-Var3 Then
ExitShort("str",AtStop,lowest(L,BarsSinceEntry)+Var4);
if S == 1 and MaxEntries >= 2 Then
ExitShort("sp1",AtLimit,BE-var5,"",1,1);
ExitShort("Sp",AtLimit,AvgEntryPrice-Var2);
}
즐거운 하루되세요
> 양치기 님이 쓴 글입니다.
> 제목 : 시스템식 부탁드립니다.
> 안녕하세요
아래와 같이 코딩해 주셨는데
에러가 납니다.
다시한번 점검 부탁드립니다.
감사합니다.
1. 시스템식1
input : 매수매도(1);#매수1, 매도-1
input : 추가진입(20),최대누적진입(10),전체익절(20),최소수익(10),트레일링(5);
var : BE(0),SE(0);
var1 = (추가진입/PointValue)*PriceScale;
Var2 = (전체익절/PointValue)*PriceScale;
Var3 = (최소수익/PointValue)*PriceScale;
Var4 = (트레일링/PointValue)*PriceScale;
if MarketPosition == 0 and TotalTrades == TotalTrades[1] and 첫매수진입조건 Then
Buy("b",OnClose,Def,1);
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
BE = BE+1;
Buy("bb",AtLimit,EntryPrice(0)-(var1*BE),1);
if MaxEntries == 1 and highest(H,BarsSinceEntry) >= EntryPrice+Var3 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-Var4);
if MaxEntries >= 최대누적진입 Then
{
ExitLong("bx",AtStop,EntryPrice(0)-(var1*BE),"",1,1);
}
ExitLong("Bp",AtLimit,AvgEntryPrice+Var2);
}
Else
BE = 0;
if MarketPosition == 0 and TotalTrades == TotalTrades[1] and 첫매도진입조건 Then
Sell("s",OnClose,Def,1);
if MarketPosition == -1 Then
{
if CurrentContracts > CurrentContracts[1] Then
SE = SE+1;
Sell("ss",AtLimit,EntryPrice(0)+(var1*SE),1);
if MaxEntries == 1 and lowest(L,BarsSinceEntry) <= EntryPrice-Var3 Then
ExitShort("str",AtStop,lowest(L,BarsSinceEntry)+Var4);
if MaxEntries >= 최대누적진입 Then
{
ExitShort("sx",AtStop,EntryPrice(0)+(var1*SE),"",1,1);
}
ExitShort("Sp",AtLimit,AvgEntryPrice-Var2);
}
Else
SE = 0;
2. 시스템식2
10$ 정도 상승하면 마지막 진입한 계약만 익절
위 내용은 마지막진입가격에서 10$ 상승하면 1계약 익절청산으로 작성해 드립니다.
마지막 진입을 청산하기 위해서는 진입명을 지정해야 하는데 현재 하나의 함수로 추가진입이 됩니다.
해당 진입명을 지정하면 해당 진입으로 들어간 모든 추가진입이 청산됩니다,
내용상 각 추가진입별로 이름을 부여하기 어려워 1계약 청산으로 작성해 드립니다.
input : 매수매도(1);#매수1, 매도-1
input : 추가진입(20),최대누적진입(10),전체익절(20),최소수익(10),트레일링(5),익절(10);
var : BE(0),SE(0),S(0);
var1 = (추가진입/PointValue)*PriceScale;
Var2 = (전체익절/PointValue)*PriceScale;
Var3 = (최소수익/PointValue)*PriceScale;
Var4 = (트레일링/PointValue)*PriceScale;
Var5 = (익절/PointValue)*PriceScale;
if MarketPosition == 0 and TotalTrades == TotalTrades[1] and 첫매수진입조건 Then
Buy("b",OnClose,Def,1);
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
S = 1;
BE = LatestEntryPrice(0);
}
if CurrentContracts < CurrentContracts[1] Then
{
S = -1;
BE = LatestExitPrice(0);
}
Buy("bb",AtLimit,BE-var1,1);
if MaxEntries == 1 and highest(H,BarsSinceEntry) >= EntryPrice+Var3 Then
ExitLong("btr",AtStop,highest(H,BarsSinceEntry)-Var4);
if S == 1 and MaxEntries >= 2 Then
ExitLong("bp1",AtLimit,BE+Var5,"",1,1);
ExitLong("Bp",AtLimit,AvgEntryPrice+Var2);
}
if MarketPosition == 0 and TotalTrades == TotalTrades[1] and 첫매도진입조건 Then
Sell("s",OnClose,Def,1);
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
S = 1;
SE = LatestEntryPrice(0);
}
if CurrentContracts < CurrentContracts[1] Then
{
S = -1;
SE = LatestExitPrice(0);
}
Sell("ss",AtLimit,SE+var1,1);
if MaxEntries == 1 and lowest(L,BarsSinceEntry) <= EntryPrice-Var3 Then
ExitShort("str",AtStop,lowest(L,BarsSinceEntry)+Var4);
if S == 1 and MaxEntries >= 2 Then
ExitShort("sp1",AtLimit,BE-var5,"",1,1);
ExitShort("Sp",AtLimit,AvgEntryPrice-Var2);
}