tel aviv, israel
Posts: 4 since Nov 2022
Thanks Given: 1
Thanks Received: 0
|
It's simple MA with confirm bars:
{ Buys if Price crosses over Avg and then stays above Avg for one or more bars }
inputs:
Price( Close ) [DisplayName = "Price", ToolTip =
"Enter an EasyLanguage expression to use in the moving average calculations."],
Length( 9 ) [DisplayName = "Length", ToolTip =
"Enter the number of bars used in the calculation of the moving average."],
ConfirmBars( 1 ) [DisplayName = "ConfirmBars", ToolTip =
"Enter the number of bars required to confirm the cross of price above the moving average."];
variables:
Counter( 0 );
if Price > AverageFC( Price, Length ) then
Counter = Counter + 1
else
Counter = 0;
{ CB > ConfirmBars check used to avoid spurious cross confirmation at
CB = ConfirmBars }
if CurrentBar > ConfirmBars and Counter = ConfirmBars then
Buy ( !( "MACrossLE" ) ) next bar at market;
|