Bitcoin Forum

Economy => Speculation => Topic started by: twa on February 20, 2012, 01:47:40 AM



Title: Bitcoinica's Order Types
Post by: twa on February 20, 2012, 01:47:40 AM
Hey guys I am trying to figure the orders out on bitcoinica and I am confusing myself.  Is this correct?

Revised - Just with respect to Stop and Limit order types

Two general states possible:

1) Open position

2) No position

With no position open they would both create new positions in whichever direction I set their target price at.  This is because both Limit and Stop orders turn into market orders once the target price is hit.  Limit orders, however, should** be used to create new positions.

With an open position, while both will adjust the position once executed, stop orders should** be used to adjust it.  If I wanted to create a new position(at a certain price), I should queue a stop order to liquidate at a target price followed by queuing a limit order to create the position.

** Should being the imperative word here.  I think what confused me was that the order type doesn't NEED to be one or the other.  Like it would make more sense to me if I couldn't execute a stop order unless I had an open position. I haven't tried to create a stop with no position open but since I can execute a limit order with a position open I assume I can do the reverse.


Original post (first two responses below about this):

A limit order

Limit Orders:
  • Set at a price lower than current market rate
  • A limit-sell order at $3.00 - creates a new short position once rate decreases to $3.00
  • A limit-buy order at $3.00 - creates a new long position once rate decreases to $3.00

Stop Orders:
  • Set at a price higher than current market rate
  • A stop-sell order at $5.00 - creates a new short position once rate increases to $5.00
  • A stop-buy order at $5.00 - creates a new long position once rate increases to $5.00


Title: Re: Bitcoinica's Order Types
Post by: Crypt_Current on February 20, 2012, 04:24:16 AM
Hey guys I am trying to figure the orders out on bitcoinica and I am confusing myself.  Is this correct?

Stop Orders:
  • Set at a price higher than current market rate
  • A stop-sell order at $5.00 - creates a new short position once rate increases to $5.00
  • A stop-buy order at $5.00 - creates a new long position once rate increases to $5.00

Limit Orders:
  • Set at a price lower than current market rate
  • A limit-sell order at $3.00 - creates a new short position once rate decreases to $3.00
  • A limit-buy order at $3.00 - creates a new long position once rate decreases to $3.00

Seems correct at my passing, tired glance.  Just remember:  Limit = Buy lower/equal, sell higher/equal than target.  Stop = Buy higher/equal, sell lower/equal than target.

edited to add the word "equal" probably superfluously


Title: Re: Bitcoinica's Order Types
Post by: trogdorjw73 on February 20, 2012, 04:30:45 AM
Hey guys I am trying to figure the orders out on bitcoinica and I am confusing myself.  Is this correct?

Stop Orders:
  • Set at a price higher than current market rate
  • A stop-sell order at $5.00 - creates a new short position once rate increases to $5.00
  • A stop-buy order at $5.00 - creates a new long position once rate increases to $5.00

Limit Orders:
  • Set at a price lower than current market rate
  • A limit-sell order at $3.00 - creates a new short position once rate decreases to $3.00
  • A limit-buy order at $3.00 - creates a new long position once rate decreases to $3.00

Seems correct at my passing, tired glance.  Just remember:  Limit = Buy lower/equal, sell higher/equal than target.  Stop = Buy higher/equal, sell lower/equal than target.

edited to add the word "equal" probably superfluously
So actually, the OP is not entirely correct. A stop order is set to stop your losses, generally speaking, so a stop-sell at $5.00 would execute when the price is lower than $5.00. Similarly, a limit-sell at $3.00 executes when the price is higher than $3.00. Limit orders are typically set to enter a position once the price reaches a certain point, so you might want to short for example if the price hits $5, or go long if the price hits $3. The stop orders are either to secure profits (e.g. you entered a long at $3, price is now $4.30, and you want to make sure you exit with at least a decent profit so you set a stop-sell at $4 -- or the reverse if you had e.g. a short at $5 and price is now $4.30, you might want to set a stop-buy at $4.50), or else they're to stop losses.


Title: Re: Bitcoinica's Order Types
Post by: twa on February 20, 2012, 05:50:14 PM
Thanks for the responses.  I really appreciate the help and I may be getting it finally.  I think the problem is I didn't state whether I had an open position or not.  So how about this:

Two general states possible:

1) Open position

2) No position

With no position open they would both create new positions in whichever direction I set their target price at.  This is because both Limit and Stop orders turn into market orders once the target price is hit.  Limit orders, however, should** be used to create new positions.

With an open position, while both will adjust the position once executed, stop orders should** be used to adjust it.  If I wanted to create a new position(at a certain price), I should queue a stop order to liquidate at a target price followed by queuing a limit order to create the position.

** Should being the imperative word here.  I think what confused me was that the order type doesn't NEED to be one or the other.  Like it would make more sense to me if I couldn't execute a stop order unless I had an open position.  I haven't tried to create a stop with no position open but since I can execute a limit order with a position open I assume I can do the reverse.


Title: Re: Bitcoinica's Order Types
Post by: trogdorjw73 on February 20, 2012, 06:10:57 PM
Thanks for the responses.  I really appreciate the help and I may be getting it finally.  I think the problem is I didn't state whether I had an open position or not.  So how about this:

Two general states possible:

1) Open position

2) No position

With no position open they would both create new positions in whichever direction I set their target price at.  This is because both Limit and Stop orders turn into market orders once the target price is hit.  Limit orders, however, should** be used to create new positions.

