Traders Laboratory - View Single Post - Start and End Timing?
Thread
:
Start and End Timing?
View Single Post
#
2
(
permalink
)
06-20-2007, 07:34 PM
ant
ant
has no status.
Join Date: Sep 2006
Posts: 293
Thanks: 0
Thanked 3 Times in 1 Post
Re: Start and End Timing?
jmi88, see if this works for you...
inputs: Price( Close ), FastLength( 9 ), SlowLength( 18 ) ; variables: FastAvg( 0 ), SlowAvg( 0 ) ; FastAvg = AverageFC( Price, FastLength ) ; SlowAvg = AverageFC( Price, SlowLength ) ; if
MarketPosition = 0 and Time > 800 and
CurrentBar > 1 and FastAvg crosses over SlowAvg then Buy ( "MA2CrossLE" ) next bar at market ; if
MarketPosition = 0 and Time > 800 and
CurrentBar > 1 and FastAvg crosses under SlowAvg then Sell Short ( "MA2CrossSE" ) next bar at market ;
if MarketPosition > 0 and Time = Sess1EndTime then Sell ( "MA2CrossLX" ) this bar at close ; if MarketPosition < 0 and Time = Sess1EndTime then BuyToCover ( "MA2CrossSX" ) this bar at close ;
I added the check for MarketPosition so that you only have one position open at a time. You can also hardcode the time instead of using Sess1EndTime.
ant
View Public Profile
Send a private message to ant
Find all posts by ant
View ant's Videos
ant's Trade Info