Profile Picture

TradeInsideBars, BarOpened, BarClosing

Posted By DrKoch 9 Years Ago
Message
Posted Friday April 11 2008
Good to have TradeInsideBars, BarOpened, BarClosing in SystemData.

Now I can send a "MarketOnClose" Orders based on the latest, nearly complete bar and its close price - very nice.

But,
what I really want to do:
* Calculate a bunch of indicators based on this latest close price
* do some more fancy calculations (in BarClosing)
* then send a MarketOnClose order for the very same close price.

(Yes, I checked, Indicators are currently not updated at the time BarClosing is called)

(Yes, I know this is not realistic, but it is a quick way to backtest strategies which otherwise would need much more and much more complex programming)

Could you imagine to add indicator processing before BarClosing is called?


www.finantic.de

Our Trading System at C2: Topaz
Posted Friday April 11 2008
I think the issue you are seeing is due to the fact that, in these events, the new bar has not yet been added to the BarList.

http://www.rightedgesystems.com/forums/Topic4625-13-1.aspx?Highlight=BarClosing

This is something that was an issue for me as well.

http://www.rightedgesystems.com/forums/Topic5256-9-1.aspx

You might be able to achieve what you are looking for with Daniel's suggestion about manually calling NewBar() from within the event handler, prior to your trading logic. Personally, I ended up modifying my indicators to calculate/store the currently active indicator value in a separate member variable.

One of my biggest concerns here is the fact that these events don't exist in a live system, they are called in a simulation run ONLY. However, it does sound like these interfaces will be coming into sync when tick-level back testing is implemented (which is a very good thing, imho).

HTH,
Mark
Posted Saturday April 12 2008
Ok, I read through this other thread.

What about these suggestions:

Calculate indicators which have an input series "Open" before BarOpened() is called.
Calculate all other indicators before BarClosing() is called.

Call BarOpened() in Life mode after the first tick of a new bar came in.


www.finantic.de

Our Trading System at C2: Topaz
Posted Saturday April 12 2008
DrKoch (4/12/2008)
Calculate indicators which have an input series "Open" before BarOpened() is called.
Calculate all other indicators before BarClosing() is called.


This is an interesting idea, but I'd rather not be limited to binding to just the open/close/high/low events on a bar. And what about indicators that aren't using price series as inputs?

Some of the indicators I use calculate a 'static' value for the active bar from the historical values of other indicators. I also have additional indicators which change on a tick-by-tick basis as the bar forms.

For me, the ideal solution is the ability to register the indicator class itself with more events than just NewBar(). This would allow selective connection to the BarOpened/BarClosing/NewTick events with the appropriate indicator. I think something like this could minimize the overhead of having to recalculate everything on every tick, and would put the active bar in the current slot prior to any of the price quote events.


DrKoch (4/12/2008)
Call BarOpened() in Life mode after the first tick of a new bar came in.


I'd have to agree with this, the BarOpened/BarClosing events in live mode would be great. They help avoid the clutter of tick counting logic in NewTick() when attempting to handle the first/last tick on a bar.

Cheers!
Mark
Posted Saturday April 12 2008
The BarOpened event includes the open prices for all symbols in the system.  So in live mode it would have to wait until there was a tick for all of the symbols.  That seems unfortunate, so maybe we also need a per-symbol BarOpened event.

Calculating indicators that use the open price as their input before the BarOpened event is raised is indeed an interesting idea.

I will keep thinking about it but I don't think either of these changes will make it into the current version of RightEdge (2008 Edition 1).

Thanks,
Daniel

Posted Friday December 18 2009
Hi,

the SystemData does not provide the BarOpened event.

I want to open a position on open and set a stop loss at a certain % below the open price. The stop loss should be active immeadiately after the opening the position.

How to do that?

Using NewTick did not really helped.

Thanks,

Mustafa

Posted Saturday December 19 2009
If you submit a market order in the NewBar() method (which happens at the end of the bar), it will be filled on the open of the next bar.

If you want to wait to see what the open price is before deciding whether to open a position, RightEdge doesn't really support this, since by the time you've seen the price it's already passed and there's no guarantee what price the order will be filled at.

Thanks,
Daniel
Posted Monday December 21 2009
Hi,

I would like to decide my trade based on the fact at which level the open on the next day is.

I can understand that you do not allow this in live mode. One could take the NewTick method. Things are different in the simulation with historical data. There is hardy data on tick level available.

I real live I can also decide my trade on the fact how the open is.

Mustafa

Posted Tuesday December 22 2009
The simplest way to do this would probably be to convert your bars to tick data, but put in two ticks for the open price. That way you can submit an order on the open tick of a bar, and it will get filled at that price (since you know another tick will come in at the same price).

Thanks,
Daniel
Posted Wednesday December 23 2009
Hi,

Could you say what you mean with converting data to TickData? And how can I add to open prices?

Thanks for your help.

Mustafa



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems