Could someone please take this Hull Moving Avg code that is from TradeStation and rewrite it so that it works for MT4?
----------------
inputs:
double Price( Close ), { price series to use in the calculation of the HMA }
int Length( 9 ), { number of bars to use in calculation of the HMA }
int Displace( 0 ), { number of bars to displace the plot of the HMA; negative
values of this input displace the plot to the right, positive values displace
the plot to the left }
int BackgroundColorAlertCell( DarkGray ) ; { if alert criteria are met, this is
the color used for the cell background in RadarScreen; if it is not desired
for the cell background color to change when the alert criteria are met, set
this input to the default cell background color }
variables:
double HullAvg( 0 ) ;
HullAvg = HMA( Price, Length ) ;
Plot1[Displace]( HullAvg, "HMA" ) ;
{ alert criteria }
if Displace = 0 then
begin
if Price crosses over HullAvg then
begin
Alert( "Price crossing over Hull average" ) ;
SetPlotBGColor( 1, BackgroundColorAlertCell ) ;
end
else if Price crosses under HullAvg then
begin
Alert( "Price crossing under Hull average" ) ;
SetPlotBGColor( 1, BackgroundColorAlertCell ) ;
end ;
end ;
----------------
inputs:
double Price( Close ), { price series to use in the calculation of the HMA }
int Length( 9 ), { number of bars to use in calculation of the HMA }
int Displace( 0 ), { number of bars to displace the plot of the HMA; negative
values of this input displace the plot to the right, positive values displace
the plot to the left }
int BackgroundColorAlertCell( DarkGray ) ; { if alert criteria are met, this is
the color used for the cell background in RadarScreen; if it is not desired
for the cell background color to change when the alert criteria are met, set
this input to the default cell background color }
variables:
double HullAvg( 0 ) ;
HullAvg = HMA( Price, Length ) ;
Plot1[Displace]( HullAvg, "HMA" ) ;
{ alert criteria }
if Displace = 0 then
begin
if Price crosses over HullAvg then
begin
Alert( "Price crossing over Hull average" ) ;
SetPlotBGColor( 1, BackgroundColorAlertCell ) ;
end
else if Price crosses under HullAvg then
begin
Alert( "Price crossing under Hull average" ) ;
SetPlotBGColor( 1, BackgroundColorAlertCell ) ;
end ;
end ;
Always a Student, Never a Master - Emulate What Works