예스스탁
예스스탁 답변
2022-09-19 16:44:17
Input : 당일수익틱수(50),당일손실틱수(50);
Input : 익절틱수(50),손절틱수(50);
input : StartTime(100000),EndTime(120000);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
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;
Xcond = false;
N1 = NetProfit;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
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;
}
var1 = ma(C,5);
Var2 = ma(C,20);
if Xcond == false then
{
if CrossUp(var1,Var2) Then
{
buy("b");
}
if CrossDown(var1,Var2) Then
{
sell("s");
}
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));
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
> 수원 님이 쓴 글입니다.
> 제목 : 안녕하세요
> 매매시간오전10시부터12시까지
매매횟수5회
당일수익이50틱이면강제청산후 진입금지
당일손실이50틱이면강제청산후 진입금지
5이평이20이평골드크로스면매수
5이평이20이평데드크로스면매도
+50틱익절
-50틱손절
변수는 input으로 부탁합니다