Profile Picture

Same day stop?

Posted By NomadicRiley 7 Years Ago
Message
Posted Sunday May 02 2010
Am trying to port a WL system where I have a limit entry w/ a possible exit on close (based on price) as well as a stop loss that should be valid the day of entry also.

Searched the forum and got the BarClosing function working for the exits, but I can't figure out how to get my stoploss to be valid the day of entry?

IE

Buy stock with limit order @ 20.00, have 10% stop loss, low for the day is $17, should get same day exit at $18.

What am I missing?

Thanks
Posted Sunday May 02 2010
If your buy order is being filled on the open price, then the stop loss should be able to be hit the same bar based on the close price, unless you have set CreateTicksFromBars to false. If your buy order is being filled based on the low price, then the low price can't trigger the stop loss. Basically a profit target/stop loss can only trigger based on a price tick that comes after the one that caused the buy order to be filled. You can enable the "Analyze High Before Low" option in the system properties if you want the stop loss to be able to trigger off the low price after a buy order has been filled based on the high price.

Thanks,
Daniel
Posted Monday August 15 2011
Analyze High Before Low is still not taking me out of my potions when a stop loss is triggered.

I would like to be able to stopLoss, profitTarget and MOC. Also, should be able to do longs or shorts.
(i.e if you analyze high before low on a short position it is backwards is it not)?

Seems like there should be a way to do this within BarClosing. For example if there were an applyStops() method, it could loop through and look for positions where the low < entry on longs and the high > entry on shorts.
apply stop where necessary.

Can someone comment on this?
Posted Monday August 15 2011
BTW...I am using build 36
Posted Wednesday May 27 2015
I run over the same issue.

Right now if let's say there's a bar with:

O = 10.00
H = 12.00
L = 8.00
C = 10.00
And there's a pending buy limit order at 9.00 that has a stop-loss attached with a stop loss price of 8.50 the entry order will get filled on the LOW tick, but the stop-loss order won't. This makes sense from the point of view of event handling based on ticks but not from a trading perspective. I think in case of a contingent order the tick where the entry-order got filled should be rerun with the contingent order.
The same would be true for a sell-stop-market order at 9.00 with a profit-target at 8.50.

Any comments?

FxGirl
Posted Wednesday May 27 2015
Hi FxGirl,

I see what you mean.  However, RightEdge's event-based, componentized design makes it hard to do something like this.  Generally I think that if you are running into accuracy issues where an entry and exit for the same position are (or should be) hit during the same bar, then you need higher frequency data to use for the simulation. Bar data where profit targets and stop losses are hit during the same bar as an entry (or the profit target and stop loss are both reached during the same bar) is inherently not high frequency enough to give you an accurate simulation.

Thanks,
Daniel
Posted Thursday May 28 2015
I understand. Still it's something to consider. You're right it shouldn't matter but since we have to do it some way and splitting O L H C into ticks is the way in RE it would be more consistent if any orders would be considered in a way that is consistent with that logic.

FxGirl
Posted Thursday May 28 2015
Daniel I still don't really understand how the O L H C ticks are processed regarding stop orders. In most cases it's clear it looks to me like:

Let's say entry gets filled at O and I have stop-loss set for position. It will set the stop and check it on the next ticks L H C and so on.
So if the entry get's filled on L it will check the stop at H and C and the next bars...

But if there's a huge gap and an entry gets filled at O when the stop-loss would already have been filled, it behaves weird. Sometimes it will fill the stop-loss order at the open, sometimes at the specified price at the low.

Is there some documentation somewhere how this works exactly? I'm still confused.

xoxo

FxGirl
Posted Friday May 29 2015
Can you give some more details about what you're seeing?  If an entry order is filled on the open tick, then a profit target or stop loss should never be filled with the same tick.  The O, H, L, and C ticks should each have different timestamps, which should also be reflected in the FilledTime of the trade.

Thanks,
Daniel
Posted Friday May 29 2015
I see for example a fill at 8 AM for the entry order and a fill at 11:59 PM for the stop-loss order. Which seems to suggest it got triggered at the close but it used the stop-loss price which was slightly better than the close.
On other occassions though it used the close price while the same was true.

When it checks a new tick, O H L C does it check if that tick is smaller than the stop-loss or does it consider the current bars high/low and decide on that basis?




Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems