예스스탁
예스스탁 답변
2025-03-10 14:24:41
안녕하세요
예스스탁입니다.
input : len(20),len2(20);
var : oo(0),cc(0),hh(0),ll(0),col(0);
var : haclose(0),haopen(0),hahigh(0),halow(0);
var : o2(0),h2(0),l2(0),c2(0);
oo=ema(open,len);
cc=ema(close,len);
hh=ema(high,len);
ll=ema(low,len);
haclose = (oo+hh+ll+cc)/4;
haopen = iff(IsNaN(haopen[1]) == true, (oo + cc)/2 , (haopen[1] + haclose[1]) / 2);
hahigh = max (hh, max(haopen,haclose));
halow = min (ll, min(haopen,haclose));
o2=ema(haopen, len2);
c2=ema(haclose, len2);
h2=ema(hahigh, len2);
l2=ema(halow, len2);
col=iff(o2>c2 , red , lime);
//PlotPaintBar(h2, l2,o2,c2, "heikin smoothed", col);
##============================================================================================================
##============================================================================================================
input : StartTime(080000),EndTime(220000);
var : Tcond(False);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
##============================================================================================================
input : p1(5),P2(20);
var : ma1(0),ma2(0),vol(0);
ma1 = ma(C,P1);
ma2 = ma(C,P2);
##============================================================================================================
{
##============================================================================================================
## 매수식
If MarketPosition <= 0 and sDate >= 20230101 and Tcond == true and stime >= 082000 and stime <= 220000 and CrossUp(ma1,ma2) Then
{
Buy( "수");
PlaySound("C:KiwoomGlobalsoundsound1.wav");
}
##============================================================================================================
##============================================================================================================
## 매도식
If MarketPosition <= 0 and sDate >= 20230101 and Tcond == true and stime >= 082000 and stime <= 220000 and CrossDown(ma1,ma2) Then
{
Sell( "도");
PlaySound("C:KiwoomGlobalsoundsound1.wav");
}
##============================================================================================================
##============================================================================================================
}
##============================================================================================================
##============================================================================================================
## 매수 청산식
if MarketPosition == 1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
if MaxEntries == 1 Then
vol = 1;
Else
vol = CurrentContracts-CurrentContracts[1];
}
if col != col[1] and MaxEntries < 5 Then
Buy("bb",OnClose,Def,vol*2);
ExitLong("수수익",AtLimit,avgEntryPrice+PriceScale*50);
}
##============================================================================================================
##============================================================================================================
## 매도 청산식
if MarketPosition == -1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
if MaxEntries == 1 Then
vol = 1;
Else
vol = CurrentContracts-CurrentContracts[1];
}
if col != col[1] and MaxEntries < 5 Then
Sell("ss",OnClose,Def,vol*2);
ExitShort("도수익",AtLimit,avgEntryPrice-PriceScale*50);
}
##============================================================================================================
##============================================================================================================
SetStopEndofday(230000);
##============================================================================================================
##============================================================================================================
즐거운 하루되세요
> 요타 님이 쓴 글입니다.
> 제목 : 좋은 주말 되십시요^^
> * 주말인데 죄송하게 시스템 수식 하나만 요청 드립니다.
* 기준
ㅇ 5일 이평선이 20일 이평선을 크로스업 하면 매수(1계약)
- 수익이 50틱이면 청산
- 매수후 손실이면서 하이킨 아시 색상이 바뀌면 추가매수(1차 추가매수 2계약)
(매매 진입시 색상 기준 으로 바뀌는 기준임)
- 1차 추가 매수후 손실이면서 하이킨 아시 색상이 바뀌면 2차추가매수(4계약)
- 2차 추가 매수후 손실이면서 하이킨 아시 색상이 바뀌면 3차추가매수(8계약)
- 3차 추가 매수후 손실이면서 하이킨 아시 색상이 바뀌면 4차추가매수(16계약)
- 끝
혹시 이런 매매수식이 가능 할런지요 수식요청 좀 드림니다.
## 하이킨 아시 사용 수식
input : len(20),len2(20);
var : oo(0),cc(0),hh(0),ll(0),col(0);
var : haclose(0),haopen(0),hahigh(0),halow(0);
var : o2(0),h2(0),l2(0),c2(0);
oo=ema(open,len);
cc=ema(close,len);
hh=ema(high,len);
ll=ema(low,len);
haclose = (oo+hh+ll+cc)/4;
haopen = iff(IsNaN(haopen[1]) == true, (oo + cc)/2 , (haopen[1] + haclose[1]) / 2);
hahigh = max (hh, max(haopen,haclose));
halow = min (ll, min(haopen,haclose));
o2=ema(haopen, len2);
c2=ema(haclose, len2);
h2=ema(hahigh, len2);
l2=ema(halow, len2);
col=iff(o2>c2 , red , lime);
//PlotPaintBar(h2, l2,o2,c2, "heikin smoothed", col);
##============================================================================================================
##============================================================================================================
input : StartTime(080000),EndTime(220000);
var : Tcond(False);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
##============================================================================================================
##============================================================================================================
{
##============================================================================================================
## 매수식
If MarketPosition <= 0 and sDate >= 20230101 and Tcond == true and stime >= 082000 and stime <= 220000 and 수식요청 Then
{
Buy( "수");
PlaySound("C:KiwoomGlobalsoundsound1.wav");
}
##============================================================================================================
##============================================================================================================
## 매도식
If MarketPosition <= 0 and sDate >= 20230101 and Tcond == true and stime >= 082000 and stime <= 220000 and 수식요청 Then
{
Sell( "도");
PlaySound("C:KiwoomGlobalsoundsound1.wav");
}
##============================================================================================================
##============================================================================================================
}
##============================================================================================================
##============================================================================================================
## 매수 청산식
if MarketPosition == 1 then
{
ExitLong("수수익",AtLimit,EntryPrice+PriceScale*50);
ExitLong("수손절",AtStop,EntryPrice-PriceScale*60);
Exitlong("수80청",AtStop,highest(H,BarsSinceEntry)-PriceScale*80);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*0 Then Exitlong("수0프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*7.9);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*20 Then Exitlong("수2프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*1.0);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*40 Then Exitlong("수4프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*0.9);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*50 Then Exitlong("수5프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*0.7);
//if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*70 Then Exitlong("수7프청",AtStop,highest(H,BarsSinceEntry)-abs(highest(H,BarsSinceEntry)-EntryPrice)*0.3);
}
##============================================================================================================
##============================================================================================================
## 매도 청산식
if MarketPosition == -1 then
{
ExitShort("도수익",AtLimit,EntryPrice-PriceScale*50);
ExitShort("도손절",AtStop,EntryPrice+PriceScale*60);
ExitShort("도80청",AtStop,highest(H,BarsSinceEntry)-PriceScale*80);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*0 Then ExitShort("도0프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*7.9);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*20 Then ExitShort("도2프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*1.0);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*40 Then ExitShort("도4프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*0.5);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*50 Then ExitShort("도5프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*0.5);
//if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*70 Then ExitShort("도7프청",AtStop,lowest(L,BarsSinceEntry)+abs(lowest(L,BarsSinceEntry)-EntryPrice)*0.3);
}
##============================================================================================================
##============================================================================================================
SetStopEndofday(230000);
##============================================================================================================
##============================================================================================================
ㅇ 좋은 주말되십시요^^ 항상 많은 도움에 고맙습니다.