Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 901
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
Quote from the handbook:
//+------------------------------------------------------------------+
//| Expert initializationfunction|
//+------------------------------------------------------------------+
intOnInit()
{
//--- get the value of the custom indicator
doublevalue=iCustom(_Symbol,_Period,"::Indicators\\\SampleIndicator.ex4",0,0);
Reference to indicator variables in the initialisationfunction , not in the start function?Reference to indicator variables in the initialisationfunction only opens one position.
Quote from handbook:
//+------------------------------------------------------------------+
//| Expert initializationfunction|
//+------------------------------------------------------------------+
intOnInit()
{
//--- get the value of the custom indicator
doublevalue=iCustom(_Symbol,_Period,"::Indicators\\\SampleIndicator.ex4",0,0);
Reference to indicator variables in the initialisationfunction , not in the start function?Reference to indicator variables in the initialisationfunction only opens one position.
Instead of start it is high time to use OnTick() and other event handlers. Forget about the functions of the old MetaTrader 4. The new MQL4 is now very close to MQL5 - the only differences are in a different organization of trading functions and indicators - they are now created in the OnInit() handler - an indicator handle is created and the data access to this handle is performed. In MQL4 it is different. But resources are located in the same way, if my memory doesn't change.
And the access to the calculated data is not much different from the access through iCustom() in a usual way - its name is only slightly different.It's getting late. Artem, will you be able to reply tomorrow? Thank you in advance.
No promises - busy.
Late ... it's 04:51 ... that's "late".
I think the problem is not with StopLevel since it still opens one order. But on next ticks it generates error
I think the problem is not with StopLevel since it still opens one order. But on next ticks it generates error
You need to check if the price is less than the stop loss or spread, then of course there will be an error. This is the first one.
Judging by the text you do not have a check whether the order has already been opened or not.
This way it will open till infinity on every tick.
H=iCustom(NULL,TF,"::Indicators\\\KChange.ex4",History,Period_1,Period_2,MA_method,0,1);
The compiler didn't find any errors, but the tester works much slower? Is it normal?
//-----------------------------------------------------------------------------------------------------------------
The MQL4 manual says: reference to variables in the initialization function ?
Reference to indicator variables in theinitialization function , not in the start function? Experienced people tell me please!
if slow, you need to optimize-accelerate the indicator
you need to call where you want to check the indicator values, inthe initialization only one value will be received
You are looking for a fractal on the third bar, it may not be there. Look for the first fractal in the cycle.
You need to check if the price is less than the stop loss or spread, then of course there will be an error. This is the first one.
Judging by the text you do not have a check whether the order has already been opened or not.
Otherwise it will open indefinitely on every tick.
Exactly, it doesn't open on every tick, it only opens once.
Is there an error 130 in the logbook ?
Above explanation of where it comes from and how to do the right thing to avoid it.
You didn't.