커뮤니티
[STAD_04] LinReg_Mom
2014-03-25 05:03:17
235
글번호 73797
Inputs: LRLen(700), AvgLen(600), MomLen(300), Pcnt(1.0), exitPeriod(40);
Vars: XLinReg(0), Mom(0), SetBarH(0), SetBarL(0), SetBarS(0), CountL(0), CountS(0);
//Assignment of Exponential Linear Regression and Momentum
XLinReg = ema(LRL(Close, LRLen), AvgLen);
Mom = Momentum(MomLen);
//Accumulates to count the bars after the SetUps below}
CountL = CountL + 1;
CountS = CountS + 1;
//Assignment of System Entry/Exit criteria}
Condition1 = XLinReg > XLinReg[1];
Condition2 = Mom < 0 AND Mom > Mom[1];
Condition3 = XLinReg < XLinReg[1];
Condition4 = Mom > 0 AND Mom < Mom[1];
---------------------------------------------------------------------------------
//Check criteria and generate Buy order if criteria have been met within 4 bars
IF Condition1 AND Condition2 Then Begin
IF CountL == 1 OR CountL > 4 Then Begin
SetBarL = High;
CountL = 1;
End;
IF CountL <= 4 and EntriesToday(date) < 1 Then Begin
value1 = Pcnt * (SetBarL - XLinReg);
Buy ("Long", atstop, SetBarL + value1);
End;
End;
------------------------------------------------------------------
이부분 설명좀 달아주시면 감사하겠습니다 부탁드립니다
//Check criteria and generate Sell order if criteria have been met within 4 bars
IF Condition3 AND Condition4 Then Begin
IF CountS == 1 OR CountS > 4 Then Begin
SetBarS = Low;
CountS = 1;
End;
IF CountS <= 4 and EntriesToday(date) < 1 Then Begin
value1 = Pcnt * (SetBarS - XLinReg);
Sell ("Short", atstop, SetBarS - value1);
End;
End;
//Initial Stops
ExitLong ("X", atstop, L[BarsSinceEntry] - (Pcnt * ATR(10)));
ExitShort ("Y", atstop, H[BarsSinceEntry]+ (Pcnt * ATR(10)));
//Trailing Stops
IF Condition3 AND Low < Lowest(Low, exitPeriod)[1] Then
ExitLong("EL", atmarket);
IF Condition1 AND High > Highest(High, exitPeriod)[1] Then
ExitShort("ES", atmarket) ;
SetStopEndofday(1500);
답변 1
예스스탁 예스스탁 답변
2014-03-25 17:12:05
안녕하세요
예스스탁입니다.
변환된 내용상 잘못된 부분이 있어 수정했습니다.
Condition2 = Mom < 0 AND Mom > Mom[1];은
Condition2 = Mom < 100 AND Mom > Mom[1];로 변경했습니다.
아래내용 참고하시기 바랍니다.
Inputs: LRLen(700), AvgLen(600), MomLen(300), Pcnt(1.0), exitPeriod(40);
Vars: XLinReg(0), Mom(0), SetBarH(0), SetBarL(0), SetBarS(0), CountL(0), CountS(0);
//Assignment of Exponential Linear Regression and Momentum
XLinReg = ema(LRL(Close, LRLen), AvgLen);
Mom = Momentum(MomLen);
//Accumulates to count the bars after the SetUps below}
CountL = CountL + 1;
CountS = CountS + 1;
//Assignment of System Entry/Exit criteria}
Condition1 = XLinReg > XLinReg[1];
Condition2 = Mom < 100 AND Mom > Mom[1];
Condition3 = XLinReg < XLinReg[1];
Condition4 = Mom > 0 AND Mom < Mom[1];
//---------------------------------------------------------------------------------
IF Condition1 AND Condition2 Then Begin # 조건1(LRL시그널이 전봉보다 크고 모멘텀이 전봉보다 크고)
//조건1이 만족했을때 5이상이면(CountL == 1은 큰 의미가 없습니다. 차트첫봉에 조건만족을 염두에둔 내용입니다.)
//즉 이전조건만족했을때와 현재조건만족했을때의 봉수의 차이가 5개 이상이면 봉카운트를 초기화
IF CountL == 1 OR CountL > 4 Then Begin
//SetBarL에 고가저장
SetBarL = High;
//봉카운트는 1로 초기화
CountL = 1;
End;
//봉카운트 4이하이고 당일 진입이 아직 없을때
IF CountL <= 4 and EntriesToday(date) < 1 Then Begin
//value1에 SetBarL과 LRL시그널의 차이값의 Pcnt배수 저장
value1 = Pcnt * (SetBarL - XLinReg);
//SetBarL+value1보다 높은 시세가 발생하면 매수
Buy ("Long", atstop, SetBarL + value1);
End;
End;
//------------------------------------------------------------------
즐거운 하루되세요
> cinamon 님이 쓴 글입니다.
> 제목 : [STAD_04] LinReg_Mom
> Inputs: LRLen(700), AvgLen(600), MomLen(300), Pcnt(1.0), exitPeriod(40);
Vars: XLinReg(0), Mom(0), SetBarH(0), SetBarL(0), SetBarS(0), CountL(0), CountS(0);
//Assignment of Exponential Linear Regression and Momentum
XLinReg = ema(LRL(Close, LRLen), AvgLen);
Mom = Momentum(MomLen);
//Accumulates to count the bars after the SetUps below}
CountL = CountL + 1;
CountS = CountS + 1;
//Assignment of System Entry/Exit criteria}
Condition1 = XLinReg > XLinReg[1];
Condition2 = Mom < 0 AND Mom > Mom[1];
Condition3 = XLinReg < XLinReg[1];
Condition4 = Mom > 0 AND Mom < Mom[1];
---------------------------------------------------------------------------------
//Check criteria and generate Buy order if criteria have been met within 4 bars
IF Condition1 AND Condition2 Then Begin
IF CountL == 1 OR CountL > 4 Then Begin
SetBarL = High;
CountL = 1;
End;
IF CountL <= 4 and EntriesToday(date) < 1 Then Begin
value1 = Pcnt * (SetBarL - XLinReg);
Buy ("Long", atstop, SetBarL + value1);
End;
End;
------------------------------------------------------------------
이부분 설명좀 달아주시면 감사하겠습니다 부탁드립니다
//Check criteria and generate Sell order if criteria have been met within 4 bars
IF Condition3 AND Condition4 Then Begin
IF CountS == 1 OR CountS > 4 Then Begin
SetBarS = Low;
CountS = 1;
End;
IF CountS <= 4 and EntriesToday(date) < 1 Then Begin
value1 = Pcnt * (SetBarS - XLinReg);
Sell ("Short", atstop, SetBarS - value1);
End;
End;
//Initial Stops
ExitLong ("X", atstop, L[BarsSinceEntry] - (Pcnt * ATR(10)));
ExitShort ("Y", atstop, H[BarsSinceEntry]+ (Pcnt * ATR(10)));
//Trailing Stops
IF Condition3 AND Low < Lowest(Low, exitPeriod)[1] Then
ExitLong("EL", atmarket);
IF Condition1 AND High > Highest(High, exitPeriod)[1] Then
ExitShort("ES", atmarket) ;
SetStopEndofday(1500);