With an open position, while both will adjust the position once executed, stop orders should** be used to adjust it.  If I wanted to create a new position(at a certain price), I should queue a stop order to liquidate at a target price followed by queuing a limit order to create the position.

** Should being the imperative word here.  I think what confused me was that the order type doesn't NEED to be one or the other.  Like it would make more sense to me if I couldn't execute a stop order unless I had an open position.  I haven't tried to create a stop with no position open but since I can execute a limit order with a position open I assume I can do the reverse.
Should is all relative. Basically it's more like this: if you think the price will continue to move in a given direction once it passes a certain point, use a stop (e.g. if the price is low right now and then climbs to $5, you think it will continue to climb to $6 so you set a stop-buy; or if you think if the price falls to $3.75 and will then continue to fall set a stop-sell). Limit on the other hand is for when you think "once the price reaches a certain level, it will bounce the other way", so maybe you look at the current charts, see a large-ish ask wall at $5, and figure if we break that wall there will be a drop back to $4.50 right after (or you think if we come near the $3.90 bid wall we will bounce back the other way). So you could use a limit to enter (or exit) the market when certain price levels are hit.

IMO, there's only a minor difference between stops and limits on Bitcoinica, and it's mostly a question of how you want to set things up. I believe one difference is the stops and limits execute at different prices because of the spread. A stop-buy will execute if the buy price is higher than your stop, so the market price might be $4.95 but the spread makes the buy price $5.02 and thus a stop-buy at $5 executes. A limit sell at $5 on the other hand would execute if the sell price is higher than $5. The reverse is true for stop-sell and limit-buy. But really, both are useful for different reasons.


Title: Re: Bitcoinica's Order Types
Post by: stochastic on February 20, 2012, 08:28:38 PM
Thanks for the responses.  I really appreciate the help and I may be getting it finally.  I think the problem is I didn't state whether I had an open position or not.  So how about this:

Two general states possible:

1) Open position

2) No position

With no position open they would both create new positions in whichever direction I set their target price at.  This is because both Limit and Stop orders turn into market orders once the target price is hit.  Limit orders, however, should** be used to create new positions.

With an open position, while both will adjust the position once executed, stop orders should** be used to adjust it.  If I wanted to create a new position(at a certain price), I should queue a stop order to liquidate at a target price followed by queuing a limit order to create the position.

** Should being the imperative word here.  I think what confused me was that the order type doesn't NEED to be one or the other.  Like it would make more sense to me if I couldn't execute a stop order unless I had an open position.  I haven't tried to create a stop with no position open but since I can execute a limit order with a position open I assume I can do the reverse.

Don't forget about Trailing Stops.  Though I prefer if Bitcoinica had Trailing Limit Stops.


Title: Re: Bitcoinica's Order Types
Post by: Crypt_Current on February 20, 2012, 09:25:22 PM
Thanks for the responses.  I really appreciate the help and I may be getting it finally.  I think the problem is I didn't state whether I had an open position or not.  So how about this:

Two general states possible:

1) Open position

2) No position

With no position open they would both create new positions in whichever direction I set their target price at.  This is because both Limit and Stop orders turn into market orders once the target price is hit.  Limit orders, however, should** be used to create new positions.

With an open position, while both will adjust the position once executed, stop orders should** be used to adjust it.  If I wanted to create a new position(at a certain price), I should queue a stop order to liquidate at a target price followed by queuing a limit order to create the position.

** Should being the imperative word here.  I think what confused me was that the order type doesn't NEED to be one or the other.  Like it would make more sense to me if I couldn't execute a stop order unless I had an open position.  I haven't tried to create a stop with no position open but since I can execute a limit order with a position open I assume I can do the reverse.

Don't forget about Trailing Stops.  Though I prefer if Bitcoinica had Trailing Limit Stops.

I still don't understand fully how trailing stops work at Bitcoinica -- does anyone have any direct experience with this?


Title: Re: Bitcoinica's Order Types
Post by: RandyMarsh on February 20, 2012, 10:25:36 PM
I've never used a trailing stop order on bitcoinica, but I assume it functions like a normal trailing stop order:

If you make a trailing stop sell order, your order will be executed once the price drops a certain amount, say X, (like a normal stop) but if the price rises first, then the peak of the value rise becomes the new upper limit and if the price falls by that set amount, 'X', from that peak your sell executes.

Its a little confusing on bitcoinica because you set the sell price rather than the price change (which i called X) which i think makes more sense since the sell price will vary if the price rises, but the change in price will remain constant...


For a trailing stop buy: change the word sell to buy, drop to rise, and upper limit to lower limit.  :P


Title: Re: Bitcoinica's Order Types
Post by: trogdorjw73 on February 20, 2012, 11:58:10 PM
I've never used a trailing stop order on bitcoinica, but I assume it functions like a normal trailing stop order:

If you make a trailing stop sell order, your order will be executed once the price drops a certain amount, say X, (like a normal stop) but if the price rises first, then the peak of the value rise becomes the new upper limit and if the price falls by that set amount, 'X', from that peak your sell executes.

Its a little confusing on bitcoinica because you set the sell price rather than the price change (which i called X) which i think makes more sense since the sell price will vary if the price rises, but the change in price will remain constant...


For a trailing stop buy: change the word sell to buy, drop to rise, and upper limit to lower limit.  :P
This is how it *should* work, but I tried one once and found that trailing stops do not work as they should on Bitcoinica. Basically, what happened is this:

I had a long at say $4 (that's not where I actually held a long, but we'll just go with that). The price was at $4.50 and I thought, "This would be a good time for a trailing stop." So I set a trailing stop sell at $4.20, thus guaranteeing myself at least a $0.20 profit. Now, if the price were to rise to $5, my trailing stop sell should go up as well -- to $4.667 if it increases by the percentage rise. This is what SHOULD happen, but instead what happened was this.

The price went up a bit, say to $4.55. Then it dropped to $4.45. It did this numerous times over the course of a few hours, and eventually my trailing stop sell executed at $4.47 or something. Basically, last I checked the trailing stops were adjusted every time there was a rise, rather than relative to the highest/lowest price since the time the trailing stop was set. So when you have a trailing stop sell, every time the price increases then the value of your trailing stop sell will go up; likewise, if you have a trailing stop buy, every time the price drops your trailing stop buy value will drop. Given the volatility of Bitcoin and Bitcoinica, the results is that either type of trailing stop order will often execute relatively close to the current market value.

Which, of course, means Zhoutong needs to fix this portion of his code. I'd wager most people never use it, so no one has pointed out the error before. Or maybe he has fixed it in the past ~month as I haven't tried testing it again lately.


Title: Re: Bitcoinica's Order Types
Post by: twa on February 21, 2012, 12:06:58 AM
Thanks for the responses.  I really appreciate the help and I may be getting it finally.  I think the problem is I didn't state whether I had an open position or not.  So how about this:

Two general states possible:

1) Open position

2) No position

With no position open they would both create new positions in whichever direction I set their target price at.  This is because both Limit and Stop orders turn into market orders once the target price is hit.  Limit orders, however, should** be used to create new positions.

With an open position, while both will adjust the position once executed, stop orders should** be used to adjust it.  If I wanted to create a new position(at a certain price), I should queue a stop order to liquidate at a target price followed by queuing a limit order to create the position.

** Should being the imperative word here.  I think what confused me was that the order type doesn't NEED to be one or the other.  Like it would make more sense to me if I couldn't execute a stop order unless I had an open position.  I haven't tried to create a stop with no position open but since I can execute a limit order with a position open I assume I can do the reverse.
Should is all relative. Basically it's more like this: if you think the price will continue to move in a given direction once it passes a certain point, use a stop (e.g. if the price is low right now and then climbs to $5, you think it will continue to climb to $6 so you set a stop-buy; or if you think if the price falls to $3.75 and will then continue to fall set a stop-sell). Limit on the other hand is for when you think "once the price reaches a certain level, it will bounce the other way", so maybe you look at the current charts, see a large-ish ask wall at $5, and figure if we break that wall there will be a drop back to $4.50 right after (or you think if we come near the $3.90 bid wall we will bounce back the other way). So you could use a limit to enter (or exit) the market when certain price levels are hit.

IMO, there's only a minor difference between stops and limits on Bitcoinica, and it's mostly a question of how you want to set things up. I believe one difference is the stops and limits execute at different prices because of the spread. A stop-buy will execute if the buy price is higher than your stop, so the market price might be $4.95 but the spread makes the buy price $5.02 and thus a stop-buy at $5 executes. A limit sell at $5 on the other hand would execute if the sell price is higher than $5. The reverse is true for stop-sell and limit-buy. But really, both are useful for different reasons.

