커뮤니티
시스탬식좀 부탁합니다
2011-06-13 15:49:07
734
글번호 39691
macd
최근 50개봉 안에서 만족되고 최근 4번 상항 향 교차가 발생하는 봉의 최고가에다 최근4개봉의 atr 의 1/2을 다하고 이값에 buy stop 주문을 낸다
- 1. 2. MACD Breakout System.txt (0.00 MB)
답변 1
예스스탁 예스스탁 답변
2011-06-13 17:05:57
안녕하세요
예스스탁입니다.
Input: FastMA(9),SlowMA(26),MacdMA(4), NCOs(4), NBars(50), Trailbar(6);
Vars: MVal(0), MAvg(0), MDif(0), Counter(0), TotalBars(0), HighestHi(0), LowestLo(0);
Array: CO[2,50](0);
MVal = MACD(FastMA,SlowMA);
MAvg = ema(MACD(FastMA,SlowMA),MacdMA);
MDif = MVal - MAvg;
#{ Store the MACD Cross information in the CO array }
If crossup(MDif,0) OR CrossDown(MDIF,0) Then Begin
For counter = 0 to 49 Begin
CO[ 0 , 50 - Counter ] = CO[ 0 , 49 - Counter ];
CO[ 1 , 50 - Counter ] = CO[ 1 , 49 - Counter ];
CO[ 2 , 50 - Counter ] = CO[ 2 , 49 - Counter ];
End;
CO[ 0 , 0 ] = index;
CO[ 1, 0 ] = High;
CO[ 2, 0 ] = Low;
End;
#{ Find the Highest High and the Lowest Low of the cross over and under bars }
HighestHi = -1;
LowestLo = 9999;
For counter = 0 to NCOs-1 Begin
If CO[ 1 , counter ] > HighestHi then
HighestHi = CO[ 1 , counter ];
If CO[ 2 , counter ] < LowestLo then
LowestLo = CO[ 2 , counter ];
End;
#{ If the last N crosses occured in the last 50 bars, then place the buy and sell orders }
Totalbars = index - CO[ 0 , NCOs - 1];
If TotalBars < NBars then Begin
Buy("b",AtStop,HighestHi + ma(TrueRange,4)*0.5);
Sell("s",AtStop,LowestLo - Ma(TrueRange,4)*0.5);
End;
#{ Trailing stop orders }
ExitLong("bx",AtStop,Lowest( Low , TrailBar ));
ExitShort("sx",AtStop,Highest( High , TrailBar ));
즐거운 하루되세요
> 대두 님이 쓴 글입니다.
> 제목 : 시스탬식좀 부탁합니다
> macd
최근 50개봉 안에서 만족되고 최근 4번 상항 향 교차가 발생하는 봉의 최고가에다 최근4개봉의 atr 의 1/2을 다하고 이값에 buy stop 주문을 낸다