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
...
Valery, tell me what this code section in calc.mq5 means:
That is, why is the xxx variable assigned fixed values?
---
And another question. The help contains incomplete information on profit calculation for Forex, isn't it? It means that only the formula for the reverse quotes(XXXUSD) is given to calculate the profit.
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
And another question. It turns out that the help is incomplete with information about profit calculation for Forex? It means that the formula for profit calculation is only presented for inverse quotes(XXXUSD).
Yes, you seem to be right. For now you can read about profit calculation in the article "The ABCs of Currency Trading".
Thank you. This article should definitely be bookmarked as a cheat sheet, because I can't keep everything in my head. Better yet, if the table is added to the help, so that everything is centralized. :)
---
And fixed values (on a fresh head it is necessary to look :) ) so I have understood for a case if there was no data. But these values should be corrected all the time, depending on exchange rates. That's why it's better to output the message, that there is no data, instead of wrong values.
Yes, you're absolutely right. I did as the author did, I was too lazy, I didn't have time... For cross rates in MT4 you have to explicitly select in the 'Market Watch' window the symbols for both currencies expressed in USD, i.e. For example, for NZDJPY you have to select USDJPY and NZDUSD. The author has a disclaimer on this point in the preamble:
"For XXXYYY crosses the corresponding
USDYYY or XXXUSD major pairs (for example for GPBJPY in market review window should be open
USDJPY must be open)."
In MT5 it is better to leave this to the indicator itself.
Piligrim:
Valery (Valmars), do you think it makes sense in terms of complexity of repackaging to offer you to re-do this indicator in MQL5 as well? The previous one, translated by you, works very well!
You cannot modify this indicator for MT5, because MT5 has no (and will never have) standalone charts. How does the indicator work in MT4? It creates a stand-alone chart with a non-standard period, with the coming of a new quote it saves it in the .hst file of this non-standard period. And then you open this chart. On every tick, the indicator updates (redraws) it with the help of the indicator dll. As a result you see a chart with a non-standard period updated in real time.
In MT5 even the format of files PERIOD.hc (on which charts for the standard periods are built) hasn't been opened by developers, probably, because they can't build "left-handed" charts. You can see the controversy about graphs with an arbitrary period here.
Yes, you're absolutely right. I did as the author did, I was too lazy, I didn't have time... For cross rates in MT4 you have to explicitly select in the 'Market Watch' window the symbols for both currencies expressed in USD, i.e. For example, for NZDJPY you have to select USDJPY and NZDUSD. The author has a disclaimer about this in the preamble:
"For XXXYYY crosses, the corresponding
major pairs USDYYY or XXXUSD (for example for GPBJPY in Market Watch window must
be open USDJPY)".
In MT5 it is better to leave this to the indicator itself.
So, instead of that list with fixed values this code would do? :
This indicator cannot be converted to MT5, as MT5 does not (and will not) have autonomous charts. How does the indicator work in MT4? It creates a stand-alone chart with a non-standard period, with the coming of a new quote it saves it in the .hst file of this non-standard period. And then you open this chart. On every tick, the indicator updates (redraws) it with the help of the indicator dll. As a result, you will see a chart with a non-standard period updated in real time.
In MT5 even the format of PERIOD.hc files (charts for standard periods are built using) was not even disclosed by developers, probably because they don't allow making any "left-handed" charts. You can see the controversy about graphs with an arbitrary period here.
In any case thanks, Valery! For me, as a non-programmer, an understandable professional consultation is much more preferable in terms of finding possible solutions to some problem beyond my competence.
So, instead of that fixed-value list, this code would work fine? :
Yes, just execute it for the second character of the cross as well and put it in the inite.
Yes, just do this for the second cross character as well and put it in the inite.
Valery, if you have a spare moment, take a look at the revised version. Is it done correctly now with everything discussed above in mind? Thank you.
...