아래수식은
전략차트에서는 정상작동을 하는데요.
시뮬레이션 차트에서 적용를 하면
1개씩 거래가 안되고 수천개씩 거래가 되고 있습니다.
시물레이션 차트 정상 적용이 왜 안될까요?
var : BH(0);
var : SL(0);
var: t(0);
input : period(11),period2(11),매수간격(190),매도간격(190) ;
input: 이익변수(1700),손절변수(290);
if C > highest(H,period)[1] Then{
t=1;
if MarketPosition() == 0 and t==1 Then
buy("매수");
}
if C < Lowest(L,period2)[1] Then {
t=-1 ;
if MarketPosition() ==0 and t==-1 Then
Sell("매도");
}
if MarketPosition == 1 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+PriceScale*매수간격);
if CurrentContracts > CurrentContracts[1] Then
BH = H;
if H > BH Then
BH = H;
if MaxEntries == 1 Then
ExitLong("매수1손절",AtStop,EntryPrice-PriceScale*손절변수);
if MaxEntries >= 2 Then
ExitLong("bx",AtStop,AvgEntryPrice);
ExitLong("매수이익x",AtLimit,AvgEntryPrice+PriceScale*이익변수 );
if MaxContracts >= 5 Then
exitlong("btr1",AtStop,BH-(BH-AvgEntryPrice)*0.5);
}
if MarketPosition == -1 Then
{
Sell("ss",AtStop,LatestEntryPrice(0)-PriceScale*매도간격);
if CurrentContracts > CurrentContracts[1] Then
SL = L;
if L < SL Then
SL = L;
if MaxEntries == 1 Then
ExitShort("매도1손절",AtStop,EntryPrice+PriceScale*손절변수 );
if MaxEntries >= 2 Then
ExitShort("sx",AtStop,AvgEntryPrice);
ExitShort("매도이익",AtLimit,AvgEntryPrice-PriceScale*이익변수);
if MaxContracts >= 5 Then
ExitShort("str1",AtStop,SL+(AvgEntryPrice-SL)*0.5);
}
답변 1
예스스탁
예스스탁 답변
2023-01-19 10:38:21
안녕하세요.
예스스탁 입니다.
시스템 설정창의 [비용/수량]에서
[동일수량 진입]의 거래수량을 1로 설정해주셔야 1계약씩 진입하게 됩니다.
자세한 세팅 방법은 첨부 이미지를 참고해 주세요.
즐거운 하루 보내세요.
> 종호 님이 쓴 글입니다.
> 제목 : 수식문의 드립니다,
> 아래수식은
전략차트에서는 정상작동을 하는데요.
시뮬레이션 차트에서 적용를 하면
1개씩 거래가 안되고 수천개씩 거래가 되고 있습니다.
시물레이션 차트 정상 적용이 왜 안될까요?
var : BH(0);
var : SL(0);
var: t(0);
input : period(11),period2(11),매수간격(190),매도간격(190) ;
input: 이익변수(1700),손절변수(290);
if C > highest(H,period)[1] Then{
t=1;
if MarketPosition() == 0 and t==1 Then
buy("매수");
}
if C < Lowest(L,period2)[1] Then {
t=-1 ;
if MarketPosition() ==0 and t==-1 Then
Sell("매도");
}
if MarketPosition == 1 Then
{
buy("bb",AtStop,LatestEntryPrice(0)+PriceScale*매수간격);
if CurrentContracts > CurrentContracts[1] Then
BH = H;
if H > BH Then
BH = H;
if MaxEntries == 1 Then
ExitLong("매수1손절",AtStop,EntryPrice-PriceScale*손절변수);
if MaxEntries >= 2 Then
ExitLong("bx",AtStop,AvgEntryPrice);
ExitLong("매수이익x",AtLimit,AvgEntryPrice+PriceScale*이익변수 );
if MaxContracts >= 5 Then
exitlong("btr1",AtStop,BH-(BH-AvgEntryPrice)*0.5);
}
if MarketPosition == -1 Then
{
Sell("ss",AtStop,LatestEntryPrice(0)-PriceScale*매도간격);
if CurrentContracts > CurrentContracts[1] Then
SL = L;
if L < SL Then
SL = L;
if MaxEntries == 1 Then
ExitShort("매도1손절",AtStop,EntryPrice+PriceScale*손절변수 );
if MaxEntries >= 2 Then
ExitShort("sx",AtStop,AvgEntryPrice);
ExitShort("매도이익",AtLimit,AvgEntryPrice-PriceScale*이익변수);
if MaxContracts >= 5 Then
ExitShort("str1",AtStop,SL+(AvgEntryPrice-SL)*0.5);
}