SYMBOL_TRADE_TICK_VALUE_LOSS vs SYMBOL_TRADE_TICK_VALUE_PROFIT - page 3

 
Alain Verleyen #:

I already provide these data in the topic, not ?


Sorry, I mean ticks for the whole second duration (+/-1 sec) around the time the position was closed. because I suspect the terminal has some synchronization (timing) issues. 

 
amrali #:

Sorry, I mean ticks for the whole second duration (+/-1 sec) around the time the position was closed. because I suspect the terminal has some synchronization (timing) issues. 

I already posted it. You want more ?

Forum on trading, automated trading systems and testing trading strategies

SYMBOL_TRADE_TICK_VALUE_LOSS vs SYMBOL_TRADE_TICK_VALUE_PROFIT

Alain Verleyen, 2023.02.21 20:54

No. Please check the link to the original post to get all information ;-)

The bid and ask were known and the bid was 1.44725. I checked the history, this trade was close exactly at 2022.08.28 23:05:00.871 and at that time here are the ticks :


The loss is clearly calculated using 1/Ask, not 1/Bid.


 
Alain Verleyen #:

I already posted it. You want more ?


There is no tick before that because it was a Sunday.
 
Alain Verleyen #:

I already posted it. You want more ?


This is really frustrating Alain, not gonna lie, I'm still trying to figure out what is happening in this example and I don't understand why it would use the ask to convert the loss, this make no sense... I'm still trying to understand though...

 

Wait few minutes. I am posting the results of the test I ran it.

See it and then decide.

 
Jeepack #:

This is really frustrating Alain, not gonna lie, I'm still trying to figure out what is happening in this example and I don't understand why it would use the ask to convert the loss, this make no sense... I'm still trying to understand though...

Yeah...I can't figure it out either.

 

Forum on trading, automated trading systems and testing trading strategies

Serious bug in the OrderCalcProfit() function

amrali, 2023.02.21 23:35

Ok, this is a proof based on numbers from the terminal (not theories).

I ran the test on two different terminal, one with an account currency = EUR, the other's account currency is USD.

First I use a script, to open positions on all forex symbols on the market watch using a large position size as possible. I increased the demo balance to the maximum 100K to do the tests.

Then, I used a second script "2. AnalyzePositionProfits_Script.mq5" to analyze profits of all open positions, using these methods:

  • POSITION_PROFIT field
  • OrderCalcProfit() function
  • SYMBOL_TRADE_TICK_VALUE_xxxx
  • Conversions from profit currency -> account currency

The script outputs the results to csv file. I always use Ron's CSV editor to read csv files. https://www.ronsplace.ca/Products/RonsEditor/Download

Here is the result from the EUR account:


Here is the result from the USD account:


As can be seen  POSITION_PROFIT is sometimes (but not always) equal to profit calculation using  OrderCalcProfit(). The reason for this may be a timing (sync) issue between the ticks on the server used to calculate the POSITION_PROFIT  field and the later ticks reaching the terminal. So, my conclusion is that the value of the POSITION_PROFIT field is calculated on the server, independent of the quote data arriving to the terminal in that exact moment.

All the other methods are matching my previous calculations:



  1. SYMBOL_TRADE_TICK_VALUE_LOSS  is used to calculate profit of BUY orders.
  2. SYMBOL_TRADE_TICK_VALUE_PROFIT  is used to calculate profit of SELL orders.
  3. No correlation between the TICK_VALUE_xxxx names (PROFIT/LOSS) and the price type (BID/ASK) of profit/account currency conversion rate.
  4. The price type (BID/ASK) of the profit/account conversion pair depends to two things: (a) the type of the order (b) position of account currency in the pair (first or second).
  5. It was better if the names were SYMBOL_TRADE_TICK_VALUE_BUY (for SYMBOL_TRADE_TICK_VALUE_LOSS) and SYMBOL_TRADE_TICK_VALUE_SELL (for SYMBOL_TRADE_TICK_VALUE_PROFIT)

 
Alain Verleyen #:

Yeah...I can't figure it out either.

Maybe they convert the AUD loss to GBP first and then they convert from GBP to EUR... I'm not sure but I read something like that once, I'm going to try to read something on this topic tonight to double check

Trading Cross Currency Pairs
Trading Cross Currency Pairs
  • 2009.12.07
  • ttbisco
  • forums.babypips.com
My trading account is in USD, so say I want to go short GBP/JPY. Wouldn’t I have to first go short USD and long GBP? And if so, wouldn’t it be like I was in two trades at once and wouldn’t I be affected by changes in both GBP/USD and GBP/JPY?
 
Jeepack #:

This is really frustrating Alain, not gonna lie, I'm still trying to figure out what is happening in this example and I don't understand why it would use the ask to convert the loss, this make no sense... I'm still trying to understand though...

I am also having no explanation for your trade @Alain Verleyen. I told you before it is contradictory to my previous tests.

 
amrali #:

I am also having no explanation for your trade @Alain Verleyen. I told you before it is contradictory to my previous tests.

I will check your results and investigate further on my side.

Will post my feedback...not sure when though.