커뮤니티

문의드립니다.

프로필 이미지
잡다백수
2018-02-22 09:39:38
185
글번호 116809
답변완료
도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 기타 코딩 변환 부탁드립니다. Indicator: Martinelli Chart inputs: StdDevLen( 7 ), ForecastLen( 3 ), Cutoff( 1.04 ) ; variables: PriceChange( 0 ), PriceForecast( 0 ), W( 0 ), Omega( 0 ), Alpha( 0 ), Signal( 0 ), FractionalGain( 0 ), ThisTrade( 0 ) ; PriceChange = Close - Close[1] ; PriceForecast = LinearRegValue( Close, ForecastLen , -1 ) ; W = PriceForecast - Close ; Omega = StandardDev( PriceChange, StdDevLen, 2 ) ; if Omega > 0 then Alpha = ( PriceForecast - Close ) / Omega ; if Alpha[1] > Cutoff then Signal = 1 else if Alpha[1] < Neg( Cutoff ) then Signal = -1 else Signal = 0 ; if Close[1] > 0 then ThisTrade = Signal * PriceChange / Close[1] ; FractionalGain = FractionalGain + ThisTrade ; Plot1( FractionalGain, “FracGain” ) ; Indicator: Martinelli RS inputs: ForecastLen( 3 ), StdDevLen( 7 ), InitialCutoff ( 1.04 ), IncrementCutoff( 0.02 ) ; variables: SDate( 0 ), BuyHoldEntry( 0 ), PriceChange( 0 ), PriceForecast( 0 ), W( 0 ), Omega( 0 ), Alpha( 0 ), Counter( 0 ), Signal( 0 ), ThisTrade( 0 ), MaxFraction( 0 ), MaxCutoff( 0 ), MaxCounter( 0 ), SDateStr( “” ), EDateStr( “” ), BH( 0 ), Diff( 0 ), WLR( “” ) ; arrays: Cutoff[10]( 0 ), Wins[10]( 0 ), Losses[10]( 0 ), FractionalGain[10]( 0 ), BestPoint[10]( -9999999 ) ; if CurrentBar = 1 then begin SDate = Date ; BuyHoldEntry = Close ; end ; PriceChange = Close - Close[1] ; PriceForecast = LinearRegValue( Close, ForecastLen , -1 ) ; W = PriceForecast - Close ; Omega = StandardDev( PriceChange, StdDevLen, 2 ) ; if Omega > 0 then Alpha = ( PriceForecast - Close ) / Omega ; for Counter = 1 to 10 begin if CurrentBar = 1 then Cutoff[Counter] = InitialCutoff + ( Counter - 1 ) * IncrementCutoff ; if Alpha[1] > Cutoff[Counter] then Signal = 1 else if Alpha[1] < Neg( Cutoff[Counter] ) then Signal = -1 else Signal = 0 ; if Close[1] > 0 and Signal <> 0 then begin ThisTrade = ( ( Signal * PriceChange ) / Close[1] ) ; if ThisTrade > 0 then Wins[Counter] = Wins[Counter] + 1 else if ThisTrade < 0 then Losses[Counter] = Losses[Counter] +1 ; FractionalGain[Counter] = ThisTrade + FractionalGain[Counter] ; end ; if FractionalGain[Counter] > BestPoint[Counter] then BestPoint[Counter] = FractionalGain[Counter] ; end ; if LastBarOnChart then begin MaxFraction = FractionalGain[1] ; MaxCutoff = Cutoff[1] ; for Counter = 2 to 10 begin if MaxFraction < BestPoint[Counter] then begin MaxCounter = Counter ; MaxFraction = BestPoint[Counter] ; end ; end ; SDateStr = ELDateToString( SDate ) ; EDateStr = ELDateToString( Date ) ; if BuyHoldEntry <> 0 then begin BH = ( Close - BuyHoldEntry ) / BuyHoldEntry ; Diff = FractionalGain[MaxCounter] - ( Close - BuyHoldEntry ) / BuyHoldEntry ; end ; if Losses[MaxCounter] + Wins[MaxCounter] > 0 then WLR = NumToStr( Wins[MaxCounter] / ( Losses[MaxCounter] + Wins[MaxCounter] ), 2 ) else WLR = “No Losses” ; Plot1( SDateStr, “SDate” ) ; Plot2( EDateStr, “EDate” ) ; Plot3( Cutoff[MaxCounter], “Cutoff” ) ; Plot4( MaxFraction, “BestPoint” ) ; Plot5( BH, “B&H” ) ; Plot6( FractionalGain[MaxCounter], “LDF” ) ; Plot7( Diff, “Diff” ) ; Plot8( Wins[MaxCounter], “#W” ) ; Plot9( WLR, “WLR” ) ; end ; Strategy: Martinelli Strat inputs: StdDevLen( 7 ), ForecastLen( 3 ), Cutoff ( 1.04 ) ; variables: PriceChange( 0 ), PriceForecast( 0 ), W( 0 ), Omega( 0 ), Alpha( 0 ), TL_ID( -1 ), Signal( 0 ), FractionalGain( 0 ), ThisTrade( 0 ) ; PriceChange = Close - Close[1] ; PriceForecast = LinearRegValue( Close, ForecastLen, -1 ) ; W = PriceForecast - Close ; Omega = StandardDev( PriceChange, StdDevLen, 2 ) ; if Omega > 0 then Alpha = ( PriceForecast - Close ) / Omega ; { Entries } if Alpha > Cutoff then begin TL_ID = TL_New ( Date[1], Time[1], Close, Date, Time, Close ) ; Buy this bar Close ; end else if Alpha < Neg( Cutoff ) then begin TL_ID = TL_New ( Date[1], Time[1], Close, Date, Time, Close ) ; Sell short this bar at Close ; end ; { Exits } if Alpha[1] > Cutoff and Alpha < Cutoff and Alpha > Neg( Cutoff ) then Sell this bar at Close else if Alpha[1] < Neg( Cutoff ) and Alpha > Neg( Cutoff ) and Alpha < Cutoff then Buy to cover this bar Close ;
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2018-02-22 15:29:25

안녕하세요 예스스탁입니다. 1. inputs:StdDevLen( 7 ),ForecastLen( 3 ),Cutoff( 1.04 ) ; variables:PriceChange( 0 ),PriceForecast( 0 ),W( 0 ),Omega( 0 ), Alpha( 0 ),Signal( 0 ),FractionalGain( 0 ),ThisTrade( 0 ) ; PriceChange = Close - Close[1] ; PriceForecast = LRL( Close, ForecastLen) ; W = PriceForecast - Close ; Omega = std( PriceChange, StdDevLen) ; if Omega > 0 then Alpha = ( PriceForecast - Close ) / Omega ; if Alpha[1] > Cutoff then Signal = 1; else if Alpha[1] < Neg( Cutoff ) then Signal = -1; else Signal = 0 ; if Close[1] > 0 then ThisTrade = Signal * PriceChange / Close[1] ; FractionalGain = FractionalGain + ThisTrade ; Plot1( FractionalGain,"FracGain") ; 2 내용파악이 안되는 함수들이 있어 변환불가합니다. 3 inputs:StdDevLen( 7 ),ForecastLen( 3 ),Cutoff ( 1.04 ) ; variables:PriceChange( 0 ),PriceForecast( 0 ),W( 0 ),Omega( 0 ),Alpha( 0 ), Signal( 0 ),FractionalGain( 0 ),ThisTrade( 0 ) ; PriceChange = Close - Close[1] ; PriceForecast = LRL( Close, ForecastLen) ; W = PriceForecast - Close ; Omega = STD( PriceChange, StdDevLen) ; if Omega > 0 then Alpha = ( PriceForecast - Close ) / Omega ; #{ Entries } if Alpha > Cutoff then begin Buy("b",OnClose); end else if Alpha < Neg( Cutoff ) then begin Sell("s",OnClose); end ; #{ Exits } if Alpha[1] > Cutoff and Alpha < Cutoff and Alpha > Neg( Cutoff ) then exitlong("bx"); if Alpha[1] < Neg( Cutoff ) and Alpha > Neg( Cutoff ) and Alpha < Cutoff then ExitShort("sx"); 즐거운 하루되세요 > 잡다백수 님이 쓴 글입니다. > 제목 : 문의드립니다. > 도움주시는 덕분에 도전하고 있습니다. 매번 감사합니다. 1. 기타 코딩 변환 부탁드립니다. Indicator: Martinelli Chart inputs: StdDevLen( 7 ), ForecastLen( 3 ), Cutoff( 1.04 ) ; variables: PriceChange( 0 ), PriceForecast( 0 ), W( 0 ), Omega( 0 ), Alpha( 0 ), Signal( 0 ), FractionalGain( 0 ), ThisTrade( 0 ) ; PriceChange = Close - Close[1] ; PriceForecast = LinearRegValue( Close, ForecastLen , -1 ) ; W = PriceForecast - Close ; Omega = StandardDev( PriceChange, StdDevLen, 2 ) ; if Omega > 0 then Alpha = ( PriceForecast - Close ) / Omega ; if Alpha[1] > Cutoff then Signal = 1 else if Alpha[1] < Neg( Cutoff ) then Signal = -1 else Signal = 0 ; if Close[1] > 0 then ThisTrade = Signal * PriceChange / Close[1] ; FractionalGain = FractionalGain + ThisTrade ; Plot1( FractionalGain, “FracGain” ) ; Indicator: Martinelli RS inputs: ForecastLen( 3 ), StdDevLen( 7 ), InitialCutoff ( 1.04 ), IncrementCutoff( 0.02 ) ; variables: SDate( 0 ), BuyHoldEntry( 0 ), PriceChange( 0 ), PriceForecast( 0 ), W( 0 ), Omega( 0 ), Alpha( 0 ), Counter( 0 ), Signal( 0 ), ThisTrade( 0 ), MaxFraction( 0 ), MaxCutoff( 0 ), MaxCounter( 0 ), SDateStr( “” ), EDateStr( “” ), BH( 0 ), Diff( 0 ), WLR( “” ) ; arrays: Cutoff[10]( 0 ), Wins[10]( 0 ), Losses[10]( 0 ), FractionalGain[10]( 0 ), BestPoint[10]( -9999999 ) ; if CurrentBar = 1 then begin SDate = Date ; BuyHoldEntry = Close ; end ; PriceChange = Close - Close[1] ; PriceForecast = LinearRegValue( Close, ForecastLen , -1 ) ; W = PriceForecast - Close ; Omega = StandardDev( PriceChange, StdDevLen, 2 ) ; if Omega > 0 then Alpha = ( PriceForecast - Close ) / Omega ; for Counter = 1 to 10 begin if CurrentBar = 1 then Cutoff[Counter] = InitialCutoff + ( Counter - 1 ) * IncrementCutoff ; if Alpha[1] > Cutoff[Counter] then Signal = 1 else if Alpha[1] < Neg( Cutoff[Counter] ) then Signal = -1 else Signal = 0 ; if Close[1] > 0 and Signal <> 0 then begin ThisTrade = ( ( Signal * PriceChange ) / Close[1] ) ; if ThisTrade > 0 then Wins[Counter] = Wins[Counter] + 1 else if ThisTrade < 0 then Losses[Counter] = Losses[Counter] +1 ; FractionalGain[Counter] = ThisTrade + FractionalGain[Counter] ; end ; if FractionalGain[Counter] > BestPoint[Counter] then BestPoint[Counter] = FractionalGain[Counter] ; end ; if LastBarOnChart then begin MaxFraction = FractionalGain[1] ; MaxCutoff = Cutoff[1] ; for Counter = 2 to 10 begin if MaxFraction < BestPoint[Counter] then begin MaxCounter = Counter ; MaxFraction = BestPoint[Counter] ; end ; end ; SDateStr = ELDateToString( SDate ) ; EDateStr = ELDateToString( Date ) ; if BuyHoldEntry <> 0 then begin BH = ( Close - BuyHoldEntry ) / BuyHoldEntry ; Diff = FractionalGain[MaxCounter] - ( Close - BuyHoldEntry ) / BuyHoldEntry ; end ; if Losses[MaxCounter] + Wins[MaxCounter] > 0 then WLR = NumToStr( Wins[MaxCounter] / ( Losses[MaxCounter] + Wins[MaxCounter] ), 2 ) else WLR = “No Losses” ; Plot1( SDateStr, “SDate” ) ; Plot2( EDateStr, “EDate” ) ; Plot3( Cutoff[MaxCounter], “Cutoff” ) ; Plot4( MaxFraction, “BestPoint” ) ; Plot5( BH, “B&H” ) ; Plot6( FractionalGain[MaxCounter], “LDF” ) ; Plot7( Diff, “Diff” ) ; Plot8( Wins[MaxCounter], “#W” ) ; Plot9( WLR, “WLR” ) ; end ; Strategy: Martinelli Strat inputs: StdDevLen( 7 ), ForecastLen( 3 ), Cutoff ( 1.04 ) ; variables: PriceChange( 0 ), PriceForecast( 0 ), W( 0 ), Omega( 0 ), Alpha( 0 ), TL_ID( -1 ), Signal( 0 ), FractionalGain( 0 ), ThisTrade( 0 ) ; PriceChange = Close - Close[1] ; PriceForecast = LinearRegValue( Close, ForecastLen, -1 ) ; W = PriceForecast - Close ; Omega = StandardDev( PriceChange, StdDevLen, 2 ) ; if Omega > 0 then Alpha = ( PriceForecast - Close ) / Omega ; { Entries } if Alpha > Cutoff then begin TL_ID = TL_New ( Date[1], Time[1], Close, Date, Time, Close ) ; Buy this bar Close ; end else if Alpha < Neg( Cutoff ) then begin TL_ID = TL_New ( Date[1], Time[1], Close, Date, Time, Close ) ; Sell short this bar at Close ; end ; { Exits } if Alpha[1] > Cutoff and Alpha < Cutoff and Alpha > Neg( Cutoff ) then Sell this bar at Close else if Alpha[1] < Neg( Cutoff ) and Alpha > Neg( Cutoff ) and Alpha < Cutoff then Buy to cover this bar Close ;