[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 28

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
Where is the "wrong parameters count" error here?
Good afternoon! Thank you, sir, for asking the question. Glad to be of service.
We bow at the waist and respond intelligently:
You are obviously missing a parameter in iMA:
Most likely, the parameter is missing:
ma_shift - Shift of indicator relative to the price chart.
Looking forward to your further questions!
I need your help.
This expression needs to be translated
into number of points and calculate profit or stop for each position depending on lot. And finally print the total amount in % of profit or stopI need your help.
I need to translate this expression
to the number of items ......First select the desired item.
( OrderOpenPrice() - OrderClosePrice() ) /Point - this will be the profit/loss of the selected position in pips
---------------
Actually, for your calculations, it's better to use appropriate functions of I. Kim. And the task will become several times easier.
https://www.mql5.com/ru/forum/131859
https://www.mql5.com/ru/forum/131859/page3#434225
First select the correct position.
( OrderOpenPrice() - OrderClosePrice() ) * Point - this will be profit/loss of the selected position in points
---------------
Actually, for your calculations, it's better to use appropriate functions of I. Kim. And the task will become several times easier.
https://www.mql5.com/ru/forum/131859
https://www.mql5.com/ru/forum/131859/page3#434225
Thank you. But I didn't find what I need in his function. And in this case ( OrderOpenPrice() - OrderClosePrice() ) * Point I make ( OrderOpenPrice() - OrderClosePrice() ) / Point
When you multiply 000000000000000000, you get
Yes, of course - I made a mistake - you have to divide by Point, not multiply at all!
By function.
It's very simple. For example. You need to know the current profit (or loss) in the deposit currency of open trades (let's assume) - Bai-positions on EURUSD and Sell-positions on GBPUSD.
Take the function https://www.mql5.com/ru/forum/131859/page3#434223
and copy it to the end of your code (outside the START function)
Then current profit in currency of your positions will be (set inside of START):
double PROFIT_ EURUSD = GetProfitOpenPosInCurrency(EURUSD, OP_BUY, -1) ;
double PROFIT_FUNTDOLLAR = GetProfitOpenPosInCurrency(GBPUSD, OP_SELL, -1) ;
If you specified a magik when opening these positions, specify the magik instead of "-1".
If you need to know the profit of a position according to the current symbol, i.e. in the chart, on which the EA has been placed and is running, then :
double PROFIT_NULL = GetProfitOpenPosInCurrency(NULL, OP_SELL, -1) ;
Yes, of course - I made a mistake - you have to divide by Point, not multiply at all!
By function.
It's very simple. For example. You need to know the current profit (or loss) in the deposit currency of open trades (let's assume) - Bai-positions on EURUSD and Sell-positions on GBPUSD.
Take the function https://www.mql5.com/ru/forum/131859/page3#434223
and copy it to the end of your code (outside the START function)
Then current profit in currency of your positions will be (set inside of START):
double PROFIT_ EURUSD = GetProfitOpenPosInCurrency(EURUSD, OP_BUY, -1) ;
double PROFIT_FUNTDOLLAR = GetProfitOpenPosInCurrency(GBPUSD, OP_SELL, -1) ;
If you specified a magik when opening these positions, specify the magik instead of "-1".
If you need to know the profit of a position according to the current symbol, i.e. in the chart, on which the EA has been placed and is running, then :
double PROFIT_NULL = GetProfitOpenPosInCurrency(NULL, OP_SELL, -1) ;
Thanks for the advice.
But I want to set profit as a percentage of initial deposit and loss of deposit to be calculated. It works, but only for each trade, it is not possible to calculate the total loss.
Thanks for the tip.
But I want to calculate the profit as a percentage of the initial deposit and the loss of the deposit. I can calculate it, but only for each deal, it does not work in total.
Below are functions to calculate the Profit and Loss.
If you have the size/loss value you can calculate what it is as a percentage of the deposit.
Below are the functions to calculate Profit and Loss.
With the size/value of the Profit and Loss, you can calculate what this amounts to as a percentage of the deposit.
Thank you.
But when you compile in this row.
double Profit(){
it comes up with '(' - function definition unexpected
and this '}'. - unbalanced parentheses where the last return(0) is.
Where should it be pasted at all? Maybe I put it in the wrong place