I seem to have a problem submitting orders in the Historical Tester environment (JForex API 2.6.7 API ) . 1) The OnTick method is never called in IStrategy Interface 2) The onBar method is called and seems to provide consistent price information 3) When submitting market orders in onBar method (a simple test example shown below in this case for EUR/USD)
IBar testBar = history.getBar(instrument, Period.TEN_SECS, OfferSide.ASK,1); engine.submitOrder("test" + thetime, theinstrument, IEngine.OrderCommand.BUY, 0.01,testBar.getClose(),4.0,testBar.getClose()-0.1,testBar.getClose()+0.2);
The onMessage method records the subitted order:
Account Value :: 1000000.0 Message Information :: Order submitted Order Information :: EUR/USD,1,OPENED,1.3205,01/03/2005 10:00:00
However the order is filled way off market:
Account Value :: 1000000.0 Message Information :: Order filled Order Information :: EUR/USD,1,FILLED,1.2777,01/03/2005 10:00:00
Again when an order is submitted an hour later
Account Value :: 999999.88 Message Information :: Order submitted Order Information :: EUR/USD,2,OPENED,1.3211,01/03/2005 11:00:00
The order is again only filled at the price of 1.277, this is repeated continuously, note there is no change in the value of the account either. This is independent of the stoploss / take profit level. Account Value :: 999999.88 Message Information :: Order filled Order Information :: EUR/USD,2,FILLED,1.2777,01/03/2005 11:00:00
I am using the standard TesterMain.java code with a link to my own strategy.
|