By should I mean the "correct" way because it seems like on Bitcoinica there are no rules on them.  Essentially you could submit a stop order with no position (still haven't tried so still assuming this would work) when the correct order would be a limit-buy since I am creating a new position (not liquidating part/all of an existing one).  So the fact that you could create an order using any type in any situation is really confusing.  Again, why would I be able to use a limit order to liquidate part of my position?

It seems like on Bitcoinica they are simply all the exact same.  Limit, Stop, and Trailing stop.  Does anyone actually know if there is a technical difference on Bitcoinica between these? Is this just a listbox where each does the exact same thing with different labels?


Title: Re: Bitcoinica's Order Types
Post by: stochastic on February 21, 2012, 12:26:11 AM
Quote
Again, why would I be able to use a limit order to liquidate part of my position

Why would you not be able to?  When I go long I put up a stop order so that if the price falls a certain amount, the stop order is triggered and it liquidates my position.  I also put a limit order so that if the price goes high enough it triggers the limit order and it liquidates my position.  If I am short the opposite happens.  If the price raises higher than my acceptable risk then the stop order liquidates my position.  If the price drops to a point where I like the profit, it liquidates my position.

The Trailing Stops work fine with me.  Maybe because it triggers a market order that people have trouble.  Just because an stop is set at a specific price does not mean you will get that price, especially in low volume conditions.  When the price move triggers a stop, they become market orders.  You get the market price after the trigger.


Title: Re: Bitcoinica's Order Types
Post by: twa on February 21, 2012, 12:34:07 AM
Quote
Again, why would I be able to use a limit order to liquidate part of my position

Why would you not be able to?  When I go long I put up a stop order so that if the price falls a certain amount, the stop order is triggered and it liquidates my position.  I also put a limit order so that if the price goes high enough it triggers the limit order and it liquidates my position.  If I am short the opposite happens.  If the price raises higher than my acceptable risk then the stop order liquidates my position.  If the price drops to a point where I like the profit, it liquidates my position.

The Trailing Stops work fine with me.  Maybe because it triggers a market order that people have trouble.  Just because an stop is set at a specific price does not mean you will get that price, especially in low volume conditions.  When the price move triggers a stop, they become market orders.  You get the market price after the trigger.

Thanks for taking the time to explain this to me stochastic.  Again, I am new to this so I am not arguing but just trying to figure it out.  Instead of a limit order queued at the higher price, couldn't you also put a stop to liquidate it since there is no restriction on target prices for each order type?  I would get it if when you tried to queue a STOP order at the higher price you got some kind of error message saying to use a limit order.


Title: Re: Bitcoinica's Order Types
Post by: trogdorjw73 on February 21, 2012, 01:09:07 AM
Quote
Again, why would I be able to use a limit order to liquidate part of my position

Why would you not be able to?  When I go long I put up a stop order so that if the price falls a certain amount, the stop order is triggered and it liquidates my position.  I also put a limit order so that if the price goes high enough it triggers the limit order and it liquidates my position.  If I am short the opposite happens.  If the price raises higher than my acceptable risk then the stop order liquidates my position.  If the price drops to a point where I like the profit, it liquidates my position.

The Trailing Stops work fine with me.  Maybe because it triggers a market order that people have trouble.  Just because an stop is set at a specific price does not mean you will get that price, especially in low volume conditions.  When the price move triggers a stop, they become market orders.  You get the market price after the trigger.
My understanding of the trailing stop is that it should only move with the maximum/minimum relative to your starting position. So, if I set a trailing stop-sell at $4 and the current price is $4.50, and then the price increases to $5.0, my trailing stop should increase to $4.44 -- the maximum price relative to the starting price increased 11.1%. What I saw happen about a month back is that the trailing stop-sell changed with each increase in price while staying static on decreases. So given the same starting point of $4 trailing stop-sell and a market price of $4.50, if the price never goes above $4.50 (e.g. it starts to fall), but it never hits $4, my trailing stop should not execute. Or if the price goes up to $4.75, then back to $4.50, then up to $4.75, then back to $4.50... and let's say it does this twenty times just for kicks. Assuming that happens and the price never actually leaves the range of $4.50 to $4.75, the trailing stop-sell should move from $4.00 up to $4.22 and will still not execute (e.g. the maximum price reached relative to the starting price is a 5.56% increase). What I saw was that my trailing stop-sell that was $0.25 below the starting price ended up executing an hour or two later at very close to the starting price, because the price went up a bit, back down, up a bit, etc. The only way my trailing stop should have executed at close to the starting price is if the current price went up at least $0.25, which it did not.

Having said this, I'm going to go try one again just to see if something has changed. I'll put a trailing stop-sell on my current long position at $2.00 and check back in a couple hours to see how far it has moved.

Edit: Staring position image below:
http://img41.imageshack.us/img41/7127/bitcoinicatest.png


Title: Re: Bitcoinica's Order Types
Post by: RandyMarsh on February 21, 2012, 11:40:41 AM
There is no incorrect way to use the orders, if you set a limit buy above the market price, then bitcoinica says to itsself 'oh shit guys we're already below that price... execute now'. if you set a stop buy (weather or not you have a position open) below the market price then bitcoinica says to itsself 'oh shit we're already above that price... execute now'.

I think there may be a fundamental misunderstanding of how the orders work,
Basically:

Limit: makes you money by executing your order when the price reaches a point in the profit direction.

Stop: cuts your losses by executing your order when the price reaches a point in the loss direction.

trailing stop: cuts your losses by a set amount(of loss), rather then at a set price.

And any of these orders can be used to open, close, increase or partially close a position.

Profit directions: (a-duh)
Profit DirectionLoss Direction
Selling
Down
Up
Buying
Up
Down


If you insist on looking at this in terms of editing positions, you have to take into account that, as long as you have money in your pocket you have a position open... if you have 10 BTC then technically you're holding a 1:1 long position with a value of 10BTC. If you have 10 USD in your pocket then your holding a 1:1 short position with a value of 10 USD. By this logic, you are always editing a position rather than opening or closing.
So if you have 100 USD in your bitcoinica account then your 1:1 short right... so if the price is falling you can set a stop loss to buy bitcoins before your short position becomes less valuable. (this a stop order being used to open a new bitcoinica position)

I hope you can strain sense out of that, might be harder then getting juice from a stone, its a little convoluted.



As for the trailing stops, If thats the way their being executed, I would consider that 'wrong' because most people would head into a trailing stop thinking it works the way I described, and the text (that at least used to be found on Bitcoinica) to explain the functionality of the trailing stop was not contrary to that.
If the trailing stop is to be used at all then the way it executes will have to be outlined on the site.
Although it does just sound like a programming error, having the stop price change with every price change rather than just the overall price change, I cant see a time when an order executing like that would be beneficial. I reckon this should be fixed.
Im testing a position too: Trailing stop buy at $50
https://i.imgur.com/3INiF.png


Title: Re: Bitcoinica's Order Types
Post by: Crypt_Current on February 21, 2012, 04:10:34 PM

Profit directions: (a-duh)
Profit DirectionLoss Direction
Selling
Down
Up
Buying
Up
Down
This is a bit technical -- can you dumb it down a shade?   ;D


As for the trailing stops, If thats the way their being executed, I would consider that 'wrong' because most people would head into a trailing stop thinking it works the way I described, and the text (that at least used to be found on Bitcoinica) to explain the functionality of the trailing stop was not contrary to that.
If the trailing stop is to be used at all then the way it executes will have to be outlined on the site.
Although it does just sound like a programming error, having the stop price change with every price change rather than just the overall price change, I cant see a time when an order executing like that would be beneficial. I reckon this should be fixed.
Im testing a position too: Trailing stop buy at $50
https://i.imgur.com/3INiF.png

Cool ... I'm glad some persons have decided to test this finally


Title: Re: Bitcoinica's Order Types
Post by: stochastic on February 21, 2012, 05:04:09 PM
Bitcoinica should have practice accounts for new people to test out their service.  That way new people won't feel discouraged or overwhelmed.  Bitcoinica use to have order explanation in their Advanced Order tab that could remind new users but now that is gone.  The problem with Trailing Stops is that the BTC/USD price can become very volatile and if the price moves in a direction causing your Trailing Stop to change, then the price could quickly reverse closing out your position.  Otherwise Trailing Stops work well for me.

As for limit or stops and when to put them think of it this way when you don't have a position, do each in order:

1.  Limit order to get into the market.

2.  Stop order/Trailing Stop to set a stop loss to protect your down side.

3.  Limit order to take your profit.

If you are having trouble you can use Bitcoinica helper (https://bitcointalk.org/index.php?topic=58462.0) by M43vR.  It works well and will set a stop and limit order around your position.


Title: Re: Bitcoinica's Order Types
Post by: Crypt_Current on February 21, 2012, 06:51:46 PM
Bitcoinica should have practice accounts for new people to test out their service.  That way new people won't feel discouraged or overwhelmed. 

The low price point of entry atm kind of negates any need for practice accounts IMO.  It will be an inevitable necessity once Bitcoinica becomes officialized ... the price point of entry will likely rise as well.  Maybe.  Hopefully not.



Bitcoinica use to have order explanation in their Advanced Order tab that could remind new users but now that is gone.
Yeah, those explanations actually came in handy for me, being that Bitcoinica is my first experience with any of these concepts:  limits, stops etc.  I found myself constantly referring to them at first -- "OK I want to sell higher, ok then limit... OK I want to buy higher OK then stop..."


Title: Re: Bitcoinica's Order Types
Post by: twa on February 21, 2012, 10:47:18 PM
There is no incorrect way to use the orders, if you set a limit buy above the market price, then bitcoinica says to itsself 'oh shit guys we're already below that price... execute now'. if you set a stop buy (weather or not you have a position open) below the market price then bitcoinica says to itsself 'oh shit we're already above that price... execute now'.

I think there may be a fundamental misunderstanding of how the orders work,
Basically:

Limit: makes you money by executing your order when the price reaches a point in the profit direction.

Stop: cuts your losses by executing your order when the price reaches a point in the loss direction.

trailing stop: cuts your losses by a set amount(of loss), rather then at a set price.

And any of these orders can be used to open, close, increase or partially close a position.


I get the definitions of them and what they are used for but what I am confused with now is why I could use a stop order to create a new position.  Why is that possible?


Title: Re: Bitcoinica's Order Types
Post by: trogdorjw73 on February 21, 2012, 11:32:09 PM

Profit directions: (a-duh)
Profit DirectionLoss Direction
Selling
Down
Up
Buying
Up
Down
This is a bit technical -- can you dumb it down a shade?   ;D


As for the trailing stops, If thats the way their being executed, I would consider that 'wrong' because most people would head into a trailing stop thinking it works the way I described, and the text (that at least used to be found on Bitcoinica) to explain the functionality of the trailing stop was not contrary to that.
If the trailing stop is to be used at all then the way it executes will have to be outlined on the site.
Although it does just sound like a programming error, having the stop price change with every price change rather than just the overall price change, I cant see a time when an order executing like that would be beneficial. I reckon this should be fixed.
Im testing a position too: Trailing stop buy at $50
https://i.imgur.com/3INiF.png

Cool ... I'm glad some persons have decided to test this finally
Okay, so here's the results about a day later (and not accounting for the downtime at MtGox):

http://img33.imageshack.us/img33/6996/bitcoinicatest2.png

My trailing-stop-sell has gone up in target price by $0.1385 since yesterday. The trailing stop has gone up 6.925% since yesterday. Based on the entry price of $4.33712/$4.40606, for that increase to be correct, we would have had to have hit a price point of $4.63747/4.71118 at some point in the past day. We have never come anywhere near $4.60 during this time frame, and in fact we've pretty much been down from the starting point since I entered the trailing stop. Thus, I have to conclude that as I noted earlier, trailing stops are not working properly and should be avoided until Zhoutong fixes the problem.

RandyMarsh, I'll be interested in hearing your analysis from the $50 starting point for a trailing-stop-buy. Am I incorrect or does the above confirm my stance that it's currently broken?


Title: Re: Bitcoinica's Order Types
Post by: zhoutong on February 21, 2012, 11:38:40 PM
There is no incorrect way to use the orders, if you set a limit buy above the market price, then bitcoinica says to itsself 'oh shit guys we're already below that price... execute now'. if you set a stop buy (weather or not you have a position open) below the market price then bitcoinica says to itsself 'oh shit we're already above that price... execute now'.

I think there may be a fundamental misunderstanding of how the orders work,
Basically:

Limit: makes you money by executing your order when the price reaches a point in the profit direction.

Stop: cuts your losses by executing your order when the price reaches a point in the loss direction.

trailing stop: cuts your losses by a set amount(of loss), rather then at a set price.

And any of these orders can be used to open, close, increase or partially close a position.


I get the definitions of them and what they are used for but what I am confused with now is why I could use a stop order to create a new position.  Why is that possible?

For example, you want to buy Bitcoins *only* when it rises above $4.5. Then you can set a stop buy order at 4.5.

In Bitcoinica, orders and positions are not linked at all. If there's any position, the system will always add/subtract from it. If there's no position, the system will create one. Whenever a position becomes zero, the P/L will be realized and it will be removed.


Title: Re: Bitcoinica's Order Types
Post by: twa on February 22, 2012, 12:30:57 AM
There is no incorrect way to use the orders, if you set a limit buy above the market price, then bitcoinica says to itsself 'oh shit guys we're already below that price... execute now'. if you set a stop buy (weather or not you have a position open) below the market price then bitcoinica says to itsself 'oh shit we're already above that price... execute now'.

I think there may be a fundamental misunderstanding of how the orders work,
Basically:

Limit: makes you money by executing your order when the price reaches a point in the profit direction.

Stop: cuts your losses by executing your order when the price reaches a point in the loss direction.

trailing stop: cuts your losses by a set amount(of loss), rather then at a set price.

And any of these orders can be used to open, close, increase or partially close a position.


I get the definitions of them and what they are used for but what I am confused with now is why I could use a stop order to create a new position.  Why is that possible?

For example, you want to buy Bitcoins *only* when it rises above $4.5. Then you can set a stop buy order at 4.5.

In Bitcoinica, orders and positions are not linked at all. If there's any position, the system will always add/subtract from it. If there's no position, the system will create one. Whenever a position becomes zero, the P/L will be realized and it will be removed.

Hey thanks Zhoutong for confirming that.


Title: Re: Bitcoinica's Order Types
Post by: stochastic on February 22, 2012, 03:24:00 AM
My trailing-stop-sell has gone up in target price by $0.1385 since yesterday. The trailing stop has gone up 6.925% since yesterday. Based on the entry price of $4.33712/$4.40606, for that increase to be correct, we would have had to have hit a price point of $4.63747/4.71118 at some point in the past day. We have never come anywhere near $4.60 during this time frame, and in fact we've pretty much been down from the starting point since I entered the trailing stop. Thus, I have to conclude that as I noted earlier, trailing stops are not working properly and should be avoided until Zhoutong fixes the problem.


Your calculation is different than Bitcoinica's because it seems Bitcoinica does on a pip per pip change and you are calculating by the percentage pip change.

Since you were doing a Trailing Stop sell yours calculation was:

4.33712 * .006925 = 0.3003456

0.3003456 + 4.33712 = 4.637466

But on Bitcoinica it would really be based only on the pip movement of the Sell side.

For example, I followed the 4 changes in my Trailing stop (on the sell side).  Over the course of ~10 minutes it changed,

4.2439 to 4.2496 to 4.2498 to 4.2499

The sell bid changed:

4.33257 to 4.33825 to 4.33829 to 4.33854

If we take the difference between the bid price and the trailing stop orders we get:

0.08867, 0.08865, 0.08849, 0.08864,



Title: Re: Bitcoinica's Order Types
Post by: trogdorjw73 on February 22, 2012, 03:43:37 AM
My trailing-stop-sell has gone up in target price by $0.1385 since yesterday. The trailing stop has gone up 6.925% since yesterday. Based on the entry price of $4.33712/$4.40606, for that increase to be correct, we would have had to have hit a price point of $4.63747/4.71118 at some point in the past day. We have never come anywhere near $4.60 during this time frame, and in fact we've pretty much been down from the starting point since I entered the trailing stop. Thus, I have to conclude that as I noted earlier, trailing stops are not working properly and should be avoided until Zhoutong fixes the problem.


Your calculation is different than Bitcoinica's because it seems Bitcoinica does on a pip per pip change and you are calculating by the percentage pip change.

Since you were doing a Trailing Stop sell yours calculation was:

4.33712 * .006925 = 0.3003456

0.3003456 + 4.33712 = 4.637466

But on Bitcoinica it would really be based only on the pip movement of the Sell side.

For example, I followed the 4 changes in my Trailing stop (on the sell side).  Over the course of ~10 minutes it changed,

4.2439 to 4.2496 to 4.2498 to 4.2499

The sell bid changed:

4.33257 to 4.33825 to 4.33829 to 4.33854

If we take the difference between the bid price and the trailing stop orders we get:

0.08867, 0.08865, 0.08849, 0.08864,
Even if it's based off the value chance rather than a percentage change, it's still not working right. My original entry price was $4.33712/$4.40606, with a trailing limit at $2.00. For the trailing limit to now sit at $2.1385 then the Bitcoinica price would have had to hit $4.46/$4.53 or so, and at least looking at the time range it never went anywhere near that high. But now we've had some more movement, so let's re-evaluate.

Currently, my trailing limit stop sell is at $2.2734, an increase of $0.2734 from the original price. Have we come anywhere near $4.50/$4.68 on Bitcoinica during the past day? I guess it's possible, with large movements, but I'll leave my order in to see what happens over the course of yet another day. I'm still pretty sure it's moving every time there's a noticeable change in pricing up, not taking into account the original price.

Edit: Seems to be holding as my limit stop sell is still at $2.2901 after all the recent movements. I'll leave it up more to verify, but it looks like my main error was in assuming it was percentage based rather than absolute values.


Title: Re: Bitcoinica's Order Types
Post by: stochastic on February 22, 2012, 05:16:14 AM
I tried to ask on the Bitcoinica help the equation or determining the Trailing Stop but I just got a vague answer.

I am running a script right now to pull the ask and the price status of my trailing stop every minute.  I will update if I find anything unordinary.


Title: Re: Bitcoinica's Order Types
Post by: twa on February 22, 2012, 06:52:19 AM
Can someone tell me how it would be possible to queue a limit order AFTER a stop for my open position?

Open Position ------ Long @ 5.00

Order Queue ------- 1) STOP-sell @ 4.90 ( liquidate long position )
Order Queue ------- 2) Limit-sell @ 4.89 ( go short after liquidating long position)

