# SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE) sometimes zero - page 2

You are missing trading opportunities:

- Free trading apps
- Free Forex VPS for 24 hours
- Over 8,000 signals for copying
- Economic news for exploring financial markets

Registration
Log in

You agree to website policy and terms of use

If you do not have an account, please register

Tick Valuedirectly, consider using the function OrderCalcProfit, because it will apply the correct profit calculation method depending on the CALC_MODE for that symbol.Fernando Carreiro #:Instead of using the

Tick Valuedirectly, consider using the function OrderCalcProfit instead, because it will apply the correct profit calculation method depending on the CALC_MODE for that symbol.In my case SYMBOL_CALC_MODE_CFD

Thanks for your answer, I will try to replace my code with OrderCalcProfit()

I was using Tick Value to calculate a lot size, so I cannot provide a lot size to OrderCalcProfit()

I will try to rewrite my code other way, thanks

Philippe Pauleau #:In my case SYMBOL_CALC_MODE_CFD. Thanks for your answer, I will try to replace my code with OrderCalcProfit() I was using Tick Value to calculate a lot size, so I cannot provide a lot size to OrderCalcProfit().I will try to rewrite my code other way, thanksYou can! These are the steps I take. I supply the function with a lot size equal to the “Max Lot Size” allowed for the symbol in question, then calculate the ratio needed to achieve the fractional risk that I wish to apply, to get the correct volume for the order. I then align that with the “Lot Step” and finally check it against both the maximum and minimum allowed lots for the symbol.

The reason I use the “maximum” lots instead of just “1.0” lots as a reference value is because there is no guarantee that the value of 1.0 is within the minimum and maximum values allowed. Given that using 1.0, or the maximum, gives equivalent results anyway (by using the ratio method), I choose to use the “max lots” as the reference point which also offers the most precision for the calculation.

Something like this ...

Fernando Carreiro #:You can! These are the steps I take. I supply the function with a lot size equal to the “Max Lot Size” allowed for the symbol in question, then calculate the ratio needed to achieve the fractional risk that I wish to apply, to get the correct volume for the order. I then align that with the “Lot Step” and finally check it against both the maximum and minimum allowed lots for the symbol.

The reason I use the “maximum” lots instead of just “1.0” lots as a reference value is because there is no guarantee that the value of 1.0 is within the minimum and maximum values allowed. Given that using 1.0, or the maximum, gives equivalent results anyway (by using the ratio method), I choose to use the “max lots” as the reference point which also offers the most precision for the calculation.

Something like this ...

Thanks, I was thinking about using 1.0 lots but your idea makes sense.

PS: In fact my broker is returning a wrong TickValue on real account MT5 servers for DowJones symbol, whereas under the sames conditions the TickValue is good using their demo servers. So my EA works fine on demo servers only for now :)

In fact the TickValue returned by real account servers is 10 times less than what it should be (and the official value that is shown on their website for the symbol)

When I report the issue, they say they are aware but reluctant to fix it as this change would screw up the behavior of thousands of existing EAs that are already working with this setting.

Philippe Pauleau #:Thanks, I was thinking about using 1.0 lots but your idea makes sense. PS: In fact my broker is returning a wrong TickValue on real account MT5 servers for DowJones symbol, whereas under the sames conditions the TickValue is good using their demo servers. So my EA works fine on demo servers only for now :) In fact the TickValue returned by real account servers is 10 times less than what it should be (and the official value that is shown on their website for the symbol). When I report the issue, they say they are aware but reluctant to fix it as this change would screw up the behavior of thousands of existing EAs that are already working with this setting.That does not seem like a very smart thing for a broker to say! That is like a car manufacture saying that they are NOT going to fix a problem in the gear shift because everyone is already used to shifting from 1st to 3rd, without using 2nd.

I suggest changing your broker.

Fernando Carreiro #:You can! These are the steps I take. I supply the function with a lot size equal to the “Max Lot Size” allowed for the symbol in question, then calculate the ratio needed to achieve the fractional risk that I wish to apply, to get the correct volume for the order. I then align that with the “Lot Step” and finally check it against both the maximum and minimum allowed lots for the symbol.

The reason I use the “maximum” lots instead of just “1.0” lots as a reference value is because there is no guarantee that the value of 1.0 is within the minimum and maximum values allowed. Given that using 1.0, or the maximum, gives equivalent results anyway (by using the ratio method), I choose to use the “max lots” as the reference point which also offers the most precision for the calculation.

Something like this ...

Hi Fernando,

brilliant. I'm very happy about the resumed thread.

I've done a rework of my code and I use that cool onboard function

`OrderCalcProfit`

now.

Thank you very much.

Lukas

lukas #:Hi Fernando, brilliant. I'm very happy about the resumed thread. I've done a rework of my code and I use that cool onboard function now. Thank you very much. LukasHi guys,

after some weeks of testing, it seems the Function OrderCalcProfit has the problem (CAD

), too: It returns a zero value:JPYAs you see, the target variable

is empty (0.0) after first try. One hour later, after bot's second try, it's magically filled.

The function OrderCalcProfit doesn't return an error nor _LastError is set.

So I guess I have too code a little loop, until

`OrderCalcProfit`

returns a value.

What do you think?

regards,

Lukas

lukas #:Hi guys, after some weeks of testing, it seems the Function OrderCalcProfit has the problem (CAD), too: It returns a zero value: As you see, the target variable is empty (0.0) after first try. One hour later, after bot's second try, it's magically filled. The function OrderCalcProfit doesn't return an error nor _LastError is set. So I guess I have too code a little loop, until returns a value. What do you think?JPY@lukas, It seems you are using the function while your EA is running on a chart that is not CADJPY. And if so, you are forgetting to synchronise the data first. That is why you are getting zero on the first try.

Please read the following section so as to better understand the need to update and synchronise your symbols data ...

Fernando Carreiro #:@lukas, It seems you are using the function while your EA is running on a chart that is not CADJPY. And if so, you are forgetting to synchronise the data first. That is why you are getting zero on the first try.

Please read the following section so as to better understand the need to update and synchronise your symbols data ...

Hi Fernando, thanks for your help.

The EA does really run on chart CADJPY.

I've found a little test to check sync status in an other thread:

I've insert it into my EA and looking forward for next trade log.

But I don't understand, when synchronisation _is really_ necessary. Is it just for history series in SeriesInfoInteger?

In my thinking a manual sync shouldn't be necessary for other functions like OrderCalcProfit? Not sure hm.

Sometimes I see some auto messages "has been syncronized" in terminal log.

regards,

Lukas