PDA

View Full Version : help in creating function



anandbohra
11-05-2007, 03:40 AM
Hi all
let me brief u about my requirement.
I am Research Analyst (Technical) & found logic for one technical indicator called Parabolic SAR
& have its logic & steps the main thing is i can not write array function or calculate in array. so pl any one can help me in converting this into an function.

calculation logic source

http://www.esignalcentral.com/support/futuresource/workstation/help/charts/studies/parab.htm
Computing Parabolic Stop and Reversal

Determine subsequent values of Position, Extreme Price and Stop And Reversal:

A. If Pt-1 = Long, and if (SARt-1 + AFDt-1) > Lt then:
Pt changes to Short
EPt = Lt
SARt = EPt-1

B. If Pt-1 = Long, and if (SARt-1 + AFDt-1) < Lt then:
Pt remains Long
EPt = MAX(Ht, Ht-1 ... Ht-X)
SARt = MIN((SARt-1 + AFDt-1), Lt-1, Lt-2)

C. If Pt-1 = Short, and if (SARt-1 - AFDt-1) < Ht then:
Pt changes to Long
EPt = Ht
SARt = EPt-1

D. If Pt-1 = Short and If (SARt-1 - AFDt-1) > Ht then:
Pt remains Short
EPt = MIN(Lt-1, Lt-2, ... Lt-X)
SARt = MAX((SARt-1 - AFDt-1), Ht-1, Ht-2)


ABS = Absolute Value
AF = InitialAccelerationFactor
AFD = InitialAccelerationFactor multiplied by the absolute value of the difference between Extreme Price value and SAR value
C = Close Price
EP = Extreme Price (Maximum High or Minimum Low over a period, depending on Period type)
H = High Price
i =initial value (chronologically first calculated)
L = Low Price
MAX = Maximum
MIN = Minimum
P = Position
SAR = Stop And Reversal
t = current interval
X = length of current position
Y = AccelerationAdditionFactor value (used as initial AF and as the incremental value)
Z = AccelerationFactorLimit - the maximum value that the Acceleration Factor can reach


any points clarification pl contact me
bohra_anand@yahoo.co.in

also attaching my existing working for this file