XAUUSD wrong lot sizing on GBP denominated account? - page 2

 
DomGilberto:
No it's not a spread betting account.

@WHRoader - What do you mean I don't want points in that calculation? :s?

How can I apply the correct risk to the given trade based upon the distance to the stop if I don't include points in the formula...? (confused).

23.64 || 2,364 points... That's what I am trying to get my head around... To be frank, I'm convinced that I am applying too little 1 troy ounce positions because I have a GBP denominated account... I just need someone to tell me I am right / wrong from what I've shown?


Just a quick thought and correct me if I'm wrong . . . you are assuming that position size calculation is incorrect because when you have a loss you aren't losing the %age you wished to risk ? are you factoring the spread into the calculation ? if you aren't it could easily be more noticeable on this symbol as it tends to have a bigger spread.
 

@ RaptorUK - When I say that the position size is smaller than what it should be, I mean by pretty much half...

Put it this way, I am forward testing in a small account - If the position hits it's first target, it should be taking off 25% if applicable, else close 1 minimum lot size || 1 troy ounce. The overall monetary risk on this trade equates to approx £75.00 risk.... The XAUUSD trade is just over 2/3rds of the way to taking profit at the first target... the current open P & L on that position is approx £18.00....

Now, with the same formula applied to all the currency pairs I've traded so far; they're as accurate as I need them to be... Just Gold & Silver are not... The spread on these pairs would be nothing material due to the fact that I am not shooting for 5-20 points.. Stops and targets are most of the time approx. 80-250 points...

 
GumRai:

Can you please show your code that results in this print?

double loss_for_1_lot1 = pips_to_ssl/ ts * tv ;

2013.11.08 23:40:30 2013.06.19 19:00 V1 - XAUUSD XAUUSD,H1: loss_for_1_lot1 formula: 23.64 / 0.01 * 0.01 = 23.64

Maybe you could add this print

Print("Account currency = ",AccountCurrency() );

to confirm that you are actually trading GBP in the ST because I can see no way that tv can be 0.01


2013.11.11 10:13:12     2013.06.17 15:00  V1 - XAUUSD XAUUSD,H1:  Account # (deleted) -- leverage is 1:200 -- Account currency is GBP -- Minium Lots are: 1 -- Min Lot Step is: 1
I can assure you, it is GBP denominated...

What do you mean show the code that results in that print, you have it there?
 
DomGilberto:

I can assure you, it is GBP denominated...

What do you mean show the code that results in that print, you have it there?

Thats the output from the Print(), not the code . . . can you show the code that gives that output, the actual Print( . . . . ) statement, we need to see where you are getting the Tick value from because something is wrong with it. In fact it looks like you are printing ts (Tick Size) twice . . .

23.64 / 0.01 * 0.01 = 23.64 is incorrect, 0.01 * 0.01 = 0.0001 and 23.64 / 0.0001 = 236400

 
Ok here it is:

//+------------------------------------------------------------------+
//| Order Enter Function                                             |
//+------------------------------------------------------------------+
void OrderEntry(int direction)
{
   //Padding for the stop and padding for the entry too. 
   double ATR_Pad = iATR(NULL,60,14,1)/2; 
   double Buy_Pad = NormalizeDouble(ATR_Pad,Digits);
   double Sell_Pad = NormalizeDouble(ATR_Pad,Digits);
   
   //Stop calculations.    
   double ATR = iATR(NULL,60,14,1);
   double MA = iMA(NULL,60,MA_Period,0,1,0,1);
  
   //Lot calculation   
   double risk_amount = AccountBalance( )*RiskPercent/100;
   double Lot_Step = MarketInfo(Symbol(), MODE_LOTSTEP);
   double ts = MarketInfo(Symbol(), MODE_TICKSIZE);
   double tv = MarketInfo(Symbol(), MODE_TICKVALUE);
   double minlot = MarketInfo(Symbol(), MODE_MINLOT);
         
          
//+-------------------------------------------------------------------------------------+
//| Order Buy Function                                                                  |
//+-------------------------------------------------------------------------------------+   

//Place a pending buystop if no orders exists. Pending or otherwise.
if(direction==0)
{ 
      
      //Get Highest Price in our lookback range and set buy price above it.
      int iTBT = iBarShift(NULL,60, triggerBarTime, true),
      iHH = iHighest(NULL,60, MODE_HIGH, iTBT + CandlesBeforeBiasObtained, 0);
      double Buy_Here = High[iHH] + Buy_Pad;
      double buyPrice= NormalizeDouble(Buy_Here,Digits);
            
      double BuyStopPriceMath = MA - ATR;
      double BuyStopPrice = NormalizeDouble(BuyStopPriceMath,Digits);

      //get our buystop price from below the ma and our takeprofit based on our r:r ratio.
      double pips_to_bsl=buyPrice-BuyStopPrice;
      double buy_tp_price=(pips_to_bsl*RewardRatio)+buyPrice;
      double buy_takeprofit_price= NormalizeDouble(buy_tp_price, Digits);
      
      double loss_for_1_lot = pips_to_bsl/ ts * tv ;
      double LotSize_Buy = MathFloor( risk_amount / loss_for_1_lot/ Lot_Step) * Lot_Step ;

      double btp=buy_takeprofit_price;
      int PositionIndex1;    
      int TotalNumberOfOrders1;   
      TotalNumberOfOrders1 = OrdersTotal();   

      static double Stored_BuyPrice;

      if( OpenOrdersThisPair(Symbol())==0 && LotSize_Buy - minlot > - Point )
         {
         int BuyTicketOrder = OrderSend(Symbol(),OP_BUYSTOP,LotSize_Buy,buyPrice,3,BuyStopPrice,btp,NULL,MagicNumber,0,Green);
         if(BuyTicketOrder == -1)Print("First Buy Order Last Error = ",GetLastError(), " On: ", Symbol());
         if(BuyTicketOrder > 0)Print("FIRST BUY ORDER PLACED: ", Symbol(), " LotSize_Buy is: ", LotSize_Buy );
         } 


Here is also a print of ticksize and tickvalue on the live account under XAUUSD:

2013.11.11 06:10:51  V1 - XAUUSD XAUUSD,H1:  Account # (CENSORED) -- leverage is 1:200 -- Account currency is GBP -- Tick Size is: 0.01 -- Tick Value is: 0.01
 

TickSize and Tickvalue would be both the same @ 0.01? 0.01 is the tick and for every tick move would equate to a 0.01 cent fluctuation in P & L at the smallest position size... assuming I had a USD account, it would be accurate...

Does that not sound right?

Also:

"23.64 / 0.01 * 0.01 = 23.64 is incorrect, 0.01 * 0.01 = 0.0001 and 23.64 / 0.0001 = 236400"

Yea - This would be correct if I isolated the formula like this:

"23.64 / ( 0.01 * 0.01 ) = 236400 "

But because It is one constant formula, the answer is correct in terms of producing 23.64... It's whether or not this number is the correct number in accordance with populating the correct position size?

 
DomGilberto:
Ok here it is:



Here is also a print of ticksize and tickvalue on the live account under XAUUSD:


Sorry, you my earlier calculation was wrong . . .

You still haven't shown the code that produces this print . . .

2013.11.08 23:40:30     2013.06.19 19:00  V1 - XAUUSD XAUUSD,H1:  loss_for_1_lot1 formula: 23.64 / 0.01 * 0.01 = 23.64

. . . but never mind.

Tick Value - Tick value in the deposit currency.


My understanding is how much is 1 point worth, in the deposit currency, for 1 standard lot - on my chart for a USD account for XAUUSD TickValue is 1.06908

 

What? That doesn't make any sense to me - How come the tick value I am seeing is simply returning 0.01...

The code is all up there ^?

double loss_for_1_lot = pips_to_bsl/ ts * tv ;

"loss_for_1_lot" is just the same as "loss_for_1_lot1", but it's on the buy side... sorry for flipping back and forward from buy to sell side, I just grab the first thing that's printed in ST, whether that be a buy or a sell...

Who is your broker? Would my tick value have something to do with the fact it is GBP denominated? (confused)

 
Ok - So I check with Alpari UK and they're returning this - This is a GBP denominated account...
2013.11.11 13:57:37     Pip value XAUUSD,H1: Alert:  Tick Value is: 0.0626 -- Tick Size is: 0.001
 
DomGilberto:

What? That doesn't make any sense to me - How come the tick value I am seeing is simply returning 0.01...

Maybe your Broker has screwed it up . . . it happens sometimes.

DomGilberto:

The code is all up there ^?

"loss_for_1_lot" is just the same as "loss_for_1_lot1", but it's on the buy side... sorry for flipping back and forward from buy to sell side, I just grab the first thing that's printed in ST, whether that be a buy or a sell...

Nope . . . the Print("loss_for_1_lot1 formula: ", . . . . . ) isn't there . . .

DomGilberto:

Who is your broker? Would my tick value have something to do with the fact it is GBP denominated? (confused)

I tried it with GoMarkets, on Alpari on a GBP account I get 0.626 . . . . take this and multiply by GBPUSD and you get 0.626 * 1.5974 = 0.999 so this agrees with my previous value on a USD based account of 1.06908 bearing in mind different Brokers and symbol prices, etc.