커뮤니티
부탁드립니다.
2013-07-11 08:57:54
453
글번호 65223
안녕하세요?
아래의 식은 인베스트라의 책 내용중 일부분입니다.
아래의 식을 예스랭귀지로 부탁드립니다. 감사합니다.
무더우신데 항상 건강하세요...
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(Close,FastMA,SlowMA);
MAvg = XAverage(MACD(Close,FastMA,SlowMA),MacdMA);
MDif = MVal - MAvg;
{ Store the MACD Cross information in the CO array }
If MDif Crosses Over 0 OR MDIF Crosses Under 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 ] = BarNumber;
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 = BarNumber - CO[ 0 , NCOs - 1];
If TotalBars < NBars then Begin
Buy at HighestHi + Average(TrueRange,4)*.5 stop;
Sell at LowestLo - Average(TrueRange,4)*.5 stop;
End;
{ Trailing stop orders }
ExitLong next bar at Lowest( Low , TrailBar ) Stop;
ExitShort next bar at Highest( High , TrailBar ) Stop;
답변 1
예스스탁 예스스탁 답변
2013-07-11 14:34:54
안녕하세요
예스스탁입니다.
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[3,51](0);
MVal = MACD(FastMA,SlowMA);
MAvg = ema(MVal,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 ));
즐거운 하루되세요
> 에리조나 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 안녕하세요?
아래의 식은 인베스트라의 책 내용중 일부분입니다.
아래의 식을 예스랭귀지로 부탁드립니다. 감사합니다.
무더우신데 항상 건강하세요...
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(Close,FastMA,SlowMA);
MAvg = XAverage(MACD(Close,FastMA,SlowMA),MacdMA);
MDif = MVal - MAvg;
{ Store the MACD Cross information in the CO array }
If MDif Crosses Over 0 OR MDIF Crosses Under 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 ] = BarNumber;
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 = BarNumber - CO[ 0 , NCOs - 1];
If TotalBars < NBars then Begin
Buy at HighestHi + Average(TrueRange,4)*.5 stop;
Sell at LowestLo - Average(TrueRange,4)*.5 stop;
End;
{ Trailing stop orders }
ExitLong next bar at Lowest( Low , TrailBar ) Stop;
ExitShort next bar at Highest( High , TrailBar ) Stop;