Energy cuts and strategy exectutions problems

There were some days testing this strategies that i leaved the computers running overnight. energy cuts during the night are not uncommon, this could lead to one leg positions that never close and stops loss overpasses ending in more than estimates loss. Until i have an UPS or something like that it is not a good option to leave the strategy running to much time without monitoring it.

Another thing i noticed is that there was one overnight occasion where a trade opened with a 1k lot instead of the standard 100k. When my strategy tried to close the position 100k were sold so i was left short with 99k. I had to close the remaining volume by hand next day. I have a program to manually close positions in case something is wrong.

Tags: , ,

Stop loss too big

As noted before, the stop loss of 500 pips was going to bring the strategy troubles. the strategy haves to make a lot of trades to earn 500 pips and then with one single bad trade, profits are lost. Stop loss is too big, the the ship sinks.

Open date Open side Symbol Open price Size Utilized Margin Close date Close price P&L P&L in USD
06/23/11 11:35:28 Buy EUR/USD 1.42229 100000 0 06/23/11 11:39:15 1.42289 60 60
06/23/11 11:08:39 Buy EUR/USD 1.42157 100000 0 06/23/11 11:26:49 1.42288 131 131
06/23/11 09:05:39 Buy EUR/USD 1.42773 100000 0 06/23/11 10:30:26 1.42266 -507 -507
06/23/11 08:36:22 Buy EUR/USD 1.42732 100000 0 06/23/11 08:37:58 1.42754 22 22
06/23/11 08:04:31 Buy EUR/USD 1.42642 100000 0 06/23/11 08:04:48 1.4265 8 8
06/23/11 07:49:34 Buy EUR/USD 1.4266 100000 0 06/23/11 07:54:36 1.42764 104 104
06/23/11 07:34:59 Sell EUR/USD 1.42686 100000 100000 06/23/11 07:36:20 1.42669 17 11.9755417
06/23/11 03:33:24 Buy EUR/USD 1.43066 100000 0 06/23/11 07:25:46 1.42568 -498 -498
06/23/11 03:18:59 Sell EUR/USD 1.43127 100000 100000 06/23/11 03:22:21 1.43117 10 7.0444363
06/23/11 03:03:21 Sell EUR/USD 1.43107 100000 100000 06/23/11 03:14:27 1.43096 11 7.74887993
06/23/11 02:49:13 Buy EUR/USD 1.43002 100000 0 06/23/11 02:56:11 1.4307 68 68
06/23/11 02:18:32 Buy EUR/USD 1.43046 100000 0 06/23/11 02:26:18 1.43053 7 7
06/23/11 01:49:56 Buy EUR/USD 1.42916 100000 0 06/23/11 02:04:42 1.43027 111 111
06/23/11 01:19:12 Buy EUR/USD 1.43012 100000 0 06/23/11 01:25:21 1.43112 100 100
06/22/11 21:20:02 Buy EUR/USD 1.43512 100000 0 06/23/11 01:02:52 1.43112 -400 -400
06/22/11 20:33:25 Buy EUR/USD 1.4351 100000 0 06/22/11 20:58:12 1.43576 66 66
06/22/11 20:20:05 Sell EUR/USD 1.43541 100000 100000 06/22/11 20:28:24 1.43503 38 26.768858
06/22/11 18:36:56 Buy EUR/USD 1.44054 100000 0 06/22/11 19:46:18 1.43558 -496 -496
06/22/11 18:03:51 Sell EUR/USD 1.44055 100000 100000 06/22/11 18:04:54 1.44023 32 22.5421962

Tags: , ,

The limit orders strategy and technology.

i am now in real time, getting the stream of market data from FX Inside. this stream include market prices and limit order levels. The first thing to do was collect this data in a mysql database. I had some problems but i was finally able to connect the C++ feed program from lucre with my local mysql database and dump the data in there.

Next, every 15 minutes the program take a snapshot the data table, put all the orders with the same price level together and sum its volumes. This is done with php, technology used for now in all this:

Linux
C++
Mysql
Php daemon

at some books or articles about the limit order book theory  it says that market not affected by news are affected by microstructure in the form of limit book order imbalances placed by liquidity providers.

Lets suppose the euro/usd is at 1.435 level when the book snapshot was toked and the biggest amount of orders in the limit book is at 1.445, sell order types. What i believe is that 1.445 is a  short term support level for the eur/usd. If it gets hitted the market will temporally retrace. I don’t know how much the market will retrace if this support level is hitted, what i do know with more confidence is that it will be hitted because the markets are done to facilitate trading, if a lot of volume is at a certain level the market will go after it.

To summarize, the strategy is:

- get all limit orders information in real time, put them in a database.
- each 15 minutes, sum limit orders that are in the same price levels.
- the price levels with most volume is compared with current market price, the level could be one of the followings:
-  resistance
-  support
-  more buy
-  more sell
- exit position when level is reached or when stop loss is hitted.
- wait until the next quarter of hour and start collecting data again to have a new complete 15 minutes snapshot.
- make new trade.

if level is resistance, buy the eur/usd, position liquidation at resistance level. if level is support sell eur/usd, if level more buy, buy eur/usd and if level is labeled as more sell sell the eur/usd and liquidate when the level is reached.

when one leg of a position is open the strategy is locked and can0t make more trades, when the positions closes the strategy will start to collect data again and make new trades. never more than one position at the same time.

as a test, i am going to use a very big stop loss of 500 pips, this of course will have to be adjusted.

as you can see in the next statement the strategy started to run and make trades successfully.

Open date Open side Symbol Open price Size Utilized Margin Close date Close price P&L P&L in USD
06/21/11 15:49:51 Sell EUR/USD 1.44003 100000 100000 06/21/11 16:38:27 1.43969 34 23.6663326
06/21/11 14:49:41 Sell EUR/USD 1.43822 100000 100000 06/21/11 15:08:49 1.43796 26 18.0977837
06/21/11 14:19:49 Sell EUR/USD 1.43691 100000 100000 06/21/11 14:34:22 1.43647 44 30.6270186
06/21/11 13:49:31 Sell EUR/USD 1.43654 100000 100000 06/21/11 14:10:23 1.43627 27 18.7938523
06/21/11 13:34:17 Buy EUR/USD 1.43657 100000 0 06/21/11 13:41:09 1.43712 55 55
06/21/11 13:04:35 Sell EUR/USD 1.43767 100000 100000 06/21/11 13:17:42 1.43719 48 33.411293
06/20/11 19:05:04 Buy EUR/USD 1.43021 100000 0 06/20/11 21:19:21 1.43098 77 77
06/20/11 18:34:57 Sell EUR/USD 1.43114 100000 100000 06/20/11 18:39:53 1.43097 17 11.8331663
06/20/11 18:04:21 Sell EUR/USD 1.43086 100000 100000 06/20/11 18:04:54 1.43066 20 13.9213721
06/20/11 17:50:02 Buy EUR/USD 1.43095 100000 0 06/20/11 18:01:14 1.43148 53 53
06/20/11 17:04:06 Buy EUR/USD 1.43038 100000 0 06/20/11 17:25:45 1.43104 66 66
06/20/11 16:48:42 Sell EUR/USD 1.43177 100000 100000 06/20/11 16:53:36 1.43094 83 57.7736942
06/20/11 16:36:56 Buy EUR/USD 1.43086 100000 0 06/20/11 16:45:34 1.4316 74 74
06/20/11 15:48:52 Sell EUR/USD 1.43224 100000 100000 06/20/11 16:09:01 1.43112 112 77.9596837
06/20/11 15:34:30 Buy EUR/USD 1.43123 100000 0 06/20/11 15:42:22 1.43184 61 61
06/17/11 14:49:43 Sell EUR/USD 1.43033 100000 100000 06/17/11 17:02:53 1.43011 22 15.3135093
06/17/11 14:20:11 Buy EUR/USD 1.42934 100000 0 06/17/11 14:39:43 1.42992 58 58
06/17/11 13:56:19 Sell EUR/USD 1.42818 100000 100000 06/17/11 13:50:03 1.42718 100 69.6068605

Note how all the positions are profitable in the sample.

Tags: , , , , , , , , , ,

Starting my High frequency business with Lucre Capital.