The above in reality just executes the limit-sell order immediately and liquidates my position leaving the STOP-sell order still queued. So you can't queue a limit order at a price lower than the market price if you have an open position?  Does that mean I would need to queue a second STOP-sell order at 4.89 to create a new short position after the first stop liquidates my original long position?


Title: Re: Bitcoinica's Order Types
Post by: stochastic on February 22, 2012, 07:11:01 AM
Can someone tell me how it would be possible to queue a limit order AFTER a stop for my open position?

Open Position ------ Long @ 5.00

Order Queue ------- 1) STOP-sell @ 4.90 ( liquidate long position )
Order Queue ------- 2) Limit-sell @ 4.89 ( go short after liquidating long position)

The above in reality just executes the limit-sell order immediately and liquidates my position leaving the STOP-sell order still queued. So you can't queue a limit order at a price lower than the market price if you have an open position?  Does that mean I would need to queue a second STOP-sell order at 4.89 to create a new short position after the first stop liquidates my original long position?

What does it do if you place both the stop and limit order after you have an open position?


Title: Re: Bitcoinica's Order Types
Post by: zhoutong on February 22, 2012, 07:38:11 AM
Can someone tell me how it would be possible to queue a limit order AFTER a stop for my open position?

Open Position ------ Long @ 5.00

