I have found that tickvalue is wrong in some instruments in some brokers:
27278115 | 2014.06.06 12:50:10 | buy | 0.01 | 1253.85 | 0.00 | 1254.85 | 2014.06.06 15:20:53 | 1254.85 | 0.00 | 0.00 | 0.00 | 1.00 |
Lots 0.01
Ticks 100
Profit 1
Do the maths:
1/100/0.01=1
Therefore real
MarketInfo(Symbol(),MODE_TICKVALUE) is 1
But the system gives
MarketInfo(Symbol(),MODE_TICKVALUE)=0.01
So it is wrong.
- Don't use NormalizeDouble
- Normalize LotsSize and check the limits
- Do not use TICKVALUE by itself.
- What are Function return values ? How do I use them ? - MQL4 forum
Thanks everyone for your inputs.
I am getting 4107 errors (invalid price) and 131 (Invalid trade volume).
My little brain can't understand how it's invalid price...? Trade volume; well, we already knew that lol :P - Maths was never my strong point!
I've tested price and it seems fine?
2014.06.12 21:28:42.397 2009.05.11 04:00 TF-index UK100,H1: buyPrice is: 4524
(EDIT)
Ok, it's because I was trying to exceed max lots as I put too many 000's on the size of the starting balance lol.
It is pushing trades out but I am still receiving error 4107?
2014.06.12 21:34:46.946 2008.11.24 10:00 TF-index UK100,H1: First Sell Order FAILED: 4107 On: UK100 2014.06.12 21:34:46.946 2008.11.24 10:00 TF-index UK100,H1: OrderSend error 4107 2014.06.12 21:34:46.946 2008.11.24 10:00 TF-index UK100,H1: invalid takeprofit for OrderSend function 2014.06.12 21:34:46.946 2008.11.24 10:00 TF-index UK100,H1: LotSize_Sell is: 5.4 2014.06.12 21:34:46.946 2008.11.24 10:00 TF-index UK100,H1: sellPrice is: 3706
Ok I think i have sorted it.
My takeprofit was a multiple of the distance from Entry - Stop price... this multiple was set to 20x which in short positions equated to something less than 0!
So all errors are now gone and it works!
Thanks for everyones input none the less :) - it definitely provoked me to put some logic into what I am doing!
Hi, could you please tell me how did you manage to get the position size to work on all instruments ?
Or how you made it work on indices ?
Thank you!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Here is what I am using (see below).
Now keep in mind this works on metals and FX markets...? During back testing these are the parameters:
Anyone help me adjust where I am going wrong? I am trying to back-test my strategy on FTSE (UK100 - FXCM) but position size calculation is evidently wrong but I cannot figure it out?