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.

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,

Introducing constraints to the economy only serves to limit what can be economical.

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.

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?

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?

Introducing constraints to the economy only serves to limit what can be economical.

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.

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 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.

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.

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?

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:

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

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,

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.

Introducing constraints to the economy only serves to limit what can be economical.