Pesoxx: how can I convert order profit to pips? | pips = profit / PipValuePerLot |
gooly: On most of the USD-accounts 1 pip of a trade with 1 lot has the value of 10,- USD - start from that?
|
What do you do if the account is NOT USD or if the traded pair doesn't end in USD? |
Gooly: Exactly how WHRoeder said, I need something universal.
WHRoeder: Thanks, I'll try it.
Gooly: Exactly how WHRoeder said, I need something universal.
WHRoeder: Thanks, I'll try it.
double PriceToPips(double price) { double pips; if(Symbol()=="SPI200") {pips = price*1; return(NormalizeDouble(pips,1));} if(Symbol()=="DAX30") {pips = price*1; return(NormalizeDouble(pips,1));} if(Symbol()=="S&P") {pips = price*1; return(NormalizeDouble(pips,1));} if(Symbol()=="WTI") {pips = price*10; return(NormalizeDouble(pips,2));} if(Digits == 0) {pips = price*1; return(NormalizeDouble(pips,1));} if(Digits == 1) {pips = price*1; return(NormalizeDouble(pips,1));} if(Digits == 2) {pips = price*10; return(NormalizeDouble(pips,1));} //JPY pairs if(Digits == 3) {pips = price*100; return(NormalizeDouble(pips,1));} if(Digits == 4) {pips = price*10000 ; return(NormalizeDouble(pips,1));} // if(Digits == 5) {pips = price*10000; return(NormalizeDouble(pips,1));} return(0); }
Pesoxx: how can I convert order profit to pips? | pips = profit / PipValuePerLot |
gooly: On most of the USD-accounts 1 pip of a trade with 1 lot has the value of 10,- USD - start from that? | What do you do if the account is NOT USD or if the traded pair doesn't end in USD? |
- Pesoxx: how can I convert order profit to pips?If you're not trading Forex, the question makes no sense.
- When a broker goes to 1/100 PIP. I'll go with pip2dbl= StringFind("JPY", _symbol) < 0 ? 0.0001 : 0.01;
- Pesoxx: how can I convert order profit to pips?If you're not trading Forex, the question makes no sense.
- When a broker goes to 1/100 PIP. I'll go with pip2dbl= StringFind("JPY", _symbol) < 0 ? 0.0001 : 0.01;
It does make sense and it is required if for example you want to trade non-symbols that the brokers offers with an EA that has been developed on various forex symbols.
The brokers do offer more and more non forex-symbols like bonds, commodities, index-shares, even single shares - do we have to ignore them, because they are not 'forex' and we have an meaningless definition for a pip?
On the other hand we can easily renew the definition of a pip as the nearest value to (USD-account) 10-USD for a 1-lot order - the same you get for pure forex symbols.
Due to this definition it doesn't matter which symbol you are trading or how many digits a symbol has, a Stop of 10 pips will always risk ~100 USD of a 1 lot order.
If your account currency is not USD, you can change the the reference value (refValue) but e.g. for EUR you'll get the same 'pip-size' but in EUR 1 pip is now ~8,62 EUR - even in your calculation WHRoeder
Of course for an JPY-Account 10 might not be the correct refValue.
It does make sense and it is required if for example you want to trade non-symbols that the brokers offers with an EA that has been developed on various forex symbols.
The brokers do offer more and more non forex-symbols like bonds, commodities, index-shares, even single shares - do we have to ignore them, because they are not 'forex' and we have an meaningless definition for a pip?
On the other hand we can easily renew the definition of a pip as the nearest value to (USD-account) 10-USD for a 1-lot order - the same you get for pure forex symbols.
Due to this definition it doesn't matter which symbol you are trading or how many digits a symbol has, a Stop of 10 pips will always risk ~100 USD of a 1 lot order.
If your account currency is not USD, you can change the the reference value (refValue) but e.g. for EUR you'll get the same 'pip-size' but in EUR 1 pip is now ~8,62 EUR - even in your calculation WHRoeder
Of course for an JPY-Account 10 might not be the correct refValue.
If you are using "foreign" code or coding for others, you can NEVER rely on a "definition" of a pip. Even with Forex it's not always clear for everyone, though it's simple, but with all other symbols you have to agree on a definition before doing anything else.
If you code for yourself, it doesn't matter apply any definition which is better for you.
If you are using "foreign" code or coding for others, you can NEVER rely on a "definition" of a pip. Even with Forex it's not always clear for everyone, though it's simple, but with all other symbols you have to agree on a definition before doing anything else.
If you code for yourself, it doesn't matter apply any definition which is better for you.
Well the expression pip is widely used and due to the symbol expansion of the brokers in the recent years (if I am correct the original forex symbols has become a 'minority' with some brokers!) the original understanding of a pip has become in such a context rather absurd. So to be able to continue to talk about stops and targets measured in pips one has to find a new definition the covers all that new 'stuff' including the original definition.
Otherwise you are trapped in a way that you have to define singleton pips per broker and symbol and may by per account-currency. (I hate this idea, as this is so error-prone due to the manual input.)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
how can I convert order profit to pips?
Asuming I know lotsize etc.
I want to create trailing stop, but profit oriented.
Thanks.