Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1332
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 did as you advised with the code. In the beginning of the code I have a condition to choose the type of stop - atp or fixed
Then I commented out my normalization and set it this way
Profit calculation is next in the code. No problems there and after calculating the profit I added the scary formula I've been advised to use.
All was compiled without errors. But when I run the test the log shows an error, that I get division by zero and the test is stopped. Where I messed up or what I did wrong?
Just delete it.
I did as you advised with the code. In the beginning of the code I have a condition to choose the type of stop - atp or fixed
Then I commented out my normalization and set it this way
Profit calculation is next in the code. No problems there and after calculating the profit I added the scary formula I've been advised to use.
All was compiled without errors. But when I run the test the log shows an error, that I get division by zero and the test is stopped. Where I messed up here or what didn't I do right?
Just when you are given two different options, you should not apply both at once.
Are you counting sl as two different choices
or
you get the value in price values. And the formula should contain points from ... to ....
So, the stop at a distance from the price is either iATR(.........)/_Point or razmer_fikc_sl but using two different values in the function is not very convenient, therefore it's better to leave only one variant
And don't forget that sl should be calculated BEFORE trying to calculate the lot size.
Make it so...
Just delete it.
I fixed the line and the test started - THANK YOU very much! Just didn't understand why when getting the stoploss from iATR into a variable, why divide by the point at the end? P/S I'm having real difficulties with maths, I'm not messing around :-( But I guess the test went well and with a 100 lot put the minimum, and with a 10000 lot different all the time, so it works fine... Thanks again for the help...
I have fixed the string and the test started - THANK YOU very much! Just didn't understand why when getting the stoploss from iATR into a variable, why divide by the point at the end? P/S I'm having a hard time with maths, I'm not messing around :-( But I guess the test went well and at 100 deposit the lot is minimal, and at 10000 depo it's different all the time, so it works ok... Thanks again for the help...
ATR gives out a decimal number, like 0.00120
razmer_fikc_sl is an integer.
to calculate the lot, you need points, i.e. integers
ATR/Point gives an integer number
This is an old topic, but I cannot find a solution. How to specify the time slot (for example, from 12:00 to 14:00) and only once in this slot open an order satisfying some condition (RSI<30 for example).
first condition - time has come
second condition - rsi
third condition - there is no such order in the history at the price of opening in intervals
Good afternoon.
There is an indicator Elliott Wave Oscillator, it gives numerical values of variable EWO. There are positive EWOs that are above zero and negative EWOs that are below zero.
From last 100 readings of EWO, it is necessary to calculate the average value of positive EWO and separately the average value of negative EWO
I get the values from the indicator double EWO=iCustom(Symbol(),0, "Elliott Wave Oscillator",0,0);
Please advise which mql4 code can implement this in an EA ?
I managed to find the modulo average.
double avarage_EWO = 0;
for(int g=0;g<100;g++)
avarage_EWO = avarage_EWO + MathAbs( iCustom(Symbol(),0, "Elliott Wave Oscillator",0,g) ); // modulo average
avarage_EWO = avarage_EWO/100;
But how to calculate separately average positive and average negative EWO ?
Thanks !
Take Profit triggering
I cannot figure out how and what ORDER_REASON_TP is for,
I know howDEAL_REASON_TP works, but I don't know what is going on with orders here