Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1546
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
Do you have an EA which supports manually placed orders?
Tried to insert it, it doesn't compile. The entire code, if necessary, I will put a screenshot of the compilation. I think there may be another problem, my TP is set in relation to STOP by coefficient (external variable), maybe it can be changed to manual setting and it will be easier for EA to add?
The function
from the global scope. magic=0 for compilation.
magic=0
The function
from global scope, remove magic=0 for compilation.
Removed, no compilation errors, only 1 warning pops up in third function line in column tp=0 with hearing on external variable int tp=0. I don't quite understand what the programmer doesn't like. All code attached, if you're not hard to correct, the truth is somewhere near.
Removed, no compilation errors, only 1 warning pops up in third line of function in column tp=0 with hearing on external variable int tp=0. I don't quite understand what the programmer doesn't like. All code attached, if you're not hard to correct, the truth is somewhere near.
It looks like this
You don't need magic at all in your case
That's about right.
In your case magic is not needed at all.Thanks, will test it, will report back. I hope it works the same as mine, but adds a stop (if it's triggered) to the new take.
What are the external parameters Input4; 5; 6 needed for?
Thank you, I will test it and report back. I hope it works the same as mine, but adds a stop (if it triggered) to a new take.
There is only modification here. There is no order deletion or reversal.
If you describe what the EA should do, I will try to help.
What are the external parameters Input4; 5; 6 needed for?
If you describe what the EA should do, I will try to help.
I place a buy pending order - the EA is working - the pending order triggers - the EA "sees" this and places a stop loss on this open order:
stop loss (external parameter is set in settings);
Take Profit(external parameter is set in the settings using the ratio of e.g. 1 to 2);
pending sell order at stop loss level.
Possible scenarios.
Variant 1.
A) If the price reaches Takei - the Expert Advisor removes Stop Loss and a pending Sell order;
Variant 2.
B) If the stop loss is triggered and the EA "went to history", then:
A Sell order is opened and the Expert Advisor re-positions this order:
stop loss (external parameter is set in settings)
Take Profit + a triggered Stop Loss from the history;
a pending buy order at the stop loss level.
The price reaches the take - the Expert Advisor removes the stop loss and the pending Buy order.
And vice versa, if the work starts with a pending sell order.
And so advisor works until it stops its work with external parameter Stop Loss number (in my case it is 2, it means variant 2 will be repeated 3 times and advisor will stop working in future and will delete all pending orders, the first stop is not taken into account).
If takei is not reached and variant 2 is repeated, then 2 stops are added to takei and so on, it depends on set external parameter"Stop Loss count".
The code, which I put up works as it should, except for the problem, which I described (does not see in the history of 1 stop or 2 stops, which should add to the take).
Like this.
I put a pending buy order - the EA is working - the pending order triggers - the EA "sees" this and places a stop loss on this open order:
stop loss (external parameter is set in settings);
Take Profit(external parameter is set in the settings using the ratio of e.g. 1 to 2);
pending sell order at stop loss level.
Possible scenarios.
Variant 1.
A) If the price reaches Takei - the Expert Advisor removes Stop Loss and a pending Sell order;
Variant 2.
B) If the stop loss is triggered and the EA "went to history", then:
A Sell order is opened and the Expert Advisor re-positions this order:
stop loss (external parameter is set in settings);
Take Profit + a triggered Stop Loss from the history;
a pending buy order at the stop loss level.
The price reaches the take - the Expert Advisor removes the stop loss and the pending Buy order.
And vice versa, if the work starts with a pending sell order.
And so advisor works until it stops its work with external parameter Stop Loss number (in my case it is 2, it means variant 2 will be repeated 3 times and advisor will stop working in future and will delete all pending orders, the first stop is not taken into account).
If takei is not reached and variant 2 is repeated, then 2 stops are added to takei and so on, it depends on set external parameter"Stop Loss count".
The code, which I put up works as it should, except for the problem, which I described (does not see in the history of 1 stop or 2 stops, which should add to the take).
It goes like this.
"Number of Stop Losses" - in a row or for the current day?
"Number of Stop Losses" - in a row or for the current day?
The number of stops in a row on a currency pair.
In order to analyse the history, the Expert Advisor initially labels the orders with their IDs, but does not find them in the history, I thought that OrderMagikNumber() will search for them. Maybe because of the fact that in the history stops from different currency pairs the EA stops "seeing" them?
put up the source again? All he needs to do is correct "search for stop trades from history and make it add to the newly placed take".