Bitcoin Forum
April 19, 2024, 12:26:33 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Bitcoinica's Order Types  (Read 3167 times)
twa (OP)
Full Member
***
Offline Offline

Activity: 320
Merit: 100


BitSong is a decentralized music streaming platfor


View Profile
February 22, 2012, 12:30:57 AM
 #21

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.

1713486393
Hero Member
*
Offline Offline

Posts: 1713486393

View Profile Personal Message (Offline)

Ignore
1713486393
Reply with quote  #2

1713486393
Report to moderator
Every time a block is mined, a certain amount of BTC (called the subsidy) is created out of thin air and given to the miner. The subsidy halves every four years and will reach 0 in about 130 years.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713486393
Hero Member
*
Offline Offline

Posts: 1713486393

View Profile Personal Message (Offline)

Ignore
1713486393
Reply with quote  #2

1713486393
Report to moderator
1713486393
Hero Member
*
Offline Offline

Posts: 1713486393

View Profile Personal Message (Offline)

Ignore
1713486393
Reply with quote  #2

1713486393
Report to moderator
1713486393
Hero Member
*
Offline Offline

Posts: 1713486393

View Profile Personal Message (Offline)

Ignore
1713486393
Reply with quote  #2

1713486393
Report to moderator
stochastic
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500


View Profile
February 22, 2012, 03:24:00 AM
 #22

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.
trogdorjw73
Hero Member
*****
Offline Offline

Activity: 482
Merit: 500


View Profile WWW
February 22, 2012, 03:43:37 AM
Last edit: February 22, 2012, 07:57:55 AM by trogdorjw73
 #23

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.

stochastic
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500


View Profile
February 22, 2012, 05:16:14 AM
 #24

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.

Introducing constraints to the economy only serves to limit what can be economical.
twa (OP)
Full Member
***
Offline Offline

Activity: 320
Merit: 100


BitSong is a decentralized music streaming platfor


View Profile
February 22, 2012, 06:52:19 AM
 #25

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?

stochastic
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500


View Profile
February 22, 2012, 07:11:01 AM
 #26

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?

Introducing constraints to the economy only serves to limit what can be economical.
zhoutong
VIP
Hero Member
*
Offline Offline

Activity: 490
Merit: 502


View Profile WWW
February 22, 2012, 07:38:11 AM
 #27

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.

Founder of NameTerrific (https://www.nameterrific.com/). Co-founder of CoinJar (https://coinjar.io/)

Donations for my future Bitcoin projects: 19Uk3tiD5XkBcmHyQYhJxp9QHoub7RosVb
twa (OP)
Full Member
***
Offline Offline

Activity: 320
Merit: 100


BitSong is a decentralized music streaming platfor


View Profile
February 22, 2012, 07:22:06 PM
 #28

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.

stochastic
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500


View Profile
February 23, 2012, 07:43:57 AM
 #29

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

Introducing constraints to the economy only serves to limit what can be economical.
Tril
Full Member
***
Offline Offline

Activity: 213
Merit: 100


View Profile
February 23, 2012, 03:53:22 PM
 #30

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.
Crypt_Current
Hero Member
*****
Offline Offline

Activity: 686
Merit: 500


Shame on everything; regret nothing.


View Profile
February 24, 2012, 02:09:49 AM
 #31


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?

10% off at CampBX for LIFE:  https://campbx.com/main.php?r=C9a5izBQ5vq  ----  Authorized BitVoucher MEGA reseller (& BTC donations appreciated):  https://bitvoucher.co/affl/1HkvK8o8WWDpCTSQGnek7DH9gT1LWeV5s3/
LTC:  LRL6vb6XBRrEEifB73DiEiYZ9vbRy99H41  NMC:  NGb2spdTGpWj8THCPyCainaXenwDhAW1ZT
trogdorjw73
Hero Member
*****
Offline Offline

Activity: 482
Merit: 500


View Profile WWW
February 25, 2012, 08:46:31 PM
 #32

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

stochastic
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500


View Profile
February 25, 2012, 10:06:43 PM
Last edit: February 25, 2012, 10:17:33 PM by stochastic
 #33

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.


Introducing constraints to the economy only serves to limit what can be economical.
twa (OP)
Full Member
***
Offline Offline

Activity: 320
Merit: 100


BitSong is a decentralized music streaming platfor


View Profile
February 28, 2012, 07:38:17 PM
Last edit: March 02, 2012, 06:55:24 AM by twa
 #34

Is there going to be any sort of guide for this?

twa (OP)
Full Member
***
Offline Offline

Activity: 320
Merit: 100


BitSong is a decentralized music streaming platfor


View Profile
March 02, 2012, 06:56:45 AM
 #35

Why did a STOP-BUY order at 4.50 execute at 4.70?

notme
Legendary
*
Offline Offline

Activity: 1904
Merit: 1002


View Profile
March 02, 2012, 07:10:54 AM
 #36

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.

https://www.bitcoin.org/bitcoin.pdf
While no idea is perfect, some ideas are useful.
stochastic
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500


View Profile
March 02, 2012, 07:22:06 AM
 #37

Is there going to be any sort of guide for this?

Your guide

Introducing constraints to the economy only serves to limit what can be economical.
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!