커뮤니티
안녕하세요
2019-10-11 13:30:09
129
글번호 132695
아래식에서 매매횟수를 5 회로 한정할수있게 인풋으로 부탁합니다
input : starttime(100000),endtime(050000);
input : P1(5),P2(20);
input : 익절틱수(50),손절틱수(50);
Input : 당일수익틱수(80),당일손실틱수(80);
var : Tcond(false);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
}
var1 = ma(C,P1);
var2 = ma(C,P2);
if Tcond == true then
{
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;
if Xcond == false then
{
if crossup(var1,var2) Then
buy("b");
if CrossDown(var1,var2) Then
sell("s");
}
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));
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
답변 1
예스스탁 예스스탁 답변
2019-10-11 14:29:51
안녕하세요
예스스탁입니다.
input : starttime(100000),endtime(050000);
input : P1(5),P2(20);
input : 익절틱수(50),손절틱수(50);
Input : 당일수익틱수(80),당일손실틱수(80);
input : 당일진입횟수(5);
var : Tcond(false),entry(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
entry = 0;
}
var1 = ma(C,P1);
var2 = ma(C,P2);
if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then
entry = entry+1;
if Tcond == true then
{
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;
if Xcond == false and entry < 당일진입횟수 then
{
if crossup(var1,var2) Then
buy("b");
if CrossDown(var1,var2) Then
sell("s");
}
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));
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 수원 님이 쓴 글입니다.
> 제목 : 안녕하세요
> 아래식에서 매매횟수를 5 회로 한정할수있게 인풋으로 부탁합니다
input : starttime(100000),endtime(050000);
input : P1(5),P2(20);
input : 익절틱수(50),손절틱수(50);
Input : 당일수익틱수(80),당일손실틱수(80);
var : Tcond(false);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
Xcond = false;
N1 = NetProfit;
}
var1 = ma(C,P1);
var2 = ma(C,P2);
if Tcond == true then
{
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;
if Xcond == false then
{
if crossup(var1,var2) Then
buy("b");
if CrossDown(var1,var2) Then
sell("s");
}
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));
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);