Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 836
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
Is it all right that it says
nothing, the thread is for MT4, so you don't pay attention to it
OK, get busy, it's boring here
Greetings all. Good luck in life and profit in work.
I am asking for help (unexpectedly, huh? :) ).
In Mql I am a zerobom, 2 days "in the subject". If real EA forces me to use automatic trading, I'm trying to write (collect it in real time from different parts) owl for my flat EA and of course I'm getting tired of it :). I've been trying to work out another problem for about 10 hours and I still haven't got to it. If anyone's advice or an example will be extremely grateful (verbally and in writing, and most importantly in the shower).
In general... There's TC, successfully used by me for a long time. On trade conditions on the same instrument can multidirectional market orders (no pending). To the lowered position may be filled at a trading signal, provided that the position has fallen by at least X pips, sometimes happens and make an addition to the fill (under the same conditions (trading signal + drawdown size)). The (current) problem is in opening additional positions, namely... how to check and return the value of loss on a long position. Following the exampleof https://www.mql5.com/ru/forum/117061, I tweaked the code to assign each position its own Magik, but that's about it. How to select exactly a position that has sat and return its loss value.... :(.
"my" code for opening trades.
//-----------------
if (NumberOfPositions(Symbol(),OP_BUY, Magic)<1)
{
if (my entry conditions)
{
if (takeprofit!=0) TP = NormalizeDouble(Ask + takeprofit*Point,Digits); else TP = 0;
if (stoploss!=0) SL = NormalizeDouble(Bid - stoploss*Point,Digits); else SL = 0;
ticket=OrderSend(Symbol(),OP_BUY,LOT,NormalizeDouble(Ask,Digits),5,SL,TP, "BUY",Magic,0,Blue);
if(ticket < 0) { Print("Error while opening BUY order #", GetLastError());}
}}
if(NumberOfPositions(Symbol(),OP_SELL, Magic)<1)
{
if (my entry conditions)
{
if (takeprofit!=0) TP = NormalizeDouble(Bid - takeprofit*Point,Digits); else TP = 0;
if (stoploss!=0) SL = NormalizeDouble(Ask + stoploss*Point,Digits); else SL = 0;
ticket=OrderSend(Symbol(),OP_SELL,LOT,NormalizeDouble(Bid,Digits),5,SL,TP, "SELL",Magic,0,Red);
if(ticket < 0) { Print("Error opening SELL order #", GetLastError());}
}}
//---------------
Additional orders are planned to open using the following code
//---------------
if (NumberOfPositions(Symbol(),OP_BUY, Magic)==1 && NumberOfPositions(Symbol(),OP_BUY, Magic_2)<1)
{
if (my entry conditions && GetProfitOpenPosInPoint(Symbol(),OP_BUY,Magic)>= LEVEL_1)
{
ticket=OrderSend(Symbol(),OP_BUY,LOT,NormalizeDouble(Ask,Digits),5,SL,TP, "Extra Buy",Magic_2,0,Blue);
if(ticket < 0) { Print("Error opening BUY order #", GetLastError()); }
} }
//---------------
And that's where I got stuck :). What to use instead of GetProfitOpenPosInPoint(Symbol(),OP_BUY,Magic). I think I need to use Drawdown_level(Symbol(),OP_BUY,Magic) but how to get it...
Help PLEASE, be friends.
Z.U. If you advise, please keep in mind that I'm still nubyara that not too lazy to send me a little more detail, you know, like if: FOREST THERE, do not forget to point out the direction <------ || ------>.
Thank you for your attention :).
Nothing, the thread is for MT4, so you don't pay attention to it.
Ok, get busy, it's boring here
Tell me where a similar branch for MT5 is, I'll ask there...
Tell me where a similar thread for MT5 is, I'll ask there...
Is it OK to specify
In MT4 the function call from Indicator goes without errors and works as needed(int handle=iEnvelopes(Symbol(), tf, period, method, shift, price, Deviation(kanal), buff);) I thought it may be the same in MT5.
Please advise how to do it correctly ?
In MT4 the function call from Indicator goes without errors and works as needed(int handle=iEnvelopes(Symbol(), tf, period, method, shift, price, Deviation(kanal), buff);) I thought it may be the same in MT5.
Can you tell me how to do it correctly ?
So it is impossible to get Envelopes data in mql4
Here's the code from MT4
Everything works perfectly. I would like the same in MT5
Here's the code from MT4
Everything works perfectly. I would like the same in MT5
Well that's because it's a different code and it will work.
Fixed the MT5 code to send data to the Indicator:
But the error is the same.
Here's the code from MT4
Everything works perfectly. I would like the same in MT5
Watch your hands:
In my previous post this is highlighted in your code
and in the code of this, the quoted message is a function declaration. Also highlighted.
And this
Calling a user function that exists. Although this programming method is unacceptable to me, it is still understandable. But how to describe the error in that code, I'm at a loss.