Order Queue ------- 1) STOP-sell @ 4.90 ( liquidate long position )
Order Queue ------- 2) Limit-sell @ 4.89 ( go short after liquidating long position)

The above in reality just executes the limit-sell order immediately and liquidates my position leaving the STOP-sell order still queued. So you can't queue a limit order at a price lower than the market price if you have an open position?  Does that mean I would need to queue a second STOP-sell order at 4.89 to create a new short position after the first stop liquidates my original long position?

Currently we don't support stop-limit order and if-then order. If you want to liquidate a 50 BTC long position and create a 50 BTC short position, you can just place a 100 BTC stop sell order.


Title: Re: Bitcoinica's Order Types
Post by: twa on February 22, 2012, 07:22:06 PM
Can someone tell me how it would be possible to queue a limit order AFTER a stop for my open position?

Open Position ------ Long @ 5.00

Order Queue ------- 1) STOP-sell @ 4.90 ( liquidate long position )
Order Queue ------- 2) Limit-sell @ 4.89 ( go short after liquidating long position)

The above in reality just executes the limit-sell order immediately and liquidates my position leaving the STOP-sell order still queued. So you can't queue a limit order at a price lower than the market price if you have an open position?  Does that mean I would need to queue a second STOP-sell order at 4.89 to create a new short position after the first stop liquidates my original long position?

