예스스탁
예스스탁 답변
2024-08-30 15:57:34
안녕하세요
예스스탁입니다.
Input : 당일수익틱수(100),당일손실틱수(200);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0);
var : Xcond(false);
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
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;
}
input : coeff(1);
input : AP(14);
input : novolumedata(1);#1:true, 0:False
var : atrv(0),src(0),upt(0),downt(0),AlphaTrend(0);
var : buySignalk(False),sellSignalk(False);
ATRv = ma(TrueRange, AP);
src = close;
upT = low - ATRv * coeff;
downT = high + ATRv * coeff;
Condition1 = False;
if novolumedata == 1 and rsi(AP) >= 50 Then
Condition1 = true;
if novolumedata == 0 and MFI(AP) >= 50 Then
Condition1 = true;
AlphaTrend = iff(Condition1 , IFf(upT < iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]), iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , upT),IFf(downT > iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , downT));
if Xcond == false then
{
if CrossUp(AlphaTrend,AlphaTrend[2]) Then
Buy();
if CrossDown(AlphaTrend,AlphaTrend[2]) Then
Sell();
}
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));
}
즐거운 하루되세요
> cjfdk 님이 쓴 글입니다.
> 제목 : 문의드립니다
>
input : coeff(1);
input : AP(14);
input : novolumedata(1);#1:true, 0:False
var : atrv(0),src(0),upt(0),downt(0),AlphaTrend(0);
var : buySignalk(False),sellSignalk(False);
ATRv = ma(TrueRange, AP);
src = close;
upT = low - ATRv * coeff;
downT = high + ATRv * coeff;
Condition1 = False;
if novolumedata == 1 and rsi(AP) >= 50 Then
Condition1 = true;
if novolumedata == 0 and MFI(AP) >= 50 Then
Condition1 = true;
AlphaTrend = iff(Condition1 , IFf(upT < iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]), iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , upT),IFf(downT > iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , downT));
if CrossUp(AlphaTrend,AlphaTrend[2]) Then
Buy();
if CrossDown(AlphaTrend,AlphaTrend[2]) Then
Sell();
수고 많으십니다
문의드릴 내용은 저번에 만들어 주신 수식인데
여기에 추가로 하루 100틱 손실이면 매매종료
하루100틱 수익이면 매매종료
이걸 추가하고 싶어서 문의드립니다
감사합니다