Profile Picture

Trailing stop order rejection with margined account

Posted By alpha23 4 Years Ago
Message
Posted Saturday June 29 2013
I'm receiving the following order rejections for equity trades when the account is margined:

Trailing Stop order Rejected: Not enough cash to fill order. Resulting cash would be -962069.356104194. The current account value is 948293.360541389. The current minimum cash is -948293.360541389.

Since the stop is closing the position, cash should be going back into the account and the stop should not be rejected.

Is this something that needs to be fixed or am I overlooking something?

Please advise.

Thanks, Duane
Posted Sunday June 30 2013
This is probably due to the margin settings for the symbol. When using a margin, you can end up owing money to close a position (since RightEdge doesn't simulate margin calls). In your case it looks like the margin is probably very small compared to the value of the position, and you are ending up in a situation where you don't have enough money in the account to close the position.

Let us know if that doesn't clear things up for you.

Thanks,
Daniel
Posted Monday July 01 2013
I should have clarified that I’m noticing this occur on long positions. The above should only occur for short positions, correct?

Thanks, Duane
Posted Tuesday July 02 2013
Hi Duane,

This can still occur with long positions. Imagine there is a contract FOO trading at $30. Normally to buy 1 contract of it $30 would be deducted from your account. However, if the margin is set to $1, then if the price drops by more than $1 then you would have to pay money to close the position. Furthermore, if the contract size is set to 1000, then a drop in the price of $1 is a drop in $1000 of the position value. So low margins combined with high contract sizes can quickly eat up your account.

Thanks,
Daniel
Posted Tuesday July 02 2013
Daniel,

   The trades referenced above are stocks. Both initial margin and short margin settings are left at the default of 0. The account margin is set to 2. The stop loss is set to 15%.

Please let me know your thoughts because I don’t believe the above error should be occurring given the stop loss. It appears that RightEdge is not accounting for the cash that would be derived from the liquidation of the shares before calculating any money that would be owed to the broker. But then again, maybe something else is occurring and I’m not seeing it.

Thanks, Duane
Posted Friday July 12 2013
Daniel,

Thoughts?

Thanks, Duane
Posted Friday July 19 2013
Daniel,

I really need some input after 17 days from my posting on the 2nd. Please advise.

Thanks, Duane

Edited: Friday July 19 2013 by alpha23
Posted Sunday July 21 2013
Hi Duane,

I set up a simple test with a trailing stop loss of 15% and an account margin of 2, and everything seemed to work OK, so I'll need more information to figure out what is wrong in your situation.

Can you send me the symbol configuration for the symbol you are using? Either via a screenshot of the symbol information screen or just by attaching your symbolconfig.xml file and letting me know which symbol you are using. What is the entry price for the position, and what is the price it is trying to exit the position at? And how are you setting the trailing stop? This is how you can do it with the PositionSettings you use to open the position:

settings.TrailingStop = 0.15;
settings.TrailingStopType = TargetPriceType.RelativeRatio;

Thanks,
Daniel
Posted Monday July 22 2013
Daniel,

To reproduce the error, create a system with the following in SymbolScript.NewBar():

var ps = new PositionSettings()
{
Symbol = Symbol,
OrderType = OrderType.MarketOnOpen,
};
PositionManager.OpenPosition(ps);

Then run the system with the following settings:

•   Symbol ‘ALTR’ (daily)
•   Data Start Date: 1/1/2000
•   Allocation: 20
•   Alloctaion Type: Percentage
•   Stop Loss: 0.15 RelativeRatio

Please confirm that you are able to reproduce as soon as possible.

Thanks, Duane

Edited: Monday July 22 2013 by alpha23
Posted Tuesday July 23 2013
Thanks for the details Duane. I was able to reproduce this issue so I will investigate what is going on.

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems