Calculating PIP value in comparison to Symbol.PipValue
Calculating PIP value in comparison to Symbol.PipValue
21 Mar 2023, 17:20
I'm trying to learn and understand how the Symbol class calculates the PIP value.
When I output for example `Symbol.PipValue`, I get 9.4558176918349015E-05, and to my limited knowledge, PIP value can be calculated with
Symbol.PipSize * Symbol.LotSize / Symbol.Ask;
or I'm guessing Symbol.Bid; depending whether you want to buy or sell. I'm not sure what value cTrader uses. I don't get the same values. Mine outputs around 9.3543619389721417 which is off by around 0.1. I'm thinking my formula isn't 100% correct, any ideas how cTrader's Symbol class calculates Symbol.PipValue?
What price for example does it use, ask or bid, or an average of these two perhaps?
The docs also state that the PipValue is only calculated once your cBot starts, I'm looking for a way to recalculate this value as the price changes.
Replies
josef.van.niekerk
27 Mar 2023, 20:54
It seems what the documentation states about the value being calculated at bot startup still holds true, despite the version. I'm using 4.6.4. I did another check today using the BabyPips Pip Value Calculator
Doing the calculations for EURUSD at an asking price of 1.14155, the pip value I get is 8.760019 EUR.
Symbol.PipSize / Symbol.Ask * Symbol.LotSize = 8.7600192720423991
Still, cTrader (4.6.4) reports a Pip Value of 9.37980. I doubt that it is calculating this value on each tick/bar. Definitely seems to still be using the same value as when the Bot was started. I find it strange that it would do that in the first place, it's not a super expensive calculation to update.
@josef.van.niekerk
firemyst
28 Mar 2023, 03:33
( Updated at: 21 Dec 2023, 09:23 )
RE:
josef.van.niekerk said:
It seems what the documentation states about the value being calculated at bot startup still holds true, despite the version. I'm using 4.6.4. I did another check today using the BabyPips Pip Value Calculator
Doing the calculations for EURUSD at an asking price of 1.14155, the pip value I get is 8.760019 EUR.
Symbol.PipSize / Symbol.Ask * Symbol.LotSize = 8.7600192720423991
Still, cTrader (4.6.4) reports a Pip Value of 9.37980. I doubt that it is calculating this value on each tick/bar. Definitely seems to still be using the same value as when the Bot was started. I find it strange that it would do that in the first place, it's not a super expensive calculation to update.
Just for kicks, have you tried getting the symbol.PipValue on each tick and each bar for comparison purposes and output to the log?
Eg, Symbol s = Symbol.PipValue
?
@firemyst
PanagiotisChar
22 Mar 2023, 10:16 ( Updated at: 21 Dec 2023, 09:23 )
Hi there,
If this is the problem you are trying to solve, then it is solved in 4.6
Aieden Technologies
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar