You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I can't wait for OrderCalcMargin() function to work properly for CFD, futures, indices, etc. Can someone share formulas to correctly calculate the margin for these instruments?
And I've probably brought the whole thing up, I can't think of any other reason...
I will try to describe the situation in more detail.
There is a simple class "CMqlTimer", the task of this class is to track the moment of change of different time intervals: hour, day, week, month, year.
Everything is realized with very simple primitive, for example, if minutes equal 0 then "new hour" has come; if number of day of week doesn't correspond to stored in variable then day alternation ("00:00:00" by server time) has come. So on.
The analysis is performed when the timer is triggered, with an interval of 1 second, the work is done in CMqlTimer::OnTimer(). If the time interval changes, the function must be executed. For example if it is a "new" day the function CMqlTimer::OnRolloverDay() should be executed.
If we remove the rest of the code and write only OnRolloverDay(), the result will be the following:
All user events are tracked and passed for handling to the main class
It looks something like this
So, the events don't reach OnChartEvent in testing mode, i.e. the Expert Advisor cannot handle an event sent using EventChartCustom in testing mode. Checked it by displaying all events in the log.
PS
The most interesting thing is that all events get on the demo, but in the tester, it refuses to work.
Prior to 319 all worked and in the tester, events are successfully handled. True the last release where it worked I can't say...
Thank you. We'll have to think about it.
Isn't it in the help? It seems to be...
I definitely have, what I don't understand is the following variables in the formulas, highlighted in red
Identifier
Description
Formula
SYMBOL_CALC_MODE_FOREX
Forex mode - profit and margin calculation for Forex
Margin: Lots*Contract_Size/Leverage
Profit: (close_price-open_price)*Contract_Size*Lots
SYMBOL_CALC_MODE_FUTURES
Futures mode - calculate margin and profit for futures
Margin: Lots *InitialMargin*Percentage/100
Profit: (close_price-open_price)*TickPrice/TickSize*Lots
SYMBOL_CALC_MODE_CFD
CFD mode - calculation of margin and profit for CFD
Margin: Lots *ContractSize*MarketPrice*Percentage/100
Profit: (close_price-open_price)*Contract_Size*Lots
SYMBOL_CALC_MODE_CFDINDEX
CFD index mode - calculation of margin and profit for CFD indexes
Margin: (Lots*ContractSize*MarketPrice)*TickPrice/TickSize
Profit: (close_price-open_price)*Contract_Size*Lots
SYMBOL_CALC_MODE_CFDLEVERAGE
CFD Leverage mode - calculation of margin and profit for CFD when trading with leverage
Margin: (Lots*ContractSize*MarketPrice*Percentage)/Leverage
Profit: (close_price-open_price)*Contract_Size*Lots
May I ask how things are progressing in this direction? I really need the events in the tester to work properly...
At your request, the application has been formed - it will not be lost!
At your request, the application has been formed - it will not be lost!
Bug - it used to work, but now it doesn't.
Bug - it used to work, but now it doesn't.
It works for me.
Here's the result:
2010.09.08 20:15:12 Draft1_1 (EURUSD,M15) 2010.09.10 19:15:04
2010.09.08 20:15:12 Draft1_1 (EURUSD,M15) 2010.09.10 19:15:04
Bug - it used to work, but now it doesn't.
2010.09.08 21:09:13 00 (EURUSD,M1) 2010.09.08 12:32:25
2010.09.08 21:09:13 00 (EURUSD,M1) 2010.09.10 19:09:13
I don't, it doesn't work. the numbers are different. build 324. Win7 64bit.
Prival:
2010.09.08 21:09:13 00 (EURUSD,M1) 2010.09.08 12:32:25
2010.09.08 21:09:13 00 (EURUSD,M1) 2010.09.10 19:09:13
I have this:
2010.09.08 21:18:04 PrivalTest (EURUSD,H1) 2010.09.10 19:18:15
2010.09.08 21:18:04 PrivalTest (EURUSD,H1) 2010.09.10 19:18:15
Minutes:
2010.09.08 21:30:15 PrivalTest (EURUSD,M1) 2010.09.10 19:30:24
2010.09.08 21:30:15 PrivalTest (EURUSD,M1) 2010.09.10 19:30:24
Win XP.