Home › Forums › Tickstory Lite › General Discussion › Custom lot calculation vs AccountFreeMarginCheck()
-
AuthorPosts
-
Hi Kentzversky,
The only setting that Tickstory embeds with regard to Free Margin is the ‘Free Margin Mode’ where the setting can be:
Dont Use = 0
Use All = 1
Use Profit = 2
Use Loss = 3All that I can suggest is that you ensure this matches your broker. It may also be worthwhile referring to the MT4 forums as they may be better placed to assist. See http://forum.mql4.com/67106 for example.
Hope this helps.
Thank’s for reply tickstory!
How do Tickstory obtain this values? I didn’t find any straight analogs in mql4
MarketInfo():
MODE_PROFITCALCMODE: Profit calculation mode. 0 – Forex; 1 – CFD; 2 – Futures
MODE_MARGINCALCMODE: Margin calculation mode. 0 – Forex; 1 – CFD; 2 – Futures; 3 – CFD for indices
are not coresponding to your’s;
Dont Use = 0
Use All = 1
Use Profit = 2
Use Loss = 3If the is no analog – can you explain calculation method of each position.
Thank’s!Hi Kentzversky,
The ‘Free margin mode’ can be set in the ‘Metatrader Info’ tab when exporting to MT4. The setting is just to the right of the ‘Leverage’ setting.
The other two settings you mention – profit calc mode & margin calc mode – can also be set on this screen in the ‘Symbol Settings’ section.Hope this helps.
Thanks you kindly, I know where to enter this settings but..
the question was:
How do Tickstory obtain this values for ‘Free Margin Mode’?As this values are obtained via tickstory script, so its done by some mql4 commands.
Can you provide us with the line of code with this calculations. Seems there is a error for my provider so i cant find out where.I’ve got closer to the problem:
MarketInfo(Symbol(),MODE_MARGINREQUIRED) returns different results:from tester on REAL account (EURUSD Balance $100):
221.61
from tester on SAME account with tickstory data (EURUSD Balance $100):
200
(like if i had initial deposit in EUR)Hi Kentzversky,
Tickstory performs no calculations on margin – it simply exports broker stated values and MT4 does the rest. In the case of ‘Free Margin Mode’, it acquires this information from the MQL command AccountFreeMarginMode() (see http://docs.mql4.com/account/accountfreemarginmode).
I’m not sure if you can find some help in the discussion here: http://forum.mql4.com/5911 although this relates to an older MT4 build.
Regards.
Ok, I’m getting closer to solution.
A like problem was described here:
http://www.tickstory.com/forum/viewtopic.php?f=4&t=275:
The MT4 tester, following the hack by your program, issues a wrong number in response to the query MarketInfo(EURUSD, MODE_MARGINREQUIRED)). For EURUSD, the lot price (100000 EUR) should depend on the Euro’s current price (136000 as of now) while with Tickstory, MT4 issues 100000.
Above is true:
0 18:55:06 2015.04.01 00:00 lotcalculations EURUSD,M1: --- --- AccountCurrency: USD
0 18:55:06 2015.04.01 00:00 lotcalculations EURUSD,M1: --- --- Symbol: EURUSD
0 18:55:06 2015.04.01 00:00 lotcalculations EURUSD,M1: --- --- AccountLeverage: 500.00000000
0 18:55:06 2015.04.01 00:00 lotcalculations EURUSD,M1: --- --- AccountBalance: 100.00000000
0 18:55:06 2015.04.01 00:00 lotcalculations EURUSD,M1: --- --- MODE_MARGINREQUIRED: 200Should be:
0 18:58:02 2015.04.01 00:00 lotcalculations EURUSD,M1: --- --- MODE_MARGINREQUIRED: 214.99I found a possible workaround:
-we want to trade EURUSD,
-we have account currency: USD
-Tools>Export to MT4>Metatrader Info: “Margin ccy:” field is set to USD by default (or by TS script), butif you change “Margin ccy:” field to EUR (for AUDUSD to AUD aso) you will get results pretty close to real.
Notable that formerly this field was called “Currency:” and depicted account currency.
So what exactly “Margin ccy:” means?
Hi Kentzversky,
‘Margin Currency’ is a separate field used by the MT4 export (FXT) file. It essentially the base currency of the instrument and yes, you are correct – it should be EUR in the case of EURUSD (i.e. the base currency). In the case of non-FOREX instruments (such as GOLD), it should be USD.
This issue has already been addressed in the next major version of Tickstory and we will also put a note to change the TickstoryExpert file so it correctly sets this value. Thanks for taking the time to detail your issue.
Regards.
-
AuthorPosts
You must be logged in to reply to this topic.