Problem solved.
Actually, PRT seems to make a distinction between :
– PipSize, which is the “point” as per contract specification
– TickSize, which is the minimal increment in price.
In the case of EUR/USD and BTC/USD with IG Markets, PipSize = 10 * TickSize.
Nicolas
Problem solved ?
1st attachment is PRT-IB. 2nd is PRT-IG.
@PeterSt, what is the issue?
Hi,
I am lost. How to calcuate then the size of your position with all these pipsize etc… ?
For stock market, easy
myPositionSize = ((myInitialCapital + STRATEGYPROFIT) *(myRisk/100))/(myStopFactor*myATR))
But for the forex ? e.g. EUS/USD, what would be the formula of myPositionSize including these variables ?
once myTickSize=0.00001
once myPipSize=PIPSIZE
once myPipValue= PIPVALUE
once myLotSize=1000 (1000 ??? mentioned by default in probacktests)
Thank you
PIPSIZE should be used when you need to deal with both PRICE and PIPS in the same expression. It relieves you of having do do conversions yourself, as the system will take care of it.
IF you want to exit at, say 20 pips less than current LOW, you will have to convert 20 (which is a numeric value) to a price, writing:
SELL AT Low - 20*PipSize STOP //or LIMIT
because writing:
SELL AT Low - 20 STOP //or LIMIT
would work for all instruments and assets with a price to pip ratio of 1:1, like indeces, but would fail for currencies (it would subract 20 from 1.01 on fx pair EurUsd).
It should also be used with a division when you have to convert a price into pips:
StopLossPIPS = (close - low) / PipSize //in EurUsd this will return 40, instead of 0.0040
This code works fine with DAX (Daily chart), without using PIPSIZE; you cannot trade the sime size of CONTRACTS as you do with SHARES, though:
DefParam CumulateOrders = False
ONCE P = 100
ONCE minLots = 1
ONCE myInitialCapital = 10000
ONCE myRisk = 5
ONCE myStopFactor = 1 //what is this ???
myATR = averagetruerange[14](close)
myPositionSize = max(minLots,((myInitialCapital + STRATEGYPROFIT) *(myRisk/100))/(myStopFactor*myATR))
IF Not OnMarket THEN
IF close CROSSES OVER average[P,0](close) THEN
BUY myPositionSize CONTRACTS AT MARKET
ELSIF close CROSSES UNDER average[P,0](close) THEN
SELLSHORT myPositionSize CONTRACTS AT MARKET
ENDIF
ENDIF
SET TARGET pPROFIT 500
SET STOP pLOSS 200
graph myPositionSize
Thanks a lot Roberto I think this is what I am looking for.
So I assume that for currencies, I would just need to add /PIPSIZE at the end to get the right position size.
myPositionSize = max(minLots,((myInitialCapital + STRATEGYPROFIT) *(myRisk/100))/(myStopFactor*myATR)/PIPSIZE)
Thank you Roberto.
Could you please explain me what is this LotSize in yellow (see attached)? is that 1000 for EUR/USD ?
Should not we consider that LotSize in the formula ?
myPositionSize = max(minLots,( (myInitialCapital + STRATEGYPROFIT) *(myRisk/100))/(myStopFactor*myATR)/PIPSIZE/LotSize)
or am I completely wrong ? 🙂
I don’t know, as I never used it.
It’s not requested by IG (for CFDs), it is requested by PRT (Futures), instead.
I have no idea what’s it all about.
OK Thank you Roberto
BTW I have made some simulations, I think PIPSIZE should be placed here to get the right position size
myPositionSize = PIPSIZE * (myInitialCapital + STRATEGYPROFIT) *(myRisk/100)/(myStopFactor*myATR)
Multiplying by PipSize is used to convert Pips into Price.
I can’t spot any value expressed in pips in your code, though.
If i take a risk of 50 eur
With a stop at 5 pips
The initial formula gives
Positionsize = 50/0.0005 = 100 000
If the. i do BUY 100 000 he will buy 100 000 K so 100 000 000.
So i thought to come back to an “acceptable” position size i needed to divide multiply by pipsize which is 0.0001
Is it a mistake ?
Again :
If i take a risk of 50 eur
With a stop at 5 pips
The initial formula gives
Positionsize = 50/0.0005 = 100 000
Then BUY 100 000 would buy 100 000 K so 100 000 000…
So i thought to come back to an “acceptable” position size i needed to multiply by pipsize which is 0.0001
Is it a mistake ?
PipSize is NOT meant to make thing “acceptable” of “most favourable” or the like. It’s meant to convert Pips into Price and viceversa.
Anyway, if your formula yields what you expect, then it must be ok!
😀
Sorry, you know I am french and my English is…frenchy
I meant “Consistent” instead of “acceptable” 😀
i.e. the losses are indeed 50 Eur in backtests so consistent withe the risk I defined initially.
I just hope this formula is then applicable to any forex pair.
Thank you Roberto for all your support.