Double type of price makes Forex quotes different on 1 point up/down
Author: ichechet
Creation Date: 6/4/2010 4:04 AM
profile picture

ichechet

#1
There are some problems entering and exit deals. For example I have a price 1.5784 and I want to enter on this price. When I entered I can see the price 1.5784 or 1.5783 or 1.5785. I think it's because double type stores price not in exact value, but consumes less memory. Could you tell me what to do? I want to see enters and exits exact the price I enter and exit.
profile picture

Eugene

#2
Have you disabled commissions and slippage in Preferences?
profile picture

Cone

#3
Also, we have to look at these on a case-by-case basis depending on the order type, OHLC of the entry bar, etc. For example, it's completely correct for a limit order to be filled at a better price if the bar's open is lower/higher than your BuyAt/ShortAt Limit price.
profile picture

ichechet

#4
Thank you for reply!

Look at Preferences. Commisions are off. In Slippage I set in For Equities box 0 value. For Futures I left 1 value. All checkboxes are not set. I just set the exact order I'd like to buy/sell. But sometimes buy/sell are on 1 tick below/above this order.
profile picture

Eugene

#5
OK, it's not commissions and slippage. Let's see the OHLC, the order type, the relevant code.
profile picture

ichechet

#6
OK, let's test it!

I check Bars.Close[bar] It gets me 1.9780999422073364 double value. In MetaStock this bar closes value is exactly 1.9781 I know that Double type gives me not exactly the value It has from MetaStock.

I assign this value to variable. No change, the same value. In some cases I move my Stop Loss order to this value. Stop Loss Variable dealStop has the same value.

I exit the deal:
CODE:
Please log in to see this code.


dealStop is still 1.9780999422073364 here. But I see Exit Price on Trades page as 1.9780, not 1.9781
profile picture

Eugene

#7
Is the symbol defined in Symbol Info Manager?
profile picture

ichechet

#8
Yes, it defined as:
Symbol: GBP
Type: Future
Margin: 1000
Point Value: 100
Tick: 0.0001
Decimals: 4
profile picture

Eugene

#9
In this case, Wealth-Lab performs tick adjustment on a futures symbol, reducing the price of a sell stop order to the next lower tick increment.
profile picture

ichechet

#10
Very good, but what I have to do to make the Exit Price right? Add 1 tick? I have Bars.Close[bar] and it is in MetaStock exactly 1.9781. I move this price (even through Double type conversion) to Stop and got exit on 1.9780.
profile picture

Cone

#11
Metastock prices can't be exact numbers because MS also uses floating point representation to store price values. WL5's adapter uses the MetaLib component for the MS interface, and the numbers are read directly as doubles without transformation.

Unless there's an app that uses the Currency type for prices, there is rarely exactness in floating point number representation. That said, Wealth-Lab should be able to recognize and work correctly with futures (and Fx) tick boundaries, but it has proven to be a challenge to make it perfect for all cases.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).