예스스탁
예스스탁 답변
2023-10-13 11:25:47
안녕하세요
예스스탁입니다.
Input : Period(20), LPercent(98), SPercent(106);
Input : 당일수익틱수(30),당일손실틱수(50);
input : StartTime(083000),EndTime(180000);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0);
var : Tcond(false),Xcond(false);
var : value(0),tx1(0),tx2(0),str("");
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
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
Tcond = true;
Xcond = False;
N1 = NetProfit;
}
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
}
value = Disparity(Period) ;
#if Xcond == false and Tcond == true then
#{
If MarketPosition <= 0 and CrossUp(value,LPercent) Then
{
Buy("b");
tx1 = Text_New(sDate,sTime,H,"매수진입:"+NumToStr(C,2));
Text_SetStyle(tx1,2,1);
}
If MarketPosition >= 0 and CrossDown(value,SPercent) Then
{
Sell("s");
tx1 = Text_New(sDate,sTime,L,"매도진입:"+NumToStr(C,2));
Text_SetStyle(tx1,2,0);
}
#}
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
}
if TotalTrades > TotalTrades[1] Then
{
if MarketPosition(1) == 1 Then
{
str = NewLine+"매수청산:"+NumToStr(ExitPrice(1),2)+"/"+NumToStr((ExitPrice(1)-EntryPrice(1))/PriceScale,0);
tx2 = Text_New(ExitDate(1),ExitTime(1),L,str);
Text_SetStyle(tx2,2,0);
}
if MarketPosition(1) == -1 Then
{
str = "매도청산:"+NumToStr(ExitPrice(1),2)+"/"+NumToStr((EntryPrice(1)-ExitPrice(1))/PriceScale,0)+NewLine;
tx2 = Text_New(ExitDate(1),ExitTime(1),H,str);
Text_SetStyle(tx2,2,1);
}
}
즐거운 하루되세요
> 요타 님이 쓴 글입니다.
> 제목 : 매매식 좀 요청 드립니다.
> * 좋은 주말 되십시요^^
* 아래 매매식 좀 부탁 드립니다.
##
Input : Period(20), LPercent(98), SPercent(106);
Var : value(0);
## 추가 요청 사항
// 1. 당일 수익틱수(30); → 진입후 30틱 목표 달성 하면 시장가 청산
// 2. 당일 손실틱수(50); → 진입후 50틱 손실 발생 하면 스위칭
// 3. 시스템적용시간(083000) ~ (180000) ; → 매매시간 은 아침 8시30분 ~ 저녁 6시 까지만 매매
// 4. 진입가표시 청산가 표시 수익 / 손실틱 표시
value = Disparity(Period) ;
If CrossUp(value,LPercent) Then { Buy(); }
If CrossDown(value,SPercent) Then { Sell(); }
* 항상 많은 도움에 고맙습니다.