커뮤니티
부탁드립니다.
2015-06-08 15:54:31
155
글번호 86943
input : 익절틱수(100),당일수익(200);#틱수
input : 당일손실(150);#틱수
input : g(25),r(50),s(2);
Input : period1(12);
var : NP(0),PreNP(0),dayPL(0),Econd(false);
var : SMIv(0),T(0);
Var : sonarv(0);
sonarv = SONAR(period1);
SMIv = ema(ema(c-(highest(H,g) + lowest(L,g))*0.5, r),s) * 100 /
(0.5 * ema(ema(highest(H,g)-lowest(L,g),r),s)) ;
NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
If T == 1 and sonarv > sonarv[1] and C <= O Then
buy();
If T == -1 and sonarv < sonarv[1] and C >= O Then
sell();
}
}
if MarketPosition == 1 Then{
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*50 Then{
ExitLong("bx",AtStop,EntryPrice+PriceScale*1);
}
ExitLong("bx1",AtLimit,EntryPrice+((당일수익*PriceScale)-daypl));
ExitLong("bx2",AtStop,EntryPrice-((당일손실*PriceScale)+daypl));
}
if MarketPosition == -1 Then{
if Lowest(l,BarsSinceEntry) <= EntryPrice-PriceScale*50 Then{
ExitShort("sx",AtStop,EntryPrice-PriceScale*1);
}
ExitLong("sx1",AtLimit,EntryPrice-((당일수익*PriceScale)+daypl));
ExitLong("sx2",AtStop,EntryPrice+((당일손실*PriceScale)-daypl));
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
}
상기식이 제대로 실행이 안되어 다시 질문드립니다.
지금 sx1 에서 진입후 바로 청산이 되어버리면서 매매종료가 되어버리는듯합니다.
당일수익이 200틱 설정인데...몇틱수익이 아닌데도 sx1청산으로 매매종료되는것같네요.
검토후 수정부탁드립니다.
미리 감사드립니다.
답변 1
예스스탁 예스스탁 답변
2015-06-08 16:07:28
안녕하세요
예스스탁입니다.
매도포지션을 청산하는 함수는 exitshort입니다.
현재 올리신 수식에 sx1과 sx2가 exitlong으로 되어 있습니다.
input : 익절틱수(100),당일수익(200);#틱수
input : 당일손실(150);#틱수
input : g(25),r(50),s(2);
Input : period1(12);
var : NP(0),PreNP(0),dayPL(0),Econd(false);
var : SMIv(0),T(0);
Var : sonarv(0);
sonarv = SONAR(period1);
SMIv = ema(ema(c-(highest(H,g) + lowest(L,g))*0.5, r),s) * 100 /
(0.5 * ema(ema(highest(H,g)-lowest(L,g),r),s)) ;
NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
If T == 1 and sonarv > sonarv[1] and C <= O Then
buy();
If T == -1 and sonarv < sonarv[1] and C >= O Then
sell();
}
}
if MarketPosition == 1 Then{
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*50 Then{
ExitLong("bx",AtStop,EntryPrice+PriceScale*1);
}
ExitLong("bx1",AtLimit,EntryPrice+((당일수익*PriceScale)-daypl));
ExitLong("bx2",AtStop,EntryPrice-((당일손실*PriceScale)+daypl));
}
if MarketPosition == -1 Then{
if Lowest(l,BarsSinceEntry) <= EntryPrice-PriceScale*50 Then{
ExitShort("sx",AtStop,EntryPrice-PriceScale*1);
}
ExitShort("sx1",AtLimit,EntryPrice-((당일수익*PriceScale)+daypl));
ExitShort("sx2",AtStop,EntryPrice+((당일손실*PriceScale)-daypl));
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
}
즐거운 하루되세요
> vmfha 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> input : 익절틱수(100),당일수익(200);#틱수
input : 당일손실(150);#틱수
input : g(25),r(50),s(2);
Input : period1(12);
var : NP(0),PreNP(0),dayPL(0),Econd(false);
var : SMIv(0),T(0);
Var : sonarv(0);
sonarv = SONAR(period1);
SMIv = ema(ema(c-(highest(H,g) + lowest(L,g))*0.5, r),s) * 100 /
(0.5 * ema(ema(highest(H,g)-lowest(L,g),r),s)) ;
NP = NetProfit;
if bdate != bdate[1] Then{
PreNP = NP[1];
Econd = false;
}
dayPL = NP-PreNP;
if BarsSinceExit(1) == 1 and (IsExitName("bx1",1) or IsExitName("sx1",1)) Then
Econd = true;
if Econd == false Then{
if stime >= 090000 or stime < 020000 then{
if SMIv > SMIv[1] Then
T = 1;
if SMIv < SMIv[1] Then
T = -1;
If T == 1 and sonarv > sonarv[1] and C <= O Then
buy();
If T == -1 and sonarv < sonarv[1] and C >= O Then
sell();
}
}
if MarketPosition == 1 Then{
if highest(h,BarsSinceEntry) >= EntryPrice+PriceScale*50 Then{
ExitLong("bx",AtStop,EntryPrice+PriceScale*1);
}
ExitLong("bx1",AtLimit,EntryPrice+((당일수익*PriceScale)-daypl));
ExitLong("bx2",AtStop,EntryPrice-((당일손실*PriceScale)+daypl));
}
if MarketPosition == -1 Then{
if Lowest(l,BarsSinceEntry) <= EntryPrice-PriceScale*50 Then{
ExitShort("sx",AtStop,EntryPrice-PriceScale*1);
}
ExitLong("sx1",AtLimit,EntryPrice-((당일수익*PriceScale)+daypl));
ExitLong("sx2",AtStop,EntryPrice+((당일손실*PriceScale)-daypl));
}
SetStopProfittarget(PriceScale*익절틱수, PointStop);
if stime == 050000 or (stime > 050000 and stime[1] < 050000) Then{
ExitLong();
ExitShort();
}
상기식이 제대로 실행이 안되어 다시 질문드립니다.
지금 sx1 에서 진입후 바로 청산이 되어버리면서 매매종료가 되어버리는듯합니다.
당일수익이 200틱 설정인데...몇틱수익이 아닌데도 sx1청산으로 매매종료되는것같네요.
검토후 수정부탁드립니다.
미리 감사드립니다.
이전글