Profile Picture

Money Management rule implementation

Posted By Stefan 6 Years Ago
Message
Posted Sunday July 24 2011
Hi, I am testing RE and I am stuck not knowing how to implement the following:

1. MySymbolScript Class: NewBar() runs for every selected symbol in the watchlist (with the same timestamp, i.e. EOD-Date). I do not want to execute Buy/Sell signals immediately but store them in a list, because...

2....after this (in System class) I want to check whether enough cash is available to carry out all buy signals of this NewBar()-run (or to create further buys if the investment ratio of equities in the portfolio gets too low by generated sell signals). If there is not enough cash available I want to filter the given signals and then open positions only for the symbols that are ranked best e.g. by an indicator.

Is there any way to find out when NewBar()-runs for a given timestamp have finished so that then I can oversee all generated Signals and select from there which one to create an order for?

I am not really an experienced programmer so if you have a code snippet in C# for me it would be great!

Thanks, Stefan

phg
Supreme Being (44,979 reputation)Supreme Being (44,979 reputation)Supreme Being (44,979 reputation)Supreme Being (44,979 reputation)Supreme Being (44,979 reputation)Supreme Being (44,979 reputation)Supreme Being (44,979 reputation)Supreme Being (44,979 reputation)Supreme Being (44,979 reputation)
Posted Monday August 01 2011
Let me offer a couple of thoughts on this. First, put your buy and sell signals in a flat file (stream). There are a couple of ways of finding the end of a watchlist. One is to override SystemBase.NewBar under MySystem; at the end of that you know you have handled all symbols. (I think there is an example of this in one of the sample strategies; there have been some changes in this area and I may have missed something.) Another is to count the length of the symbol list (SystemData.Symbols.Count) and recogize when the last symbol has been called (or recognize the last symbol in the list).

A separate script in the morning could read the flat file and issue any orders that pass your aggregate screens.

-Pete

See also Yahoo group about applying RE.



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems