08/09/10

prorealtime

//Parameter: Period = 20
//Parameter: Trigger = 0.5

//TrueRange
A = MAX((High - Low), (ABS(High - Close[1])))
TRa = MAX(A, ABS(Low - Close[1]))

//Closing Position Difference
ClosingPositionDifference = Close - Close[1]
SignedClosingPositionDifference = SGN(ClosingPositionDifference)

//Closing Position Bias
ClosingPositionBias = ClosingPositionDifference / TRa

IF ClosingPositionBias >= Trigger THEN
PositiveSignedVolume = Volume
ELSIF ClosingPositionBias <= -Trigger THEN
NegativeSignedVolume = Volume
ELSE
PositiveSignedVolume = 0
NegativeSignedVolume = 0
ENDIF

PositiveCQA = Close * PositiveSignedVolume * TRa * SignedClosingPositionDifference
NegativeCQA = Close * NegativeSignedVolume * TRa * SignedClosingPositionDifference
SumPositiveCQA = SUMMATION[Period](PositiveCQA)
SumNegativeCQA = SUMMATION[Period](NegativeCQA)

Histo = SumPositiveCQA + SumNegativeCQA

RETURN SumPositiveCQA AS "SumPositiveCQA", SumNegativeCQA AS "SumNegativeCQA", 0 AS "0", Histo AS "CQA Total - Histo"

Nessun commento:

Posta un commento

www.finanza.com
info.gif (242 byte)