Download MetaTrader 5
To add comments, please log in or register
Find out the latest MQL5.community news!
winterz
104
winterz 2014.11.06 11:18 

Hello!

I have a question I'd like to throw out to there on something I am finding rather tricky in resolving.

What I am trying to formulate is a synthetic tick value that is otherwise independent of what is built within MQL4 (being MarketInfo(Symbol(),MODE_TICKVALUE).

Reason being is that sometimes I have noticed the MODE_TICKVALUE returning an incorrect or almost obsolete value. What I am wanting to achieve is the value of what each tick(pipette) is worth based upon the current open position, in the deposit currency.

Below is a simple way of finding out what the tick value is within the term currency (this resides within a for loop - the open order is of course selected through OrderSelect()):

double TermCurr_TV  = ( MarketInfo(OrderSymbol(),MODE_TICKSIZE) / MarketInfo(OrderSymbol(),MODE_BID) ) 
                        *  MarketInfo(OrderSymbol(),MODE_LOTSIZE) * OrderLots();

 In order to translate this term currency tick value into the deposit tick value, we need to take the following above and multiply it with the applicable currency pair (part I am having difficulty with).

AccountCurrency() is captured from within OnInit().

My question from here is, once we have captured (via OrderSelect()) what the currency pair traded is and the term currency TV, how can I best translate what is currently term currency TV, into the deposit currency tick value (formula)?


Any help or guidance will be greatly appreciated.

W

whroeder1
13597
whroeder1 2014.11.06 13:56  
winterz: Reason being is that sometimes I have noticed the MODE_TICKVALUE returning an incorrect or almost obsolete value.
Tell your broker to fix their settings and refuse to trade that pair until they do.
Carl Schreiber
5932
Carl Schreiber 2014.11.06 14:22  

Instead of using Tickvalue directly I think you can calculate it yourself (my Euro-Account) converting AUDCHF (CHF = Base Currency) into Euros:

Comment(AUDCHF ",DoubleToStr(MarketInfo("AUDCHF",MODE_BID),5),
    " TickVal: ",DoubleToStr(MarketInfo("AUDCHF",MODE_TICKVALUE),5),
       " eur ~ ",DoubleToStr(1.0/(MarketInfo("EURCHF",MODE_BID)),5)," => 1/EurChf = 'ChfEur'",

    "\nLotVal: ",DoubleToStr(MarketInfo("AUDCHF",MODE_TICKVALUE)/MarketInfo("AUDCHF",MODE_TICKSIZE),3),
           " ~ ",DoubleToStr((1.0/(MarketInfo("EURCHF",MODE_BID)))/MarketInfo("AUDCHF",MODE_TICKSIZE),3));
winterz
104
winterz 2014.11.06 15:35  
gooly:

Instead of using Tickvalue directly I think you can calculate it yourself (my Euro-Account) converting AUDCHF (CHF = Base Currency) into Euros:




AUD(Base)CHF(Quote) I thought?

Without getting too deep into my reasoning behind it (WHRoader), what would you say in relation to my question. Remember, I am trying to synthetically create tick value without using MarketInfo(NULL,MODE_TICKVALUE)...

Using what I have done already, how can I convert this into the respective denominated tick value, relative to the current open trade (OP_SELL - OP_BUY)

 Thanks for both of your responses. 

 UPDATE:

@ gooly

Comment(AUDCHF ",DoubleToStr(MarketInfo("AUDCHF",MODE_BID),5),
    " TickVal: ",DoubleToStr(MarketInfo("AUDCHF",MODE_TICKVALUE),5),
       " eur ~ ",DoubleToStr(1.0/(MarketInfo("EURCHF",MODE_BID)),5)," => 1/EurChf = 'ChfEur'",

    "\nLotVal: ",DoubleToStr(MarketInfo("AUDCHF",MODE_TICKVALUE)/MarketInfo("AUDCHF",MODE_TICKSIZE),3),
           " ~ ",DoubleToStr((1.0/(MarketInfo("EURCHF",MODE_BID)))/MarketInfo("AUDCHF",MODE_TICKSIZE),3)); // I want a formula to automatically find the correct pair "EURCHF"...
Carl Schreiber
5932
Carl Schreiber 2014.11.06 18:25  

You have to find the formula yourself as it is a) broker-specific, b) symbol-specifict, c) Account-specific, d) intended trade symbol-specific.

But with my example you can find the formula and prove it.

winterz
104
winterz 2014.11.06 19:23  
            market = MarketInfo(OrderSymbol(),MODE_BID);
            baseCurr = SymbolInfoString(OrderSymbol(),SYMBOL_CURRENCY_BASE);

                 double LotUnits = MarketInfo(OrderSymbol(),MODE_LOTSIZE) * OrderLots(); 
                 double CustomTV_termCurrency  = ( pips / market ) * LotUnits; // tick value in the term currency - i.e. not the deposit currency
                     
                 Print("TV in Term Currency: ", CustomTV_termCurrency, " -- Order Symbol Bid: ", market,
                       " -- Order Open on: ", OrderSymbol()," -- Base: ", baseCurr);                
                     
                 if( AccountCurr != baseCurr ){//Not a reliable equality statement
                    double CustomTV_depositCurrency = CustomTV_termCurrency * MarketInfo(baseCurr+AccountCurr,MODE_BID); 
                     Print("AccountCurr != baseCurr -- TV is therefore: ", CustomTV_depositCurrency);}
                     
                  if( AccountCurr == baseCurr ){//if the BASE is AUD then the TV is always correct.
                     double CustomTV_depositCurrency = CustomTV_termCurrency; 
                     Print("AccountCurr == baseCurr -- TV is therefore: ", CustomTV_depositCurrency);} 
I am working with something like this. I am trying to work out formula WITHOUT using MODE_TICKVALUE. Are you saying it is not possible unless I just write a specific code relevant to the pair at hand? 
winterz
104
winterz 2014.11.06 20:05  
Right, let me word this another way, using MODE_TICKVALUE how would I find out what the PIP value was worth based upon the OrderLots()?
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.11.07 00:00  
winterz:
Right, let me word this another way, using MODE_TICKVALUE how would I find out what the PIP value was worth based upon the OrderLots()?
4 digits broker > 0.01 lots * 1 pip = 0.01
whroeder1
13597
whroeder1 2014.11.07 01:39  
winterz: , let me word this another way, using MODE_TICKVALUE how would I find out what the PIP value was worth based upon the OrderLots()?
See PipValuePerLot
/
To add comments, please log in or register