The following Tom DeMark indicator was written in trade Station easy language.  
It would be most appreciated and helpful if someone could translate to AFL.  
Thanks kindly

Dick

"Type : Indicator, Name DeMark : Buy/Sell Pressure 
inputs: len(20),len2(25);
value1=close-low;
value2=high-close;
value3=((value1-value2)/close);
value4=close of data1-low of data1;
value5=high of data1-close of data1;
value6=((value4-value5)/close of data1);
if value3>0 and value6>0 then begin
value7=( value3 - value6);
end;
Plot1(averagefc(value7,len), "SprdRatio" ) 
;plot2(averagefc(averagefc(value7,len),len2),"average");"

The following is the explanation of the averagfc function used above.
AverageFC (Function)
Disclaimer
The AverageFC (Fast Calculation) series function is an Average of prices or 
values for some number of bars. It may also called a moving average, since the 
values are recalculated for every bar.
Syntax
AverageFC(Price, Length)
Returns (Double)
A numeric value for the current bar.
Parameters
Name    Type    Description
Price   Numeric Specifies which bar value (price, function, or formula) to use.
Length  Numeric Sets the number of bars to consider.
Remarks
The AverageFC function is often used to smooth the values of functions or 
indicators.
AverageFC (fast calculation arithmetic mean) subtracts the oldest value in the 
list of elements, adds the newest value, and then divides by the number of 
elements.
The input parameter Price can be a bar value such as Close, High, Low, Open, or 
Volume. It can also be any mathematical calculation such as (High + Low) / 2, 
or a numeric function such as RSI, Stochastic, or ADX.
The value for the Length input parameter should always be a whole number, 
greater than 0.
Note;:This series function returns exactly the same values as Average except 
that it uses a fast calculation method that takes slightly more memory than the 
non-FC version.
Examples
Assigns the 9 bar fast calculation moving average of the Close to Value1, then 
plots Value1:
Value1 = AverageFC(Close,9);
Plot1(Value1, "AvgClose");
Assigns the 15 bar fast calculation moving average of the range;(High + Low)/2 
to Value1, then plots Value1:
Value1 = AverageFC((High + Low)/2,15);
Plot1(Value1, "AvgRng");
Assigns the 10 bar fast calculation moving average of the RSI function to 
Value1, then plots Value1:
Value1 = AverageFC(RSI(Close,14),10);
Plot1(Value1, "AvgRSI");
Assigns the 20 bar fast calculation moving average of the custom variable 
myRange to Value1, then plots Value1:
Vars: myRange(((High[1]-Low[1]) + (High - Low))/2;
Value1 = AverageFC(myRange, 20);
Plot1(Value1, "AvgRng");


Reply via email to