커뮤니티
함수 변환 부탁드립니다.
2018-04-15 21:36:51
120
글번호 118219
안녕하세요.
함수변환 부탁드립니다.
감사합니다.
Inputs: Price(Close), Length(9);
Variables: AvgVal(0), DerivMA1(0), DerivMA2(0), BuyFlag(False), SellFlag(False);
{Derivative Calculation}
AvgVal = Average(Price, Length);
{First Derivative}
DerivMA1 = (AvgVal - AvgVal[Length]) / Length;
{Second Derivative}
DerivMA2 = (DerivMA1 - DerivMA1[1]) / 1;
{Setup Conditions}
Condition1 = DerivMA1 Crosses Below 0;
Condition2 = DerivMA1 Crosses Above 0;
Condition3 = DerivMA2 Crosses Below 0;
Condition4 = DerivMA2 Crosses Above 0;
{Setup}
If Condition4 Then
BuyFlag = True;
If Condition3 Then
SellFlag = True;
{Long Entry}
If Condition2 AND BuyFlag Then Begin
Buy Next Bar at Close + 1 Point Stop;
BuyFlag = False;
End;
{Short Entry}
If Condition1 AND SellFlag Then Begin
Sell Next Bar at Close - 1 Point Stop;
SellFlag = False;
End;
답변 1
예스스탁 예스스탁 답변
2018-04-16 13:51:01
안녕하세요
예스스탁입니다.
Inputs: Length(9);
Variables: AvgVal(0), DerivMA1(0), DerivMA2(0), BuyFlag(False), SellFlag(False),Price(0);
Price = close;
#{Derivative Calculation}
AvgVal = ma(Price, Length);
#{First Derivative}
DerivMA1 = (AvgVal - AvgVal[Length]) / Length;
#{Second Derivative}
DerivMA2 = (DerivMA1 - DerivMA1[1]) / 1;
#{Setup Conditions}
Condition1 = crossdown(DerivMA1,0);
Condition2 = crossup(DerivMA1,0);
Condition3 = CrossDown(DerivMA2,0);
Condition4 = crossup(DerivMA2,0);
#{Setup}
If Condition4 Then
BuyFlag = True;
If Condition3 Then
SellFlag = True;
#{Long Entry}
If Condition2 AND BuyFlag Then Begin
Buy("b",AtStop,Close + 1);
BuyFlag = False;
End;
#{Short Entry}
If Condition1 AND SellFlag Then Begin
Sell("s",AtStop,Close - 1);
SellFlag = False;
End;
즐거운 하루되세요
> 바둑이 님이 쓴 글입니다.
> 제목 : 함수 변환 부탁드립니다.
> 안녕하세요.
함수변환 부탁드립니다.
감사합니다.
Inputs: Price(Close), Length(9);
Variables: AvgVal(0), DerivMA1(0), DerivMA2(0), BuyFlag(False), SellFlag(False);
{Derivative Calculation}
AvgVal = Average(Price, Length);
{First Derivative}
DerivMA1 = (AvgVal - AvgVal[Length]) / Length;
{Second Derivative}
DerivMA2 = (DerivMA1 - DerivMA1[1]) / 1;
{Setup Conditions}
Condition1 = DerivMA1 Crosses Below 0;
Condition2 = DerivMA1 Crosses Above 0;
Condition3 = DerivMA2 Crosses Below 0;
Condition4 = DerivMA2 Crosses Above 0;
{Setup}
If Condition4 Then
BuyFlag = True;
If Condition3 Then
SellFlag = True;
{Long Entry}
If Condition2 AND BuyFlag Then Begin
Buy Next Bar at Close + 1 Point Stop;
BuyFlag = False;
End;
{Short Entry}
If Condition1 AND SellFlag Then Begin
Sell Next Bar at Close - 1 Point Stop;
SellFlag = False;
End;
다음글
이전글