예스스탁
예스스탁 답변
2024-01-23 10:40:46
안녕하세요
예스스탁입니다.
input : Pst(1);
input : gap(20), gapmulti(0.7), multi(0.7), pt(20), sl(200);
var : vol(0),v1(0),t(0),b(0),s(0);
var : line1(0), line2(0);
value1 = gap/PointValue;
value2 = pt/PointValue;
value3 = sl/PointValue;
line1 = ma(c,10) ;
line2 = ma(c,20) ;
if pst == 1 Then
{
if MarketPosition == 0 and TotalTrades == TotalTrades[1] Then
{
vol = 1;
Buy("b",OnClose,Def,vol);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
v1 = CurrentContracts-CurrentContracts[1];
if MaxEntries == 1 Then
t = value1 ;
Else
t = t+Round(t*gapmulti,0);
if LatestEntryName(0) == "upb" Then
b = 1;
if LatestEntryName(0) == "dnb" Then
b = -1;
}
vol = Round(v1+v1*multi,0);
Buy("dnb",AtLimit,EntryPrice(0)-PriceScale*(value1*MaxEntries),vol);
Buy("upb",AtStop,EntryPrice(0)+PriceScale*(value1*MaxEntries),vol);
if b == -1 Then
{
ExitLong("bx11",AtLimit,AvgEntryPrice+PriceScale*Value2);
ExitLong("bx12",AtLimit,EntryPrice);
}
if b == 1 Then
{
ExitLong("bx21",AtStop,AvgEntryPrice-PriceScale*Value2);
ExitLong("bx22",AtStop,EntryPrice);
}
}
Else
b = 0;
}
if pst == -1 Then
{
if MarketPosition == 0 and TotalTrades == TotalTrades[1] Then
{
vol = 1;
Sell("s",OnClose,Def,vol);
}
if MarketPosition == -1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
v1 = CurrentContracts-CurrentContracts[1];
if MaxEntries == 1 Then
t = value1 ;
Else
t = t+Round(t*gapmulti,0);
if LatestEntryName(0) == "ups" Then
s = 1;
if LatestEntryName(0) == "dns" Then
s = -1;
}
vol = Round(v1+v1*multi,0);
Sell("ups",AtLimit,EntryPrice(0)+PriceScale*(value1*MaxEntries),vol);
Sell("dns",AtStop,EntryPrice(0)-PriceScale*(value1*MaxEntries),vol);
if s == 1 Then
{
ExitShort("sx11",AtLimit,AvgEntryPrice-PriceScale*Value2);
ExitShort("sx12",AtLimit,EntryPrice);
}
if s == -1 Then
{
ExitShort("sx21",AtStop,AvgEntryPrice+PriceScale*Value2);
ExitShort("sx22",AtStop,EntryPrice);
}
}
Else
s = 0;
}
즐거운 하루되세요
> 양치기 님이 쓴 글입니다.
> 제목 : 시스템식 부탁드립니다.
> 항상 도움주셔서 감사합니다.
종목 : 해외선물
차트 : 60분봉
요청식)
아래 시스템에서
가격이 상승시 물타기와 같은 배수 같은 간격으로 불타기를 하고 싶습니다.
물타기 진입과 청산은 기존과 동일하고
불타기의 청산은 가격이 불타기 평균가격+20$를 아래로 하락할때 청산하고 싶습니다.
포지션 진입이후 가격이 20$ 이상 상승하지 않고
진입가격 아래로 하락하면 물타기 진행합니다.
- 불타기, 물타기 첫번째 진입간격은 20$ 입니다.
그리고 포지션 평균가격 및 청산가격(예상가격)을 라인으로 표시하고 싶습니다.
#------------------------------------
input : Pst(1);
input : gap(20), gapmulti(0.7), multi(0.7), pt(20), sl(200);
var : vol(0),v1(0),t(0);
var : line1(0), line2(0);
value1 = gap/PointValue;
value2 = pt/PointValue;
value3 = sl/PointValue;
line1 = ma(c,10) ;
line2 = ma(c,20) ;
if pst == 1 Then
{
if MarketPosition == 0 and TotalTrades == TotalTrades[1] Then
{
vol = 1;
Buy("b",OnClose,Def,vol);
}
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
v1 = CurrentContracts-CurrentContracts[1];
if MaxEntries == 1 Then
t = value1 ;
Else
t = t+Round(t*gapmulti,0);
}
vol = Round(v1+v1*multi,0);
Buy("bb",AtLimit,EntryPrice(0)-PriceScale*(value1*MaxEntries),vol);
ExitLong("bp",AtLimit,AvgEntryPrice+PriceScale*Value2);
}
}
if pst == -1 Then
{
if MarketPosition == 0 and TotalTrades == TotalTrades[1] Then
{
vol = 1;
Sell("s",OnClose,Def,vol);
}
if MarketPosition == -1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
v1 = CurrentContracts-CurrentContracts[1];
if MaxEntries == 1 Then
t = value1 ;
Else
t = t+Round(t*gapmulti,0);
}
vol = Round(v1+v1*multi,0);
Sell("ss",AtLimit,EntryPrice(0)+PriceScale*(value1*MaxEntries),vol);
ExitShort("sp",AtLimit,AvgEntryPrice-PriceScale*Value2);
}
}
감사합니다.