커뮤니티
문의드립니다...
2013-10-28 21:18:34
162
글번호 68945
트레이드 스테이션임다..
전환 부탁드립니다...trend follow
==========================================
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-10-29 15:32:49
안녕하세요
예스스탁입니다.
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 index == 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");
BotBand = TopBand;
TopBand = TopBand + Volatility * MultFact;
End;
//{ Place short entry orders }
If XAvg < BotBand AND BearTrend then begin
Sell();
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);
즐거운 하루되세요
> 머니사이언스 님이 쓴 글입니다.
> 제목 : 문의드립니다...
> 트레이드 스테이션임다..
전환 부탁드립니다...trend follow
==========================================
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;
다음글
이전글