Lucre capital(http://lucrecapital.com/) is a company who offer developer/traders the opportunity to operate using their API and servers. If a trader can do a profitable strategy using the tools they provide, they will allocate money for trading your strategy, pretty simple. I saw this as great opportunity to test my algorithmic trading and developer skills.

For the real time market feed they offer C++ source code for linux, you can get data from different sources, including Hotspot(http://www.hotspotfx.com/), Currenex(http://www.currenex.com/), FX Inside(http://www.integral.com/products/fx_inside_professional.htm) and Lava FX(http://www.hotspotfx.com/).

To make trades, lucre offers their own routing protocol called Lucre GDP. Again, with some modifications to the C++ code i was able to make trades using it.

Last, for checking the trades, positions, PL and all that they offer an online back end where you can download excel sheets of the strategy performance.

Using lucre capital tools I will try to do a strategy using limit order book theories, the strategy will be explained in detail in the next post.

Tags: , , , , , ,

All Eyes on Bernanke

Bernanke speaker at Semi-annual House of Representatives in front of House of Representatives, will he talk about “risk to growth” hinting QE 3.
Europe out of lime light for today , no factor for U.S. today .
China no hard landing , strongest industrial production since since 5 / 2010, also adding buy side momentum.
Bill Gross from Pimco , hinting QE 3 as well.
Fair Value: -4.37 under cash S&P:
SPX 8 Day Avg. = 1333 50Day = 1314 100Day = 1316
Settlement Gap : 5/8/2011 1341.75 , re-open 5/11/2011 1339.50 = 2.25 settlement gap.
USU 125 and 1/2 area (125′16 / 125′19) is a 4.36/.39 yield area which is where “yield” break started (6/29/2011)

Tags: , , ,

Several profiles

Another tool used in the market profile literature to analyze the markets is the several profile charts.

Here is the profile in sequence of the last 5 trading days:

Download

I have to change to html for formatting issues. There are 2 reason why some prices are in the prices column

Tags: , ,

Overlay Demand Curve

Cisco Futures call it overlay demand curve, other textbooks can call it composite. It is several days of market profile graphics put it together in the same vertical price axis. This tell us where the most volume area is, extremes of the curve and other key reference areas. It also help traders determine the state of the market. The states can be:

- trend.
- balance.
- to volatile.

Here is the overlay demand curve for the last 5 days of trading including today. This days are: 2011-06-24, 2011-06-27, 2011-06-28, 2011-06-29 and 2011-06-30.

1317.00 m
1316.75 m
1316.50 mf
1316.25 me
1316.00 mfe
1315.75 mfed
1315.50 mhgfed
1315.25 mhgfedb
1315.00 mkhgfed
1314.75 mkjhgedb
1314.50 mkjhgd
1314.25 lkjihgdcb
1314.00 lkjihgcb
1313.75 lkjihc
1313.50 lkjihdc
1313.25 lkihcba
1313.00 lihdcb
1312.75 lihcb
1312.50 lcb
1312.25 lb
1312.00 cba
1311.75 ba
1311.50 ba
1311.25 a
1311.00 ba
1310.75 a
1309.50 a
1309.25 a
1309.00 a
1307.50 a
1307.25 a
1307.00 a
1306.75 a0
1306.25 a
1306.00 a
1304.50 h
1304.25 mih
1304.00 ih
1303.75 mihf
1303.50 mihf
1303.25 mihf
1303.00 mlhgfd
1302.75 mlhgfed
1302.50 mihgfd
1302.25 mjihgfed
1302.00 mljihgfed
1301.75 mljed
1301.50 ljied
1301.25 ljed
1301.00 ledc
1300.75 ljec
1300.50 c
1300.25 lkj
1300.00 lkjc
1299.75 lkj
1299.50 lk
1299.25 kjc
1299.00 kc
1298.75 kc
1298.50 kjca
1298.25 kjc
1298.00 kjca
1297.75 kj
1297.50 kca0
1297.25 ca
1297.00 cba
1296.75 cba
1296.50 cba
1296.25 ba
1296.00 ba
1295.75 ba
1295.50 ba
1295.25 a
1295.00 ba
1294.75 ba
1294.50 b
1294.25 b
1294.00 b
1293.75 b
1293.50 b
1293.25 b
1292.75 b
1291.75 k
1291.50 mk
1291.25 mk
1291.00 mlk
1290.75 mlk
1290.50 mlk
1290.25 mlk
1290.00 mlk
1289.75 mlkj
1289.50 mljh
1289.25 mlji
1289.00 mjih
1288.75 mjih
1288.50 mjih
1288.25 jhf
1288.00 jihgf
1287.75 ihgf
1287.50 ihgf
1287.25 gfc
1287.00 gfec
1286.75 gfec
1286.50 edc
1286.25 fedc
1286.00 edc
1285.75 edc
1285.50 edb
1285.25 ed
1285.00 edb
1284.75 db
1284.50 db
1284.25 b
1284.00 b
1283.75 b
1283.50 b
1283.25 ba
1283.00 a
1282.75 ba
1282.50 b
1282.25 a
1282.00 a
1281.75 a
1281.50 a
1281.25 a
1280.75 a
1280.25 a
1280.00 k
1279.50 a0k
1279.25 lk
1279.00 alk
1278.75 alk
1278.50 mlkj
1278.25 mlkja
1278.00 mlja0
1277.75 mlj
1277.50 mlj
1277.25 lj
1277.00 mja
1276.75 mja
1276.50 mja
1276.25 mja
1276.00 m
1275.75 mja
1275.50 mja
1275.25 a
1275.00 ma
1274.75 fa
1274.50 h
1274.25 hgfba
1274.00 hgfba
1273.75 ihgfeba
1273.50 ihgfea
1273.25 jihgfea
1273.00 ihgfecb
1272.75 ihfecb
1272.50 ihfdcb
1272.25 iedcb
1272.00 ihedcb
1271.75 iedcb
1271.50 iedcb
1271.25 ecb
1271.00 edcbb
1270.75 db
1270.50 db
1270.25 edb
1270.00 edec
1269.75 dc
1269.50 dbfec
1269.25 bfec
1269.00 fecb
1268.75 bafec
1268.50 agfecb
1268.25 baifedb
1268.00 baigfedb
1267.75 aigfedcb
1267.50 bjigfedc
1267.25 baigfdcb
1267.00 bakigfedcb
1266.75 ajihfdc
1266.50 akjifdcb
1266.25 akjihdc
1266.00 kjihgdc
1265.75 amkjidc
1265.50 mkjihgc
1265.25 kjihg
1265.00 mlkjhgc
1264.75 mlkjhg
1264.50 amljhgd
1264.25 a0mlkjh
1264.00 amlh
1263.75 amlhg
1263.50 amlh
1263.25 mlh
1263.00 ml
1262.75 aml
1262.50 am
1261.50 m

This profile show the trader market is trending. It could be trending inside a bracket, what we know is that for the last 5 days the market is in clear upside trend, we can clearly see the nodes. In trend markets value is undefined and extremes too. Trading tactics in trending and bracket markets are different. Trader chip should be changed.

Download this overlay

Tags: , , ,

Normal “abnormal” day

Today the market showed us what textbooks call a normal day. this day is very rare in the index markets, it is similar to the normal variation but with the range extension very small and very small range all day.

Here is the profile graphic:

1317.00 m
1316.75 m
1316.50 fm
1316.25 em
1316.00 efm
1315.75 defm
1315.50 defghm
1315.25 bdefghm
1315.00 defghkm
1314.75 bdeghjkm
1314.50 dghjkm
1314.25 bcdghijkl
1314.00 bcghijkl
1313.75 chijkl
1313.50 cdhijkl
1313.25 abchikl
1313.00 bcdhil
1312.75 bchil
1312.50 bcl
1312.25 bl
1312.00 abc
1311.75 ab
1311.50 ab
1311.25 a
1311.00 ab
1310.75 a
1309.50 a
1309.25 a
1309.00 a
1307.50 a
1307.25 a
1307.00 a
1306.75 0a
1306.25 a
1306.00 a

Only 11 handles of amplitude.

Download profile

Tags: , , , ,

E Mini SP Market Profile Chart

Normal variation day, initial range extended to the upside.

High of the day: 1304.50
Low of the day: 1292.75

1304.50 h
1304.25 him
1304.00 hi
1303.75 fhim
1303.50 fhim
1303.25 fhim
1303.00 dfghlm
1302.75 defghlm
1302.50 dfghim
1302.25 defghijm
1302.00 defghijlm
1301.75 dejlm
1301.50 deijl
1301.25 dejl
1301.00 cdel
1300.75 cejl
1300.50 c
1300.25 jkl
1300.00 cjkl
1299.75 jkl
1299.50 kl
1299.25 cjk
1299.00 ck
1298.75 ck
1298.50 acjk
1298.25 cjk
1298.00 acjk
1297.75 jk
1297.50 0ack
1297.25 ac
1297.00 abc
1296.75 abc
1296.50 abc
1296.25 ab
1296.00 ab
1295.75 ab
1295.50 ab
1295.25 a
1295.00 ab
1294.75 ab
1294.50 b
1294.25 b
1294.00 b
1293.75 b
1293.50 b
1293.25 b
1292.75 b

Download profile

Tags: , , , ,

Normal variation in the s&p market profile chart

High of the day: 1291.75
Low of the day: 1278.75

Amplitude:13 handles

1291.75 k
1291.50 km
1291.25 km
1291.00 klm
1290.75 klm
1290.50 klm
1290.25 klm
1290.00 klm
1289.75 jklm
1289.50 hjlm
1289.25 ijlm
1289.00 hijm
1288.75 hijm
1288.50 hijm
1288.25 fhj
1288.00 fghij
1287.75 fghi
1287.50 fghi
1287.25 cfg
1287.00 cefg
1286.75 cefg
1286.50 cde
1286.25 cdef
1286.00 cde
1285.75 cde
1285.50 bde
1285.25 de
1285.00 bde
1284.75 bd
1284.50 bd
1284.25 b
1284.00 b
1283.75 b
1283.50 b
1283.25 ab
1283.00 a
1282.75 ab
1282.50 b
1282.25 a
1282.00 a
1281.75 a
1281.50 a
1281.25 a
1280.75 a
1280.25 a
1279.50 0a
1279.00 a
1278.75 a

Download this profile

Tags: , , ,