예스스탁
예스스탁 답변
2021-05-21 15:49:22
안녕하세요
예스스탁입니다.
진입가대비 100틱으로 수정해 드립니다.
1
Input : 당일수익틱수(200);
var : entry(0),mav1(0),mav2(0);
var : B(0),S(0),LL(0),HH(0);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false);
if bdate != bdate[1] Then
{
entry = 0;
Condition1 = False;
Xcond = false;
N1 = NetProfit;
}
당일수익 = PriceScale*당일수익틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
}
mav1 = ma(C,2);
mav2 = ma(c,10);
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Condition1 == false and L <= DayHigh-PriceScale*100 Then
{
Condition1 = true;
B = 0;
}
if Condition1 == true Then
{
if CrossUp(mav1,mav2) Then
{
B = B+1;
if B == 2 and MarketPosition <= 0 and entry < 1 and Xcond == false Then
{
B = 3;
Buy("b");
}
}
}
if MarketPosition == 1 Then
{
exitlong("bx",atlimit,entryprice+PriceScale*100);
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
if CrossDown(mav1,mav2) Then
ExitLong();
if BarsSinceEntry == 8 Then
LL = Lowest(L,17);
if BarsSinceEntry >= 8 Then
ExitLong("bx2",AtStop,LL-PriceScale*2);
}
if Condition2 == false and H >= DayLow+PriceScale*100 Then
{
Condition2 = true;
S = 0;
}
if Condition2 == true Then
{
if CrossDown(mav1,mav2) Then
{
S = S+1;
if S == 2 and MarketPosition >= 0 and entry < 1 and Xcond == false Then
Sell("s");
}
}
if MarketPosition == -1 Then
{
ExitShort("sx",atlimit,entryprice-PriceScale*100);
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
if CrossDown(mav1,mav2) Then
ExitShort();
if BarsSinceEntry == 8 Then
HH = Lowest(H,17);
if BarsSinceEntry >= 8 Then
ExitShort("sx2",AtStop,HH+PriceScale*2);
}
if sdate != sdate[1] Then
SetStopEndofday(55000);
if bdate != bdate[1] Then
SetStopEndofday(0);
2
input : StartTime1(070000),EndTime1(220000),진입횟수1(1);
input : StartTime2(220000),EndTime2(055000),진입횟수2(2);
input : Xtime(055000),당일수익틱수(200);
var : entry(0),Tcond1(false),Tcond2(False);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false),mav1(0),mav2(0),B(0),S(0),HH(0),LL(0);
mav1 = ma(C,2);
mav2 = ma(c,10);
if (sdate != sdate[1] and stime >= EndTime1) or
(sdate == sdate[1] and stime >= EndTime1 and stime[1] < EndTime1) Then
Tcond1 = False;
if (sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond1 = true;
entry = 0;
Xcond = false;
N1 = NetProfit;
Condition1 = False;
Condition2 = False;
}
if (sdate != sdate[1] and stime >= EndTime2) or
(sdate == sdate[1] and stime >= EndTime2 and stime[1] < EndTime2) Then
Tcond2 = False;
if (sdate != sdate[1] and stime >= StartTime2) or
(sdate == sdate[1] and stime >= StartTime2 and stime[1] < StartTime2) Then
{
Tcond2 = true;
entry = 0;
Condition1 = False;
Condition2 = False;
}
당일수익 = PriceScale*당일수익틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Condition1 == false and L <= DayHigh-PriceScale*100 Then
{
Condition1 = true;
B = 0;
}
if Condition1 == true Then
{
if CrossUp(mav1,mav2) Then
{
B = B+1;
if B == 2 and MarketPosition <= 0 and Xcond == False and ((Tcond1 == true and entry < 진입횟수1) or (Tcond2 == true and entry < 진입횟수2)) Then
{
B = 3;
Buy("b");
}
}
}
if MarketPosition == 1 Then
{
exitlong("bx",atlimit,entryprice+PriceScale*100);
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
if CrossDown(mav1,mav2) Then
ExitLong();
if BarsSinceEntry == 8 Then
LL = Lowest(L,17);
if BarsSinceEntry >= 8 Then
ExitLong("bx2",AtStop,LL-PriceScale*2);
}
if Condition2 == false and H >= DayLow+PriceScale*100 Then
{
Condition2 = true;
S = 0;
}
if Condition2 == true Then
{
if CrossDown(mav1,mav2) Then
{
S = S+1;
if S == 2 and MarketPosition >= 0 and Xcond == False and ((Tcond1 == true and entry < 진입횟수1) or (Tcond2 == true and entry < 진입횟수2)) Then
Sell("s");
}
}
if MarketPosition == -1 Then
{
ExitShort("sx",atlimit,entryprice-PriceScale*100);
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
if CrossUp(mav1,mav2) Then
ExitShort();
if BarsSinceEntry == 8 Then
HH = Lowest(H,17);
if BarsSinceEntry >= 8 Then
ExitShort("sx2",AtStop,HH+PriceScale*2);
}
if sdate != sdate[1] Then
SetStopEndofday(Xtime);
if bdate != bdate[1] Then
SetStopEndofday(0);
즐거운 하루되세요
> 푸른 님이 쓴 글입니다.
> 제목 : 수식작성
> 1
Input : 당일수익틱수(200);
var : entry(0),mav1(0),mav2(0);
var : B(0),S(0),LL(0),HH(0);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false);
if bdate != bdate[1] Then
{
entry = 0;
Condition1 = False;
Xcond = false;
N1 = NetProfit;
}
당일수익 = PriceScale*당일수익틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
}
mav1 = ma(C,2);
mav2 = ma(c,10);
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Condition1 == false and L <= DayHigh-PriceScale*100 Then
{
Condition1 = true;
B = 0;
}
if Condition1 == true Then
{
if CrossUp(mav1,mav2) Then
{
B = B+1;
if B == 2 and MarketPosition <= 0 and entry < 1 and Xcond == false Then
{
B = 3;
Buy("b");
}
}
}
if MarketPosition == 1 Then
{
exitlong("bx",atlimit,lowest(L,BarsSinceEntry)+PriceScale*100);
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
if CrossDown(mav1,mav2) Then
ExitLong();
if BarsSinceEntry == 8 Then
LL = Lowest(L,17);
if BarsSinceEntry >= 8 Then
ExitLong("bx2",AtStop,LL-PriceScale*2);
}
if Condition2 == false and H >= DayLow+PriceScale*100 Then
{
Condition2 = true;
S = 0;
}
if Condition2 == true Then
{
if CrossDown(mav1,mav2) Then
{
S = S+1;
if S == 2 and MarketPosition >= 0 and entry < 1 and Xcond == false Then
Sell("s");
}
}
if MarketPosition == -1 Then
{
ExitShort("sx",atlimit,Highest(H,BarsSinceEntry)-PriceScale*100);
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
if CrossDown(mav1,mav2) Then
ExitShort();
if BarsSinceEntry == 8 Then
HH = Lowest(H,17);
if BarsSinceEntry >= 8 Then
ExitShort("sx2",AtStop,HH+PriceScale*2);
}
if sdate != sdate[1] Then
SetStopEndofday(55000);
if bdate != bdate[1] Then
SetStopEndofday(0);
2
input : StartTime1(070000),EndTime1(220000),진입횟수1(1);
input : StartTime2(220000),EndTime2(055000),진입횟수2(2);
input : Xtime(055000),당일수익틱수(200);
var : entry(0),Tcond1(false),Tcond2(False);
Var : N1(0),dayPl(0),당일수익(0),Xcond(false),mav1(0),mav2(0),B(0),S(0),HH(0),LL(0);
mav1 = ma(C,2);
mav2 = ma(c,10);
if (sdate != sdate[1] and stime >= EndTime1) or
(sdate == sdate[1] and stime >= EndTime1 and stime[1] < EndTime1) Then
Tcond1 = False;
if (sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond1 = true;
entry = 0;
Xcond = false;
N1 = NetProfit;
Condition1 = False;
Condition2 = False;
}
if (sdate != sdate[1] and stime >= EndTime2) or
(sdate == sdate[1] and stime >= EndTime2 and stime[1] < EndTime2) Then
Tcond2 = False;
if (sdate != sdate[1] and stime >= StartTime2) or
(sdate == sdate[1] and stime >= StartTime2 and stime[1] < StartTime2) Then
{
Tcond2 = true;
entry = 0;
Condition1 = False;
Condition2 = False;
}
당일수익 = PriceScale*당일수익틱수;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dsp",1) == true) then
Xcond = true;
}
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if Condition1 == false and L <= DayHigh-PriceScale*100 Then
{
Condition1 = true;
B = 0;
}
if Condition1 == true Then
{
if CrossUp(mav1,mav2) Then
{
B = B+1;
if B == 2 and MarketPosition <= 0 and Xcond == False and ((Tcond1 == true and entry < 진입횟수1) or (Tcond2 == true and entry < 진입횟수2)) Then
{
B = 3;
Buy("b");
}
}
}
if MarketPosition == 1 Then
{
exitlong("bx",atlimit,lowest(L,BarsSinceEntry)+PriceScale*100);
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
if CrossDown(mav1,mav2) Then
ExitLong();
if BarsSinceEntry == 8 Then
LL = Lowest(L,17);
if BarsSinceEntry >= 8 Then
ExitLong("bx2",AtStop,LL-PriceScale*2);
}
if Condition2 == false and H >= DayLow+PriceScale*100 Then
{
Condition2 = true;
S = 0;
}
if Condition2 == true Then
{
if CrossDown(mav1,mav2) Then
{
S = S+1;
if S == 2 and MarketPosition >= 0 and Xcond == False and ((Tcond1 == true and entry < 진입횟수1) or (Tcond2 == true and entry < 진입횟수2)) Then
Sell("s");
}
}
if MarketPosition == -1 Then
{
ExitShort("sx",atlimit,Highest(H,BarsSinceEntry)-PriceScale*100);
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
if CrossUp(mav1,mav2) Then
ExitShort();
if BarsSinceEntry == 8 Then
HH = Lowest(H,17);
if BarsSinceEntry >= 8 Then
ExitShort("sx2",AtStop,HH+PriceScale*2);
}
if sdate != sdate[1] Then
SetStopEndofday(Xtime);
if bdate != bdate[1] Then
SetStopEndofday(0);
---------------------
검증중 청산이 원하는대로 되질않아서 그래프를 참고로 올립니다.
buy의 청산싯점이 진입 가격으로 됨에 +100틱에 청산으로 수정되는 수식어를 부탁드립니다.
반대포지션도 동일합니다.
늘 감사드립니다.