커뮤니티

함수 변환 부탁드립니다.

프로필 이미지
바둑이
2018-04-15 21:37:46
173
글번호 118220
답변완료
안녕하세요. 함수변환 부탁드립니다. 감사합니다. Inputs: Price(Close), Length(10), Const(1.2), ChanPcnt(.5), Trade(10000), Lot(100); Vars: KCU(0), KCL(0), ChanRng(0), AvgVal(0), AvgRange(0), SetBar(0), CountL(0), CountS(0); {Assignments of Keltner calculations} AvgVal = Average(Price, Length); AvgRange = Average(TrueRange, Length); KCU = AvgVal + AvgRange * Const; KCL = AvgVal - AvgRange * Const; ChanRng = (KCU - KCL) / 2; {Accumulates to count the bars after the SetUps below} CountL = CountL + 1; CountS = CountS + 1; {Buy Criteria Evaluation} IF Price Crosses Above KCU Then Begin SetBar = High; CountL = 1; End; IF Price > KCU AND CountL <= 5 Then Buy Next Bar at SetBar + (ChanRng * ChanPcnt) Stop; {Sell Criteria Evaluation} IF Price Crosses Below KCL Then Begin SetBar = Low; CountS = 1; End; IF Price < KCL AND CountS <= 5 Then Sell Next Bar at SetBar - (ChanRng * ChanPcnt) Stop; {System Stops} IF Close Crosses Below AvgVal Then ExitLong This Bar on Close; IF Close Crosses Above AvgVal Then ExitShort This Bar on Close; {Trailing Stops} ExitLong Next Bar at Lowest(Low, 4) Stop; ExitShort Next Bar at Highest(High, 4) Stop;
사용자 함수
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-04-16 13:53:48

안녕하세요 예스스탁입니다. Inputs: Length(10), Const(1.2), ChanPcnt(.5), Trade(10000), Lot(100); Vars: KCU(0), KCL(0), ChanRng(0), AvgVal(0), AvgRange(0), SetBar(0), CountL(0), CountS(0),Price(0); Price = close; #{Assignments of Keltner calculations} AvgVal = Average(Price, Length); AvgRange = Average(TrueRange, Length); KCU = AvgVal + AvgRange * Const; KCL = AvgVal - AvgRange * Const; ChanRng = (KCU - KCL) / 2; #{Accumulates to count the bars after the SetUps below} CountL = CountL + 1; CountS = CountS + 1; #{Buy Criteria Evaluation} IF crossup(Price , KCU) Then Begin SetBar = High; CountL = 1; End; IF Price > KCU AND CountL <= 5 Then Buy("b",AtStop,SetBar + (ChanRng * ChanPcnt)); #{Sell Criteria Evaluation} IF crossdown(Price,KCL) Then Begin SetBar = Low; CountS = 1; End; IF Price < KCL AND CountS <= 5 Then Sell("s",AtStop,SetBar - (ChanRng * ChanPcnt)); #{System Stops} IF crossdown(Close , AvgVal) Then ExitLong("bx1",OnClose); IF crossup(Close , AvgVal) Then ExitShort("sx1",OnClose); #{Trailing Stops} ExitLong("bx2",AtStop,Lowest(Low, 4)); ExitShort("sx2",AtStop,Highest(High, 4)); 즐거운 하루되세요 > 바둑이 님이 쓴 글입니다. > 제목 : 함수 변환 부탁드립니다. > 안녕하세요. 함수변환 부탁드립니다. 감사합니다. Inputs: Price(Close), Length(10), Const(1.2), ChanPcnt(.5), Trade(10000), Lot(100); Vars: KCU(0), KCL(0), ChanRng(0), AvgVal(0), AvgRange(0), SetBar(0), CountL(0), CountS(0); {Assignments of Keltner calculations} AvgVal = Average(Price, Length); AvgRange = Average(TrueRange, Length); KCU = AvgVal + AvgRange * Const; KCL = AvgVal - AvgRange * Const; ChanRng = (KCU - KCL) / 2; {Accumulates to count the bars after the SetUps below} CountL = CountL + 1; CountS = CountS + 1; {Buy Criteria Evaluation} IF Price Crosses Above KCU Then Begin SetBar = High; CountL = 1; End; IF Price > KCU AND CountL <= 5 Then Buy Next Bar at SetBar + (ChanRng * ChanPcnt) Stop; {Sell Criteria Evaluation} IF Price Crosses Below KCL Then Begin SetBar = Low; CountS = 1; End; IF Price < KCL AND CountS <= 5 Then Sell Next Bar at SetBar - (ChanRng * ChanPcnt) Stop; {System Stops} IF Close Crosses Below AvgVal Then ExitLong This Bar on Close; IF Close Crosses Above AvgVal Then ExitShort This Bar on Close; {Trailing Stops} ExitLong Next Bar at Lowest(Low, 4) Stop; ExitShort Next Bar at Highest(High, 4) Stop;