Questions from Beginners MQL5 MT5 MetaTrader 5 - page 419
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
Two years - in tester :) Well, it's been running for a year on the demo... A lot of bugs there, when I had to connect it because of external classes... And now there's such a bug, which I don't know how to fix - I'll just increase array's size by one digit, for now. Why isn't there an auto-size, like for a graphical buffer, or is there?
Try it like this.
Initialize the array OrderBU[1].
First increase the size of the array ( ArrayResize(OrderBU,NorderBU+1) ), then OrderBU[NorderBU]=OrderTicket();NorderBU++;
Try it like this.
Initialize the array OrderBU[1].
First increase the size of the array ( ArrayResize(OrderBU,NorderBU+1) ), then OrderBU[NorderBU]=OrderTicket();NorderBU++;
Could you please advise us on this point?
For example, we have a Williams Percent Range (%R) indicator on a chart and we drag the On Balance Volume (OBV) indicator into its window from the navigator.
https://charts.mql5.com/8/675/xauusd-h4-metaquotes-software-corp.png
The %R works in the range 0 -100%, the OBV does not have a specific binding.
When OBV is in the %R window, we visually see that it goes beyond -20 or -80%.
How can we get OBV above -20% or below -80% in our EA?
How to bind the OBV in the custom indicator to the range of 0 -100%? Normalize it to it (range)? How can this be done?
I understand you don't need to normalize OBV to %R (the picture will be different).
Maybe it's elementary, I just haven't encountered it.
if (p1>p2&&p1>p3) , if (p2>p1&&p2>p3) , if (p3>p2&&p3>p1)
I do it this way,
I need a floating lot parameter, the first lot is set by the user, then this parameter is no longer needed and the EA works itself and in case of a loss it is raised by the maximum lot specified in the program (or an external variable), in case of a profit it is decreased by the specified amount .
If I write the parameter in the "Init ", the EA will stop accessing the external variable lot ?
or how do I do it ?
this is an approximate expression .
if (p1>p2&&p1>p3) , if (p2>p1&&p2>p3) , if (p3>p2&&p3>p1)
I do it this way,
It's not convenient, especially with a large number of parameters...
The solution via array is interesting. Especially interesting how to find the closest value of a variable when averaging the total number of values.
Good evening. Trying to write a simple EA on tenkan and kinjun crossing. Here is the code:
void OnTick()
void OnTick()
{
TradeSignal_20();
}
int TradeSignal_20()
{
int sig=0;
if(h_ich==INVALID_HANDLE)
{
h_ich=iIchimoku(Symbol(),Period(),IKHtenkansen,IKHkijunsen,IKHsenkouspanb);
return(0);
}
else
{
if (CopyBuffer(h_ich,0,0,3,ich1_buffer)<2) return(0); // TENKANSEN_LINE
if (CopyBuffer(h_ich,1,0,3,ich2_buffer)<2) return(0); // KIJUNSEN_LINE
if (!ArraySetAsSeries(ich1_buffer,true)) return(0);
if (!ArraySetAsSeries(ich2_buffer,true)) return(0);
}
//--- check condition and set value for sig
if(ich1_buffer[1]>ich2_buffer[1]) sig=1;
else if(ich1_buffer[1]<ich2_buffer[1]) sig=-1;
else sig=0;
if (ich1_buffer[1]>ich2_buffer[1])
if (ich1_buffer[2]<ich2_buffer[2])
Alert(Symbol()+": purchase");
if (ich1_buffer[1]<ich2_buffer[1])
if (ich1_buffer[2]>ich2_buffer[2])
Alert(Symbol()+": sale");
//--- return trade signal
return (sig);
}
//+------------------------------------------------------------------+
How can I make the alert be called only once and not constantly?
Run not every tick, but as needed.