FXCM - Tick Value is wrong - compromise?

 
So I have touched on this before briefly in a fairly old thread but I am not wanting to come up with an efficient solution to this issue. The programmers at FXCM have emailed me saying that I need to use:

Print(" -- Tick Size is: ", DoubleToStr(MarketInfo(Symbol(),MODE_TICKSIZE),5) , " -- Tick Value is: ", DoubleToStr(MarketInfo(Symbol(),MODE_TICKVALUE),5));

2014.10.16 14:46:37.853 Account Information XAUUSD,H1:  -- Tick Size is: 0.01000 -- Tick Value is: 0.01000

But as you can see from the Prints, there is nothing hidden past the 2nd decimal place...

So I need to synthetically produce TICKVALUE... At the moment this is what I have but the lot sizing is too large: 

...   

   risk_amount = AccountBalance( )*RiskPercent/100;
   
   // Custom Tick Value for FXCM 
   if( pips == 0.01 )pips *= 10; // multiply pips by 10 to get 0.10 if needed
     if( pips == 0.10 )pips  = 0.10; // if its 0.10 keep it that!
   double GBPUSD_BID = MarketInfo( "GBPUSD", MODE_BID); // Find GBPUSD current bid price
   double CustomTickValue = ( pips / GBPUSD_BID  * minlot ); // 0.10 / 1.5989 * 1.00 = CustomTickValue
      Print(" CustomTickValue is custom: ( ", pips, " / ", GBPUSD_BID, " * ", minlot, " ) = ", CustomTickValue);      


      //Get Take Profit price for FIRST TARGET
      if( SellStopPrice > Stored_SellPrice + Point || Stored_SellPrice > SellStopPrice + Point )
             {         
             pips_to_ssl = SellStopPrice - Stored_SellPrice;
             Print("pips_to_ssl == ", SellStopPrice," - ", Stored_SellPrice, " = ", pips_to_ssl); 
             }       

      //What is loss for 1 lot if tick DOES NOT return a true value - use custom below  
      double loss_for_1_lot1 = ( pips_to_ssl * pips ) * ( CustomTickValue / minlot );
           Print("loss_for_1_lot1 == ( ", pips_to_ssl," * ", pips, " ( ", CustomTickValue, " / ", minlot," ) = ", loss_for_1_lot1);
             
      double LotSize_Sell  = MathFloor( risk_amount / loss_for_1_lot1/ Lot_Step) * Lot_Step , 
             Print("LotSize_Sell == ", risk_amount," / ", loss_for_1_lot1, " / ", Lot_Step, " ) * ", Lot_Step, " = ", LotSize_Sell);

...

 The minimum lot size with FXCM on XAUUSD is "1.00" which is $0.01 per PIP (pip being 0.01) value...



Here is what the prints looked like when a demo trade was placed (notice "pips_to_ssl" - 35.85 pips... it should be 358.5 pips, right?):

