커뮤니티
부탁드립니다.
2013-06-07 14:24:41
292
글번호 64092
안녕하세요? 담당자님.
항상 감사드리며 공부삼아 코딩연습하는데 잘 안됩니다.
예스랭귀지로 번역부탁합니다.
진심으로 감사합니다.
Inputs: XMALen(4), VolLen(8), MultFact(2);
Vars: TopBand(0), BotBand(0), XAvg(0), FastMA(0), MedMA(0), SlowMA(0),
BullTrend(false), BearTrend(false);
{ Define initial Top and Bottom Band }
If BarNumber = 1 then Begin
TopBand = Open + Volatility( VolLen ) * MultFact;
BotBand = Open - Volatility( VolLen ) * Multfact;
End;
{ Define market mode with 3 line Moving averages }
XAvg = XAverage( Close , XMALen );
FastMA = Average( Close, 4 );
MedMA = Average( Close, 9 );
SlowMA = Average( Close, 18 );
BullTrend = FastMA > MedMA AND MedMA > SlowMA;
BearTrend = FastMA < MedMA AND MedMA < SlowMA;
{ Place long entry orders }
If XAvg > TopBand AND BullTrend then begin
Buy this bar at close;
BotBand = TopBand;
TopBand = TopBand + Volatility( VolLen ) * MultFact;
End;
{ Place short entry orders }
If XAvg < BotBand AND BearTrend then begin
Sell this bar at close;
TopBand = BotBand;
BotBand = BotBand - Volatility( VolLen ) * MultFact;
End;
{ Place long and short exit orders }
If MarketPosition = 1 then
ExitLong next bar at BotBand stop;
If MarketPosition = -1 then
ExitShort next bar at TopBand stop;
답변 1
예스스탁 예스스탁 답변
2013-06-10 10:13:42
안녕하세요
예스스탁입니다.
Inputs: XMALen(4), VolLen(8), MultFact(2);
Vars: TopBand(0), BotBand(0), XAvg(0), FastMA(0), MedMA(0), SlowMA(0),
BullTrend(false), BearTrend(false),Volatility(0);
#Volatility
If CurrentBar >= 1 AND VolLen <> 0 Then Begin
If CurrentBar == 1 Then
Volatility = TrueRange;
Else
Volatility = ((VolLen - 1) * Volatility + TrueRange) / VolLen;
End;
##{ Define initial Top and Bottom Band }
If CurrentBar == 1 then Begin
TopBand = Open + Volatility * MultFact;
BotBand = Open - Volatility * Multfact;
End;
#{ Define market mode with 3 line Moving averages }
XAvg = Ema( Close , XMALen );
FastMA = ma( Close, 4 );
MedMA = ma( Close, 9 );
SlowMA = ma( Close, 18 );
BullTrend = FastMA > MedMA AND MedMA > SlowMA;
BearTrend = FastMA < MedMA AND MedMA < SlowMA;
#{ Place long entry orders }
If XAvg > TopBand AND BullTrend then begin
Buy("b",OnClose);
BotBand = TopBand;
TopBand = TopBand + Volatility * MultFact;
End;
#{ Place short entry orders }
If XAvg < BotBand AND BearTrend then begin
Sell("s",OnClose);
TopBand = BotBand;
BotBand = BotBand - Volatility * MultFact;
End;
#{ Place long and short exit orders }
If MarketPosition == 1 then
ExitLong("bx",AtStop, BotBand);
If MarketPosition == -1 then
ExitShort("sx",AtStop,TopBand);
즐거운 하루되세요
> 에리조나 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 안녕하세요? 담당자님.
항상 감사드리며 공부삼아 코딩연습하는데 잘 안됩니다.
예스랭귀지로 번역부탁합니다.
진심으로 감사합니다.
Inputs: XMALen(4), VolLen(8), MultFact(2);
Vars: TopBand(0), BotBand(0), XAvg(0), FastMA(0), MedMA(0), SlowMA(0),
BullTrend(false), BearTrend(false);
{ Define initial Top and Bottom Band }
If BarNumber = 1 then Begin
TopBand = Open + Volatility( VolLen ) * MultFact;
BotBand = Open - Volatility( VolLen ) * Multfact;
End;
{ Define market mode with 3 line Moving averages }
XAvg = XAverage( Close , XMALen );
FastMA = Average( Close, 4 );
MedMA = Average( Close, 9 );
SlowMA = Average( Close, 18 );
BullTrend = FastMA > MedMA AND MedMA > SlowMA;
BearTrend = FastMA < MedMA AND MedMA < SlowMA;
{ Place long entry orders }
If XAvg > TopBand AND BullTrend then begin
Buy this bar at close;
BotBand = TopBand;
TopBand = TopBand + Volatility( VolLen ) * MultFact;
End;
{ Place short entry orders }
If XAvg < BotBand AND BearTrend then begin
Sell this bar at close;
TopBand = BotBand;
BotBand = BotBand - Volatility( VolLen ) * MultFact;
End;
{ Place long and short exit orders }
If MarketPosition = 1 then
ExitLong next bar at BotBand stop;
If MarketPosition = -1 then
ExitShort next bar at TopBand stop;
다음글