커뮤니티
추가수식
2017-12-18 19:26:04
159
글번호 115089
아래식에서 진입횟수를 3회로한정하고싶습니다
Input : 당일수익틱수(80),당일손실틱수(80);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false),Tcond(false);
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if stime == 104500 or (stime > 104500 and stime[1] < 104500) Then{
Tcond = true;
Xcond = false;
N1 = NetProfit;
}
if stime == 113000 or (stime > 113000 and stime[1] < 113000) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(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,10);
var2 = ma(c,60);
if Tcond == true and Xcond == false and crossup(var1,var2) Then
buy("b",OnClose,def,2);
if Tcond == true and Xcond == false and CrossDown(var1,var2) Then
sell("s",OnClose,def,2);
if MarketPosition == 1 then
{
if CurrentContracts == MaxContracts then
ExitLong("bp1",AtLimit,EntryPrice+PriceScale*35,"",1,1);
Else
{
ExitLong("bp2",AtLimit,EntryPrice+PriceScale*80);
ExitLong("bx",AtStop,EntryPrice+PriceScale*5);
}
}
if MarketPosition == -1 then{
if CurrentContracts == MaxContracts then
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*35,"",1,1);
Else
{
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*80,"",1,1);
ExitShort("sx",AtStop,EntryPrice-PriceScale*5);
}
}
SetStopLoss(PriceScale*35,PointStop);
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));
}
답변 1
예스스탁 예스스탁 답변
2017-12-19 16:32:07
안녕하세요
예스스탁입니다.
Input : 당일수익틱수(80),당일손실틱수(80),당일진입횟수(3);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0);
var : Xcond(false),Tcond(false),T1(0),entry(0);
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if stime == 104500 or (stime > 104500 and stime[1] < 104500) Then{
Tcond = true;
Xcond = false;
N1 = NetProfit;
T1 = TotalTrades;
}
if stime == 113000 or (stime > 113000 and stime[1] < 113000) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if MarketPosition == 0 Then
entry = TotalTrades-T1;
Else
entry = TotalTrades-T1+1;
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(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,10);
var2 = ma(c,60);
if entry < 당일진입횟수 and Tcond == true and Xcond == false and crossup(var1,var2) Then
buy("b",OnClose,def,2);
if entry < 당일진입횟수 and Tcond == true and Xcond == false and CrossDown(var1,var2) Then
sell("s",OnClose,def,2);
if MarketPosition == 1 then
{
if CurrentContracts == MaxContracts then
ExitLong("bp1",AtLimit,EntryPrice+PriceScale*35,"",1,1);
Else
{
ExitLong("bp2",AtLimit,EntryPrice+PriceScale*80);
ExitLong("bx",AtStop,EntryPrice+PriceScale*5);
}
}
if MarketPosition == -1 then{
if CurrentContracts == MaxContracts then
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*35,"",1,1);
Else
{
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*80,"",1,1);
ExitShort("sx",AtStop,EntryPrice-PriceScale*5);
}
}
SetStopLoss(PriceScale*35,PointStop);
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));
}
즐거운 하루되세요
> 수원 님이 쓴 글입니다.
> 제목 : 추가수식
> 아래식에서 진입횟수를 3회로한정하고싶습니다
Input : 당일수익틱수(80),당일손실틱수(80);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false),Tcond(false);
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if stime == 104500 or (stime > 104500 and stime[1] < 104500) Then{
Tcond = true;
Xcond = false;
N1 = NetProfit;
}
if stime == 113000 or (stime > 113000 and stime[1] < 113000) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] and
(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,10);
var2 = ma(c,60);
if Tcond == true and Xcond == false and crossup(var1,var2) Then
buy("b",OnClose,def,2);
if Tcond == true and Xcond == false and CrossDown(var1,var2) Then
sell("s",OnClose,def,2);
if MarketPosition == 1 then
{
if CurrentContracts == MaxContracts then
ExitLong("bp1",AtLimit,EntryPrice+PriceScale*35,"",1,1);
Else
{
ExitLong("bp2",AtLimit,EntryPrice+PriceScale*80);
ExitLong("bx",AtStop,EntryPrice+PriceScale*5);
}
}
if MarketPosition == -1 then{
if CurrentContracts == MaxContracts then
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*35,"",1,1);
Else
{
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*80,"",1,1);
ExitShort("sx",AtStop,EntryPrice-PriceScale*5);
}
}
SetStopLoss(PriceScale*35,PointStop);
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));
}