Eman93 4,750 posts msg #70844 - Ignore Eman93 modified | 
1/22/2009 12:00:34 AM
  Walid
 - Ignore Walid 1/17/2009 12:26:37 AM
 
 Eman, 
 
 C# codeing is what I do for living. Please let me know if I can be of any help. BTW, at 2:00 AM you will suck at almost any thing, get some sleep :-)
 
 Wealth lab my be your gig, you can totaly automate trades, when it dosent lock up, HO HO. The 5.1 is unstable in live sessions....they are working on a fix. 
 
 This is the code
 
 /*
 1. Long only
 2. If today’s open is below yesterdays close then I buy at a few ticks above the open. 
 3. Profit target $1.00 fixed
 4. No stop, but liquidate open position(s) on EOD.
 5. 1 trade per day
 */
 using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Drawing;
 using WealthLab;
 using WealthLab.Indicators;
 
 namespace WealthLab.Strategies
 {
 	public class MyStrategy : WealthScript
 	{
 		protected override void Execute()
 		{	
 			PlotStops();
 			int dayOfLastTrade = 0;
 			SymbolInfo si = Bars.SymbolInfo;
 			double ticks = 3 * si.Tick;		// a few 			ticks
 			
 			// Get the Daily closes
 			SetScaleDaily();			
 			DataSeries dayClose = Close;
 			RestoreScale();
 			dayClose = Synchronize( dayClose );			
 			
 			// Find the start of the second day
 			int stBar = Bars.Count;
 			for(int bar = 0; bar < Bars.Count; bar++)
 			{
 				if( Bars.IsLastBarOfDay( bar ) )
 				{
 					stBar = bar + 1;
 					break;
 				}					
 			}			
 			
 			// Here's the main loop - start on the second day (so that you know yesterday's close)
 			double todayOpen = Open[stBar];
 			for(int bar = stBar; bar < Bars.Count; bar++)
 			{
 				if( Bars.IntradayBarNumber( bar ) == 0 )
 				{
 					todayOpen = Open[bar];
 					dayOfLastTrade = 0;
 				}
 				
 				if (IsLastPositionActive)
 				{
 					Position p = LastPosition;
 					if( Bars.IsLastBarOfDay(bar) )
 					{
 						if( bar == Bars.Count - 1 )
 							SellAtMarket(bar + 1, p, "EOD");	// generate an immediate sale/alert if last bar in chart
 						else
 							SellAtClose(bar, p, "EOD");	// for backtesting, just sell at the closing price of this bar
 					}
 					else
 						SellAtLimit(bar + 1, p, p.EntryPrice + 1.00, "Profit Target");
 					
 					
 				}
 				else if( todayOpen < dayClose[bar] && dayOfLastTrade != Date[bar].Day )
 				{
 					if( BuyAtStop(bar + 1, todayOpen + ticks) != null )
 						dayOfLastTrade =  Date[bar].Day;
 				}
 			}
 		}
 	}
 }
 
 
  | 
Eman93 4,750 posts msg #70845 - Ignore Eman93 | 
1/22/2009 12:40:01 AM
  What is nice is you can back test on 1 min data for years and years if you like.
 
 I can send it to you in a text file if you like...I burned a lot of hours trying to get it to work.
 
 I can send any other info, I think I have the manual in a PDF.
 
 The thing I like about the MTC is you can see the stats and you can see it work every day.
 
 On Gap down days you win a dollar 80% of the time.
 
 Just a quick thought,  if put your stop loss at $1.00 and won  a $1.00 at a rate of 80% after a 100 trades with 1 share you stand to profit 80 dollars. so at 1000 shares you make 80000, it is very cash intesive, we need a way to catch the runners too.
 
 I can only go long hence the gap down play.
 
 I have a day job and cant trade all day long or I would just do the MTC all day long, I would spring for the 100 a month for Trade Station and build the MTC radar like TRO has, it is very hard (for me any way) to gage the action from a simple watch list  and by the time you flip through 5 stock charts you have missed the trade.
 
 I thank you for your willingness to help in this endevor......
 
  | 
nojobmaui 19 posts msg #70865 - Ignore nojobmaui | 
1/23/2009 12:39:28 AM
  Eman
 It so incredible that you have done this! Thank you
 
  | 
nojobmaui 19 posts msg #70866 - Ignore nojobmaui | 
1/23/2009 12:55:48 AM
  HI Eman
 Are you saying that your code will autotrade MTC with Tradestation? IS there anything I can do to help you?
 
  | 
Eman93 4,750 posts msg #70869 - Ignore Eman93 modified | 
1/23/2009 7:28:20 AM
  NO NO
 
 This is code for Wealth Lab........
 
 It is a work in progress.
 
 I have tried to use it for alerts but it has issues...
 
 Walid has offered to work on it.
 
 Go back a few pages and look at the stats
 
  | 
Walid 130 posts msg #70891 - Ignore Walid | 
1/23/2009 12:33:58 PM
  Hi Eman, 
 
 Sorry I couldn't get to you any earlier. I will download the 30 trail and play with it a little. BTW, did you buy the program or using the 30 days trail? 
 
  | 
Eman93 4,750 posts msg #70907 - Ignore Eman93 | 
1/23/2009 4:00:21 PM
  My 401k is with Fidelity..they provide it free if you have enough trades...like 100 a year or something.
 
 I can send you the manual if you like, I have it downloaded on a PDF.
 
 
  | 
Eman93 4,750 posts msg #70910 - Ignore Eman93 | 
1/23/2009 4:13:58 PM
  I will start a new topic in General Discussion on Auto Trading... I dont want to hijack TRO's thread.
 
  | 
TheRumpledOne 6,529 posts msg #71129 - Ignore TheRumpledOne | 
2/2/2009 9:46:19 AM
 
  
 
  
 
  | 
stratigf 43 posts msg #71131 - Ignore stratigf | 
2/2/2009 10:22:10 AM
  welcome back TRO
 
  |