커뮤니티
수식 요청 드립이다.
2019-01-14 13:48:02
162
글번호 125238
안녕하세요.
아래 수식 당일목표수익 30틱 달성시 당일청산에서, 30틱 이상 달성한 이후 부터는
현재 매수일 경우 현재봉의 종가가 10이평을 하향 돌파하하거나 or 마지막 진입후
최고가에서 10% 하락시 당일청산
수식으로 변경요청 드립이다.
감사합니다
//----------------------------------------------------------------------------------
Input : 익절(15),손절(10),당일목표수익(30),당일목표손실(20);
input : 시작시간1(101500),종료시간1(125500),시작시간2(140000),종료시간2(151500);
Input : Period(12), sigPeriod(9);
var : Tcond(false);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
당일수익 = PriceScale*당일목표수익;
당일손실 = PriceScale*당일목표손실;
daypl = NetProfit-N1;
if (sdate != sdate[1] and stime >= 시작시간1) or
(sdate == sdate[1] and stime >= 시작시간1 and stime[1] < 시작시간1) Then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
}
if (sdate != sdate[1] and stime >= 종료시간1) or
(sdate == sdate[1] and stime >= 종료시간1 and stime[1] < 종료시간1) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx1");
if MarketPosition == -1 Then
ExitShort("sx1");
}
if (sdate != sdate[1] and stime >= 시작시간2) or
(sdate == sdate[1] and stime >= 시작시간2 and stime[1] < 시작시간2) Then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= 종료시간2) or
(sdate == sdate[1] and stime >= 종료시간2 and stime[1] < 종료시간2) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx2");
if MarketPosition == -1 Then
ExitShort("sx2");
}
if TotalTrades > TotalTrades[1] then
{
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
}
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
if Tcond == true and Xcond == false then
{
If CrossUP(value1, value2) Then
Buy("b");
If CrossDown(value1, value2) Then
Sell("s");
}
if MarketPosition == 1 and Xcond == false then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
ExitLong("bp",Atlimit,EntryPrice+PriceScale*익절);
ExitLong("bl",AtStop,EntryPrice-PriceScale*손절);
}
if MarketPosition == -1 and Xcond == false then
{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
ExitShort("sp",Atlimit,EntryPrice-PriceScale*익절);
ExitShort("sl",AtStop,EntryPrice+PriceScale*손절);
}
//----------------------------------------------------------------------------------
답변 1
예스스탁 예스스탁 답변
2019-01-14 16:30:17
안녕하세요
예스스탁입니다.
Input : 익절(15),손절(10),당일목표수익(30),당일목표손실(20);
input : 시작시간1(101500),종료시간1(125500),시작시간2(140000),종료시간2(151500);
Input : Period(12), sigPeriod(9);
var : Tcond(false);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
당일수익 = PriceScale*당일목표수익;
당일손실 = PriceScale*당일목표손실;
daypl = NetProfit-N1;
if (sdate != sdate[1] and stime >= 시작시간1) or
(sdate == sdate[1] and stime >= 시작시간1 and stime[1] < 시작시간1) Then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
}
if (sdate != sdate[1] and stime >= 종료시간1) or
(sdate == sdate[1] and stime >= 종료시간1 and stime[1] < 종료시간1) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx1");
if MarketPosition == -1 Then
ExitShort("sx1");
}
if (sdate != sdate[1] and stime >= 시작시간2) or
(sdate == sdate[1] and stime >= 시작시간2 and stime[1] < 시작시간2) Then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= 종료시간2) or
(sdate == sdate[1] and stime >= 종료시간2 and stime[1] < 종료시간2) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx2");
if MarketPosition == -1 Then
ExitShort("sx2");
}
if TotalTrades > TotalTrades[1] then
{
if (IsExitName("dbp1",1) == true or IsExitName("dbp2",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp1",1) == true or IsExitName("dsp2",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
}
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
value3 = ma(C,10);
if Tcond == true and Xcond == false then
{
If CrossUP(value1, value2) Then
Buy("b");
If CrossDown(value1, value2) Then
Sell("s");
}
if MarketPosition == 1 and Xcond == false then
{
if highest(H,BarsSinceEntry) >= EntryPrice+((당일수익-daypl)/CurrentContracts) then
{
ExitLong("dbp1",AtStop,highest(H,BarsSinceEntry)-(highest(H,BarsSinceEntry)-EntryPrice)*0.1);
if CrossDown(c,value3) Then
ExitLong("dbp2");
}
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
ExitLong("bp",Atlimit,EntryPrice+PriceScale*익절);
ExitLong("bl",AtStop,EntryPrice-PriceScale*손절);
}
if MarketPosition == -1 and Xcond == false then
{
if lowest(L,BarsSinceEntry) <= EntryPrice-((당일수익-daypl)/CurrentContracts) Then
{
ExitShort("dsp1",AtStop,Lowest(L,BarsSinceEntry)+(EntryPrice-lowest(L,BarsSinceEntry))*0.1);
if crossup(c,value3) Then
ExitShort("dsp2");
}
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
ExitShort("sp",Atlimit,EntryPrice-PriceScale*익절);
ExitShort("sl",AtStop,EntryPrice+PriceScale*손절);
}
즐거운 하루되세요
> dandy 님이 쓴 글입니다.
> 제목 : 수식 요청 드립이다.
> 안녕하세요.
아래 수식 당일목표수익 30틱 달성시 당일청산에서, 30틱 이상 달성한 이후 부터는
현재 매수일 경우 현재봉의 종가가 10이평을 하향 돌파하하거나 or 마지막 진입후
최고가에서 10% 하락시 당일청산
수식으로 변경요청 드립이다.
감사합니다
//----------------------------------------------------------------------------------
Input : 익절(15),손절(10),당일목표수익(30),당일목표손실(20);
input : 시작시간1(101500),종료시간1(125500),시작시간2(140000),종료시간2(151500);
Input : Period(12), sigPeriod(9);
var : Tcond(false);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
당일수익 = PriceScale*당일목표수익;
당일손실 = PriceScale*당일목표손실;
daypl = NetProfit-N1;
if (sdate != sdate[1] and stime >= 시작시간1) or
(sdate == sdate[1] and stime >= 시작시간1 and stime[1] < 시작시간1) Then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
}
if (sdate != sdate[1] and stime >= 종료시간1) or
(sdate == sdate[1] and stime >= 종료시간1 and stime[1] < 종료시간1) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx1");
if MarketPosition == -1 Then
ExitShort("sx1");
}
if (sdate != sdate[1] and stime >= 시작시간2) or
(sdate == sdate[1] and stime >= 시작시간2 and stime[1] < 시작시간2) Then
{
Tcond = true;
}
if (sdate != sdate[1] and stime >= 종료시간2) or
(sdate == sdate[1] and stime >= 종료시간2 and stime[1] < 종료시간2) Then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx2");
if MarketPosition == -1 Then
ExitShort("sx2");
}
if TotalTrades > TotalTrades[1] then
{
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
}
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
if Tcond == true and Xcond == false then
{
If CrossUP(value1, value2) Then
Buy("b");
If CrossDown(value1, value2) Then
Sell("s");
}
if MarketPosition == 1 and Xcond == false then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
ExitLong("bp",Atlimit,EntryPrice+PriceScale*익절);
ExitLong("bl",AtStop,EntryPrice-PriceScale*손절);
}
if MarketPosition == -1 and Xcond == false then
{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
ExitShort("sp",Atlimit,EntryPrice-PriceScale*익절);
ExitShort("sl",AtStop,EntryPrice+PriceScale*손절);
}
//----------------------------------------------------------------------------------
다음글
이전글