Currently we don't support stop-limit order and if-then order. If you want to liquidate a 50 BTC long position and create a 50 BTC short position, you can just place a 100 BTC stop sell order.

Ok so that answer was yes - I would need to create a SECOND stop order (or the equivalent of like you mentioned with a single stop of -100 to create a new -50 short) at a certain price since any limit order made BELOW market price is automatically executed regardless of its place in the queue of orders.  Does that  seem slightly misleading since there is no documentation surrounding it?  I just don't know how you would figure out how these work without losing money.

On a side note for anyone else reading this trying to get a better handle: It appears I am wrong in calling the "active orders" an order queue since it doesn't behave like one other than presenting the orders in a FIFO manner.  Wouldn't that be easier to implement than just having all active orders? Forget the IF THEN or whatever - just have active orders execute based on FIFO.


Title: Re: Bitcoinica's Order Types
Post by: stochastic on February 23, 2012, 07:43:57 AM
I tried to ask on the Bitcoinica help the equation or determining the Trailing Stop but I just got a vague answer.

I am running a script right now to pull the ask and the price status of my trailing stop every minute.  I will update if I find anything unordinary.

Here is the data for anyone interested.  I will analyze it and post the results.  I set a trailing stop sell at a price of $2.00 and every 5 seconds using the API I retrieved the status of the trailing stop and the current BTC/USD bid price.  With this data one can calculate the lag of updating the trailing stop.  I was only able to get between 500 and 600 raw data points.

trailing stop CSV (http://www.mediafire.com/?5sdtragr782u2am)


Title: Re: Bitcoinica's Order Types
Post by: Tril on February 23, 2012, 03:53:22 PM
Can someone tell me how it would be possible to queue a limit order AFTER a stop for my open position?

Open Position ------ Long @ 5.00

Order Queue ------- 1) STOP-sell @ 4.90 ( liquidate long position )
Order Queue ------- 2) Limit-sell @ 4.89 ( go short after liquidating long position)

The above in reality just executes the limit-sell order immediately and liquidates my position leaving the STOP-sell order still queued. So you can't queue a limit order at a price lower than the market price if you have an open position?  Does that mean I would need to queue a second STOP-sell order at 4.89 to create a new short position after the first stop liquidates my original long position?

Currently we don't support stop-limit order and if-then order. If you want to liquidate a 50 BTC long position and create a 50 BTC short position, you can just place a 100 BTC stop sell order.

Ok so that answer was yes - I would need to create a SECOND stop order (or the equivalent of like you mentioned with a single stop of -100 to create a new -50 short) at a certain price since any limit order made BELOW market price is automatically executed regardless of its place in the queue of orders.  Does that  seem slightly misleading since there is no documentation surrounding it?  I just don't know how you would figure out how these work without losing money.

On a side note for anyone else reading this trying to get a better handle: It appears I am wrong in calling the "active orders" an order queue since it doesn't behave like one other than presenting the orders in a FIFO manner.  Wouldn't that be easier to implement than just having all active orders? Forget the IF THEN or whatever - just have active orders execute based on FIFO.

I'm fairly certain all the active orders can trigger in any order, and are not treated as a queue.  If you to need an order sequence, have a bot use the API to create the orders only when you want them active.


Title: Re: Bitcoinica's Order Types
Post by: Crypt_Current on February 24, 2012, 02:09:49 AM

On a side note for anyone else reading this trying to get a better handle: It appears I am wrong in calling the "active orders" an order queue since it doesn't behave like one other than presenting the orders in a FIFO manner.  Wouldn't that be easier to implement than just having all active orders? Forget the IF THEN or whatever - just have active orders execute based on FIFO.

Maybe something could be implemented into Bitcoinica where the user has a choice between FIFO and the original way -- perhaps a checkbox?


Title: Re: Bitcoinica's Order Types
Post by: trogdorjw73 on February 25, 2012, 08:46:31 PM
Even if it's based off the value chance rather than a percentage change, it's still not working right. My original entry price was $4.33712/$4.40606, with a trailing limit at $2.00. For the trailing limit to now sit at $2.1385 then the Bitcoinica price would have had to hit $4.46/$4.53 or so, and at least looking at the time range it never went anywhere near that high. But now we've had some more movement, so let's re-evaluate.

Currently, my trailing limit stop sell is at $2.2734, an increase of $0.2734 from the original price. Have we come anywhere near $4.50/$4.68 on Bitcoinica during the past day? I guess it's possible, with large movements, but I'll leave my order in to see what happens over the course of yet another day. I'm still pretty sure it's moving every time there's a noticeable change in pricing up, not taking into account the original price.

Edit: Seems to be holding as my limit stop sell is still at $2.2901 after all the recent movements. I'll leave it up more to verify, but it looks like my main error was in assuming it was percentage based rather than absolute values.
So here we are, a few days later, and I've now killed my trailing stop sell. Why? Well, check this out:

http://img851.imageshack.us/img851/9118/bitcoinicatest3.png

You'll note that three days ago when we were in the $4.50 range give or take, my $2 original trailing stop had increased to $2.2734. Here we are a few days later and the maximum price we've had since I started this order is around $5.20. That's an increase of nearly $1 since I created the trailing stop sell, but my trailing stop sell has gone up a whopping $2.2945. The spread would have need to have hit $6.60/$6.70 or so for the trailing strop to have changed that much -- if it were being calculated correctly. I'm not sure how frequently it gets updated, but whatever is happening the code for trailing stops does not appear to be working right.

RandyMarsh, how about your trailing stop buy order at $50 -- what's it at now? I'm guess with the movements we've seen, you're probably down to maybe $48, unless the code is even worse than it appears. Maybe it's down to $40? LOL


Title: Re: Bitcoinica's Order Types
Post by: stochastic on February 25, 2012, 10:06:43 PM
if it were being calculated correctly

There are a lot of different ways to calculate the movement of a trailing stop.  One is not more right than another.  What is right is for Bitcoinica telling its clients the formula for calculating the movement of the trailing stop.

One way is for a pip for pip movement of the trailing stop with the price.  Specifically,
Quote from: Glynn and Iglehart 1995, Trading Securities Using Trailing Stops
Each time the price process reaches a new high, the stop is raised by the difference between the new high and the previous high.

You showed that this does not happen on Bitcoinica.  Here is a graph for others to get an idea of what is going on.  I have posted this data before, but I increased the trailing stop amount by 2.5 for each measurement so that it can be seen on the graph better.  The top graph shows the movement of the price (in black) and the trailing stop (in red).  The second graph shows the change in the price (black) and trailing stop (red).  You can clearly see that the change in the trailing stop value is higher than the change in the price.  

Thus the trailing stop is not on a pip to pip change like I originally thought it was.

http://img688.imageshack.us/img688/2921/fullgraph.jpg


Title: Re: Bitcoinica's Order Types
Post by: twa on February 28, 2012, 07:38:17 PM
Is there going to be any sort of guide for this?


Title: Re: Bitcoinica's Order Types
Post by: twa on March 02, 2012, 06:56:45 AM
Why did a STOP-BUY order at 4.50 execute at 4.70?


Title: Re: Bitcoinica's Order Types
Post by: notme on March 02, 2012, 07:10:54 AM
Why did a STOP-BUY order at 4.50 execute at 4.70?

Because a stop-buy will buy as soon as the price is above 4.50.

If you want to buy as soon as the price is less than 4.50, you want a limit-buy.


Title: Re: Bitcoinica's Order Types
Post by: stochastic on March 02, 2012, 07:22:06 AM
Is there going to be any sort of guide for this?

Your guide (https://en.wikipedia.org/wiki/Order_(exchange))