예스스탁
예스스탁 답변
2019-12-18 13:32:23
안녕하세요
예스스탁입니다.
input : ntime(090000),n(1);
input : 고가갱신수(20);
input : uppyra검증(1.20);
input : 상승pyra(0.20),상승N(12);
input : up손절1(99999),up익절1(99999),upTR1(99999);
input : up손절2(99999),up익절2(99999),upTR2(99999);
var : BE1(0),BH1(0),BV1(0),BXcond1(false);
var : BE2(0),BH2(0),BV2(0),BXcond2(false);
if stime == ntime or (stime > ntime and stime[1] < ntime) Then{
if MaxEntries < n Then
buy("b1");
}
if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then
buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra);
if MarketPosition == 0 and #현재무포지션이고
EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고
MarketPosition(1) == 1 and #직전거래가 매수거래이고
countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면
buy("b2");
if MarketPosition == 1 then
{
if CurrentContracts > CurrentContracts[1] Then
{
if MaxEntries == 1 then
{
BE1 = LatestEntryPrice(0);
Bh1 = h;
Bv1 = CurrentContracts-CurrentContracts[1];
BXcond1 = false;
}
if MaxEntries == 2 then
{
BE2 = LatestEntryPrice(0);
Bh2 = h;
Bv2 = CurrentContracts-CurrentContracts[1];
BXcond2 = false;
}
}
if CurrentContracts < CurrentContracts[1] then
{
if LatestExitName(0) == "bl1" or
LatestExitName(0) == "bp1" or
LatestExitName(0) == "btr1" Then
BXcond1 = true;
if LatestExitName(0) == "bl2" or
LatestExitName(0) == "bp2" or
LatestExitName(0) == "btr2" Then
BXcond2 = true;
}
if MaxEntries >= 1 then
{
if h > Bh1 Then
Bh1 = h;
if BXcond1 == false Then
{
ExitLong("bl1",AtStop,BE1-PriceScale*up손절1,"",BV1,1);
ExitLong("bp1",Atlimit,BE1+PriceScale*up익절1,"",BV1,1);
ExitLong("btr1",AtStop,Bh1-PriceScale*upTR1,"",BV1,1);
}
}
if MaxEntries >= 2 then
{
if h > Bh2 Then
Bh2 = h;
if BXcond2 == false Then
{
ExitLong("bl2",AtStop,BE2-PriceScale*up손절2,"",BV2,1);
ExitLong("bp2",Atlimit,BE2+PriceScale*up익절2,"",BV2,1);
ExitLong("btr2",AtStop,Bh2-PriceScale*upTR2,"",BV2,1);
}
}
}
else
{
Bxcond1 = false;
Bxcond2 = false;
}
즐거운 하루되세요
> 목마와숙녀 님이 쓴 글입니다.
> 제목 : 문의
> 아래수식의 손절,익절,TR,피라미딩은 1차 진입과 2차 진입에 공통으로 적용됩니다.
손절,익절,TR,피라미딩을
첫번째 진입과 두번째 진입에 각각 구분하여 적용하고 싶습니다.
*************************************************************************************
input : ntime(090000),n(1);
input : 고가갱신수(20);
input : uppyra검증(1.20);
input : 상승pyra(0.20),상승N(12);
input : up손절(99999),up익절(99999),upTR(99999);
if stime == ntime or (stime > ntime and stime[1] < ntime) Then{
if MaxEntries < n Then
buy("b1");
}
if MarketPosition == 1 and C >= EntryPrice+uppyra검증 and MaxContracts < 상승N Then
buy("bb",AtStop,LatestEntryPrice(0)+상승Pyra);
if MarketPosition == 0 and #현재무포지션이고
EntryDate(1) == sdate and #직전거래가 오늘 발생한 거래이고
MarketPosition(1) == 1 and #직전거래가 매수거래이고
countif(DayHigh(0) != DayHigh(0)[1],BarsSinceExit(1)) >= 고가갱신수 Then #청산이후 당일고가 갱신이 n회이상 있었으면
buy("b2");
if MarketPosition == 1 then
{
ExitLong("bl1",AtStop,EntryPrice-PriceScale*up손절);
ExitLong("bp1",Atlimit,EntryPrice+PriceScale*up익절);
ExitLong("btr1",AtStop,highest(h,BarsSinceEntry)-PriceScale*upTR);
}