Start and End Timing? - Traders Laboratory
Forum Guidelines | Contact Us
Home

Go Back   Traders Laboratory > Trading Resources > Trading Indicators > Coding Forum

Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-20-2007, 10:05 AM
jmi88 has no status.

 
Join Date: Oct 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
This member is the original thread starter. Start and End Timing?

Im trying to test a system and have it start trading at 8:00am and close any postion at end of day...For example this simple MA cross, how would I put in 'dont take a signal till after 8am' and then 'exit any postion at the close'?

Thanks for any help

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 ;

Reply With Quote
  #2 (permalink)  
Old 06-20-2007, 07:34 PM
ant's Avatar
ant ant is offline
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.

Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
if you had to start over... darthtrader Beginners Forum 37 05-22-2007 09:03 AM
How did I start my future trade? Weryfalloffdown Beginners Forum 23 01-29-2007 08:01 AM
Is it possible to start trading FOREX with $1000? 1time Forex Laboratory 36 01-02-2007 02:45 PM
Newbie looking to start trading creso Beginners Forum 18 09-07-2006 11:56 AM


All times are GMT -4. The time now is 04:50 PM.

 

 
 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76