Code: Select all
inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ;
variables: FastAvg( 0 ), SlowAvg( 0 ) ;
FastAvg = AverageFC( Price, FastLength ) ;
SlowAvg = AverageFC( Price, SlowLength ) ;
if CurrentBar > 1 and FastAvg crosses over SlowAvg then
Buy ( "MA2CrossLE" ) next bar at market ;
if CurrentBar > 1 and FastAvg crosses under SlowAvg then
Sell Short ( "MA2CrossSE" ) next bar at market ;
Inputs: PositionBasis(True), Amount(20);
If PositionBasis Then
SetStopPosition
Else
SetStopContract;
SetStopLoss(Amount);