Profile Picture

Stop Orders in Paper Broker

Posted By BigBerner 10 Years Ago
Message
Posted Monday April 30 2007
Stop orders in the Paper Broker do not seem to work correctly. It seems to me that it will take the last traded price of the last bar as the stop level irrespective of what you place in "limit" in SystemData.OpenPosition.

Also orders that get filled in the Paper Broker are not updated in the Live System window until the start of the next bar.

And lastly, how do you place a StopLimit order? There does not seem to be any place to pass a stop level and a limit level.

Posted Wednesday May 02 2007
Whistling
Posted Wednesday May 02 2007
I have added bugs 975, 976, and 977 for these issues.

Thanks,
Daniel

Posted Monday May 21 2007
The stop and stop limit order handling has been improved.  We weren't doing it correctly before, so we appreciate you bringing it to our attention.

What was happening is the stop order wasn't really functional in the paper trader, and the stop limit order was working like the stop order should have.  PositionManager was using stop limit orders for the stop loss when it really should have been using stop orders.

I have modified the Order class so it now has a StopPrice in addition to the LimitPrice.  The stop order uses this new field instead of the LimitPrice field.  We don't fully support StopLimit orders yet, but when we do the stop price will go in the StopPrice field, and the limit price will go in the LimitPrice field.  We think this makes more sense. Smile  However, this means that if you have written your own broker plugin, you may have to update it to look in the StopPrice field instead of the LimitPrice field.

I have also modified PositionManager so that it uses stop orders for the stop loss.

I mentioned that we don't fully support StopLimit orders yet.  Specifically, there is no overload to the OpenPosition, AddToPosition, or RemoveFromPosition methods that allows you to specify both a stop price and a limit price.  Additionally, the paper trader has not been programmed to handle stop limit orders correctly.  If it does receive a stop limit order, it will reject it.  We have bug 977 to add support stop limit orders.  Right now I'm not sure what kind of priority we will give this bug, so let us know if you want to use stop limit orders.

Thanks,
Daniel

Posted Monday May 21 2007
Also, the issue with orders not updating in the live system window until the next bar (bug 976) should be fixed.  It now updates every time it gets a tick from your live data source.

Thanks,
Daniel

Posted Tuesday May 22 2007
Thanks Daniel, that all sounds good.

I do want to use stop limit orders, but I could handle them myself for now so you don't need to make it high priority. Which brings me to a feature that would be nice to have one day - an internal stop order. By this I mean a stop order that is monitored by RE and that when hit would raise an event 'OnStopTriggered" or something like that. Then the trader can employ their own logic as to how they want to handle it.

DoQ
Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)
Posted Friday August 03 2007
After messing around with Stop Orders and getting bad fills, I tried StopLimit Orders. It seems that it is still ignored in simulation but not in Live. Is this still the case? In order to test in Simulation, I have to switch to Stop Orders, but in Live, I need to switch to StopLimit. First off is StopLimit supported? Here is what I have setup:

PositionOrder AnOrder = new PositionOrder();

//defaults

AnOrder.BarCountExit = 0;//no timed exit

AnOrder.ProfitTarget = double.NaN;//this is a % tgt

AnOrder.StopLoss = double.NaN;

AnOrder.TrailingStop = double.NaN;

//details

AnOrder.OrderSymbol = symbol;

AnOrder.PositionType = PositionType.Long;

AnOrder.NumShares = TradeSize;

AnOrder.OrderType = OrderType.StopLimit;

AnOrder.StopPrice = HighTrigger;

AnOrder.LimitPrice = HighTrigger;

AnOrder.BarsValid = 1; //switch to indefinite pending

ReturnValue<string> retVal = PositionManager.OpenPosition(AnOrder);

if (!retVal.Success)

{

// Sets this bars color

GetPricePane(symbol).SetBarBackgroundColor(bar, bar, Color.Red);

// Add message to output window with the reason the position could not be opened

SystemData.Output.Add(OutputSeverityLevel.Warning, retVal.ReturnCode.Message, symbol);

}

else

{

// Sets this bars color

GetPricePane(symbol).SetBarBackgroundColor(bar, bar, Color.Green);

MostRecentPosID = retVal.Value;

// Store or process position ID here, if necessary

//SystemData.Output.Add(OutputSeverityLevel.Informational, MostRecentPosID, symbol);

}

Clearly, I see the green bars telling me that the order was fired off but I get no trades in Simulation. Tried Live, and an order did get sent to TWS, but now I'm too scared to use it...

What gives?

thx




DoQ_Indicators
"better is the enemy of good enough"
Posted Friday August 03 2007
Our paper trader broker does not support this order type yet.  We should at a minimum reject the order type.  There is an incident logged already to implement this functionality.
DoQ
Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)Supreme Being (11,393 reputation)
Posted Friday August 03 2007
billb (8/3/2007)
Our paper trader broker does not support this order type yet.  We should at a minimum reject the order type.  There is an incident logged already to implement this functionality.

But is it safe to use during Live trading or should I handle Stops in NewTick() for now?

thx


DoQ_Indicators
"better is the enemy of good enough"
Posted Friday August 03 2007
Let us review and retest to making sure that it's behaving as designed.  But as with anything submitting orders, make sure you wade in slowly and go against a test account.  Even if everything is behaving as designed, that may not be what you expected.

DoQ (8/3/2007)
billb (8/3/2007)
Our paper trader broker does not support this order type yet.  We should at a minimum reject the order type.  There is an incident logged already to implement this functionality.

But is it safe to use during Live trading or should I handle Stops in NewTick() for now?

thx



Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems