커뮤니티
재진입(재질문_전저점)
2011-06-16 15:50:17
624
글번호 39869
항상 친절한 답변 감사합니다.
아래의 식이 제가 수정해보고있는 수식인데요. 전저점에서 진입이 안되네요.
어디가 잘못되었는지 알려주세요.
그 아래의 식은 제가 테스트해본건데요, 여기서는 전저점 진입이 됩니다. 어떤 차이점때문인지 모르겠네요. 답변 부탁드립니다.
--------------재진입이 안되는 수식(연결선물5분봉)-------------------------------
Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(100);
Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999), ReCnt(0), MP(0);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice );
If MarketPosition == 1 then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
}
If MarketPosition == -1 then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
}
//재진입
MP = MarketPosition;
If MP == 0 AND MP[1] == -1 then
ReCnt = 1;
If MP == 0 AND MP[1] == 1 then
ReCnt = 1;
If MarketPosition == 0 AND MarketPosition(1) == -1 and
IsExitName("ShortTStop",1) == True AND ReCnt < ReBars then {
ReCnt = ReCnt + 1;
Sell ("sell_2nd", AtStop, Lowest(L,BarsSinceEntry)[BarsSinceExit(1)]);
}
----------------테스트수식(연결선물일봉)-------------------------------------
Input : Period(25), Dv(1.5);
Var : BBup(0), BBdown(0), 가격(0), 추세(0), MP(0), Recnt(0);
BBup = BollBandUp(period,Dv);
BBdown = BollBandDown(period,Dv);
가격 = ma(C,3);
추세 = ma(C,period);
if MarketPosition == 0 or -1 Then
{
if CrossUp(가격,BBup) Then
Buy("BL");
}
if MarketPosition == 0 or 1 Then
{
if CrossDown(가격,BBdown) Then
sell("SS");
}
if MarketPosition == 1 and IsEntryName("BL",0) == True Then {
if CrossDown(가격,추세) and 가격 > BBdown Then
ExitLong("EL");
}
if MarketPosition == -1 and (IsEntryName("SS",0) == True or IsEntryName("SS2",0) == True) Then
{
if CrossUp(가격,추세) and 가격 < BBup Then
ExitShort("ES");
}
If MarketPosition == 0 AND MarketPosition(1) == -1 then {
If IsExitName("ES",1) == True then {
Sell ("SS2", AtStop, (lowest(L,BarsSinceEntry)[BarsSinceExit(1)]-2));
}
}
답변 1
예스스탁 예스스탁 답변
2011-06-16 16:52:53
안녕하세요
예스스탁입니다.
청산식이 봉중간에 신호가 발생하는 타입(atstop)이므로
발생하지 않았습니다.
청산에서 모든 신호타입에 맞는 식으로 변경해서 올려드립니다.
Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(100);
Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999), ReCnt(0), MP(0);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice );
If MarketPosition == 1 then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
}
If MarketPosition == -1 then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
}
//재진입
MP = MarketPosition;
If MP == 0 AND MP[1] == -1 then
ReCnt = 1;
If MP == 0 AND MP[1] == 1 then
ReCnt = 1;
#가장 최근 매도포지션구간의 최저점
if MarketPosition == -1 Then
var1 = lowest(L,BarsSinceEntry);
If MarketPosition == 0 AND MarketPosition(1) == -1 and IsExitName("ShortTStop",1) == True AND ReCnt < ReBars then {
ReCnt = ReCnt + 1;
Sell ("sell_2nd", AtStop,var1);
}
즐거운 하루되세요
> 공감n감사 님이 쓴 글입니다.
> 제목 : 재진입(재질문_전저점)
> 항상 친절한 답변 감사합니다.
아래의 식이 제가 수정해보고있는 수식인데요. 전저점에서 진입이 안되네요.
어디가 잘못되었는지 알려주세요.
그 아래의 식은 제가 테스트해본건데요, 여기서는 전저점 진입이 됩니다. 어떤 차이점때문인지 모르겠네요. 답변 부탁드립니다.
--------------재진입이 안되는 수식(연결선물5분봉)-------------------------------
Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), ReBars(100);
Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999), ReCnt(0), MP(0);
FastMA = ma(C , FastLen );
SlowMA = ma(C , SlowLen );
If CrossUp(FastMA , SlowMA) and index > 1 then {
LEntryPrice = Highest(H , TrailBar )[1];
LCount = index;
}
If MarketPosition <> 1 AND index < LCount + ChLen then
Buy ("Cross Over Buy", atstop,LEntryPrice);
If CrossDown(FastMA , SlowMA) and index > 1 then {
SEntryPrice = Lowest(L , TrailBar )[1];
SCount = index;
}
If MarketPosition <> -1 AND index < SCount + ChLen then
Sell ("Cross Under Sell", atstop,SEntryPrice );
If MarketPosition == 1 then {
LCount = -999;
ExitLong ("LongTStop", atstop, Lowest(L , TrailBar ));
}
If MarketPosition == -1 then {
SCount = -999;
ExitShort ("ShortTStop", atstop, Highest(H , TrailBar ));
}
//재진입
MP = MarketPosition;
If MP == 0 AND MP[1] == -1 then
ReCnt = 1;
If MP == 0 AND MP[1] == 1 then
ReCnt = 1;
If MarketPosition == 0 AND MarketPosition(1) == -1 and
IsExitName("ShortTStop",1) == True AND ReCnt < ReBars then {
ReCnt = ReCnt + 1;
Sell ("sell_2nd", AtStop, Lowest(L,BarsSinceEntry)[BarsSinceExit(1)]);
}
----------------테스트수식(연결선물일봉)-------------------------------------
Input : Period(25), Dv(1.5);
Var : BBup(0), BBdown(0), 가격(0), 추세(0), MP(0), Recnt(0);
BBup = BollBandUp(period,Dv);
BBdown = BollBandDown(period,Dv);
가격 = ma(C,3);
추세 = ma(C,period);
if MarketPosition == 0 or -1 Then
{
if CrossUp(가격,BBup) Then
Buy("BL");
}
if MarketPosition == 0 or 1 Then
{
if CrossDown(가격,BBdown) Then
sell("SS");
}
if MarketPosition == 1 and IsEntryName("BL",0) == True Then {
if CrossDown(가격,추세) and 가격 > BBdown Then
ExitLong("EL");
}
if MarketPosition == -1 and (IsEntryName("SS",0) == True or IsEntryName("SS2",0) == True) Then
{
if CrossUp(가격,추세) and 가격 < BBup Then
ExitShort("ES");
}
If MarketPosition == 0 AND MarketPosition(1) == -1 then {
If IsExitName("ES",1) == True then {
Sell ("SS2", AtStop, (lowest(L,BarsSinceEntry)[BarsSinceExit(1)]-2));
}
}