2014.11.03 03:00:06.212 TF - v2.4.1 - XAUUSD XAUUSD,H1: Fourth Sell Order Placed: XAUUSD LotSize_Sell is: 293.0
2014.11.03 03:00:05.931 TF - v2.4.1 - XAUUSD XAUUSD,H1: open #4312432 sell stop 293.00 XAUUSD at 1157.30 sl: 1193.15 tp: 798.80 ok
2014.11.03 03:00:05.588 TF - v2.4.1 - XAUUSD XAUUSD,H1: Third Sell Order Placed: XAUUSD LotSize_Sell is: 219.0
2014.11.03 03:00:05.229 TF - v2.4.1 - XAUUSD XAUUSD,H1: open #4312431 sell stop 219.00 XAUUSD at 1157.30 sl: 1193.15 tp: 942.20 ok
2014.11.03 03:00:04.948 TF - v2.4.1 - XAUUSD XAUUSD,H1: Second Sell Order Placed: XAUUSD LotSize_Sell is: 183.0
2014.11.03 03:00:04.730 TF - v2.4.1 - XAUUSD XAUUSD,H1: open #4312430 sell stop 183.00 XAUUSD at 1157.30 sl: 1193.15 tp: 1013.90 ok
2014.11.03 03:00:04.558 TF - v2.4.1 - XAUUSD XAUUSD,H1: First Sell Order Placed: XAUUSD LotSize_Sell is: 73.0
2014.11.03 03:00:04.373 TF - v2.4.1 - XAUUSD XAUUSD,H1: open #4312429 sell stop 73.00 XAUUSD at 1157.30 sl: 1193.15 tp: 1121.45 ok
2014.11.03 03:00:03.981 TF - v2.4.1 - XAUUSD XAUUSD,H1: LotSize_Sell == 16.4532 / 0.2244201696453732 / 1.0 ) * 1.0 = 73.0
2014.11.03 03:00:03.981 TF - v2.4.1 - XAUUSD XAUUSD,H1: loss_for_1_lot1 == ( 35.85000000000014 * 0.1 ( 0.062599768380857 / 1.0 ) = 0.2244201696453732
2014.11.03 03:00:03.981 TF - v2.4.1 - XAUUSD XAUUSD,H1: sell_tp_price1 == 1157.3 - 35.85000000000014 = 1121.45
2014.11.03 03:00:03.981 TF - v2.4.1 - XAUUSD XAUUSD,H1: pips_to_ssl == 1193.15 - 1157.3 = 35.85000000000014
2014.11.03 03:00:03.981 TF - v2.4.1 - XAUUSD XAUUSD,H1: SellStopPriceMath == 1188.195408243045 - 4.955333333333321 = 1193.15
2014.11.03 03:00:03.981 TF - v2.4.1 - XAUUSD XAUUSD,H1:  CustomTickValue is custom: ( 0.1 / 1.59745 * 1.0 ) = 0.062599768380857
 
Well, gold & silver always a bit different than standard currency pairs. So, it is not uncommon. I also always need to create a special calculation for it.
 
Ok thanks. Any help?
 

DomGilberto:
So I have touched on this before briefly in a fairly old thread but I am not wanting to come up with an efficient solution to this issue. [...]

The FXCM gold contract changes in value by $1 for each $1 move in the price, or by 1 US cent for each cent move in the price. (Other brokers have contracts which are e.g. 100 times larger but where you can trade fractions of a lot such as 0.01; a 1.00 lot trade on FXCM gold is equivalent to a 0.01 lot trade on these other brokers.)

Therefore, the tick-value and tick-size look correct... except that they are not being converted to the deposit currency.

The true gold tick-value on a GBP account should therefore be MarketInfo("XAUUSD", MODE_TICKVALUE) / MarketInfo("GBPUSD", MODE_BID)

Forex symbols (unsurprisingly) work correctly and don't need adjustment.

Other CFDs such as UK100 are similarly reported in the instrument's base currency, not the deposit currency. UK100 should be calculated correctly on your GBP account without needing to manipulate the tick-value, but would require modification on a USD account.

 
jjc:

The true gold tick-value on a GBP account should therefore be MarketInfo("XAUUSD", MODE_TICKVALUE) / MarketInfo("GBPUSD", MODE_BID)

If you want something which doesn't involve hard-coding of the rules for particular symbols, and which probably works on all brokers, then you can do the following:

Check MarketInfo(..., MODE_PROFITCALCMODE). It it is 0 or 1, then use the MODE_TICKVALUE reported by the platform. [This assumes that the tick-value is correctly converted to the deposit currency if the profit-calc mode is forex or CFDs, and that there is only a problem if the mode = 2 = "futures").

If MODE_PROFITCALCMODE = 2 then get the symbol's base currency using SymbolInfoString(Symbol(), SYMBOL_CURRENCY_BASE)

If the symbol's base currency is the same as the deposit currency, then use the MODE_TICKVALUE reported by the platform.

Otherwise, convert the tick-value from the symbol's base currency to the deposit currency. But this isn't always straightforward. Firstly, you have to find the appropriate symbol while adjusting for any suffixes used by the broker in their symbol names. Secondly, if you are trading something like the Hang Seng (HKG33) on a GBP account, then there is no GBP/HKD pair in order to do a single translation of the tick-value. You would have to do something such as triangulating via USD or JPY.

 

Thank you kindly for your response. This is what I am now using (see below). I realised just a second ago about how I was creating the custom tick that the "pip" size was too large, therefore my lot sizing was huge!

   //Risk applied per trade --------------
   risk_amount = AccountBalance( )*RiskPercent/100;
   
   double GBPUSD_BID = MarketInfo( "GBPUSD", MODE_BID); // Find GBPUSD current bid price
   double CustomTickValue = ( MarketInfo("XAUUSD", MODE_TICKSIZE) / GBPUSD_BID  * minlot ) 
      Print(" CustomTickValue is custom: ( ", 0.01, " / ", GBPUSD_BID, " * ", minlot, " ) = ", CustomTickValue);
  
 
      //What is loss for 1 lot if tick DOES NOT return a true value - use custom below!  
      double loss_for_1_lot = ( pips_to_bsl * 10 ) * ( CustomTickValue / minlot );//needed to multiply pips_to_bsl by 10 else it is wrong calculations
             Print("loss_for_1_lot == ( ", pips_to_bsl," * ", 10, " ( ", CustomTickValue, " / ", minlot," ) = ", loss_for_1_lot);

      
      //Get Lot Size calculations for all FOUR Trades                   
      double LotSize_Buy  = MathFloor( risk_amount / loss_for_1_lot/ Lot_Step) * Lot_Step, 
             Print("LotSize_Buy == ", risk_amount," / ", loss_for_1_lot, " / ", Lot_Step, " ) * ", Lot_Step, " = ", LotSize_Buy);

...

 Only thing different from what your saying is TICKVALUE should be surely TICKSIZE though, right...? (if for some bizarre reason the broker updates their information correctly, using TICKVALUE could mess this up in the future)

 
DomGilberto:

 Only thing different from what your saying is TICKVALUE should be surely TICKSIZE though, right...?

No, the MODE_TICKSIZE is correct; the minimum movement of XAUUSD on an FXCM account is always 0.01, e.g. from 1170.08 to 1170.09

It's the value of that movement, MODE_TICKVALUE, which is not correct. It is reported as 0.01 regardless of the deposit currency. On a GBP account, the tick-size remains 0.01 but the value of that movement is about 0.00625, not 0.01 - i.e. $0.01 converted to GBP at a rate of approximately 1.6.

 

Okl thanks 

 Should I be doing this part - multiplying by 10 is wrong, but then multiplying by 0.01 is wrong too? (confusing myself now :P)

  

      //What is loss for 1 lot if tick DOES NOT return a true value - use custom below!  
      double loss_for_1_lot = ( pips_to_bsl * 10 ) * ( CustomTickValue / minlot );//needed to multiply pips_to_bsl by 10 else it is wrong calculations
             Print("loss_for_1_lot == ( ", pips_to_bsl," * ", 10, " ( ", CustomTickValue, " / ", minlot," ) = ", loss_for_1_lot);
 
Should it be this?

 //What is loss for 1 lot if tick DOES NOT return a true value - use custom below!  
      double loss_for_1_lot = ( pips_to_bsl / MarketInfo("XAUUSD", MODE_TICKSIZE) ) * ( CustomTickValue / minlot );

 
(need help with my formulae pleaseeee :))
 
Anyone...? I swear my formula is right, yet this is returning "0.0"

2014.11.03 08:28:40.626 TF - v2.4.1 - XAUUSD XAUUSD,H1: LotSize_Sell == 16.4532 / 20.30475881070342 / 1.0 ) * 1.0 = 0.0
2014.11.03 08:28:40.626 TF - v2.4.1 - XAUUSD XAUUSD,H1: loss_for_1_lot1 == ( 32.5 / 0.01 ( 0.06247618095601052 / 1.0 ) = 20.30475881070342
2014.11.03 08:28:40.611 TF - v2.4.1 - XAUUSD XAUUSD,H1: sell_tp_price1 == 1157.9 - 32.5 = 1125.4
2014.11.03 08:28:40.611 TF - v2.4.1 - XAUUSD XAUUSD,H1: pips_to_ssl == 1190.4 - 1157.9 = 32.5
Reason: