Questions from Beginners MQL5 MT5 MetaTrader 5 - page 354
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
Please advise which command to write to open an order at the same time when Sell1 and Sell2 fractals are opened
This is the external variable that checks the condition inside the function
extern int PF_price_in_pips=70;
The function should:
1.define what kind of orders we are dealing with... if SigPF==1, then it is a Buy order, if SigPF==2, then it is a Sell order
2. check the current price and if
there is a Buy order and SigPF==1 is present in the market, then
the difference between the current price at which the Buy order is to be opened and any of the open prices of the orders already in the market is higher than PF_price_in_pips, the function should return valid_signal=true
there are now Sell orders in the market, and SigPF==2 has been set, then
the difference between any open order price already present in the market and the current price, at which the Sell order will be opened, is higher than PF_price_in_pips, then the function should return the valid_signal=true flag
if the distance between the opening price of the new order at the occurrence of buy/sell signals is lower than PF_price_in_pips, the function should return valid_signal=false
Basically, in a nutshell, the function should check the distance between the open price of the new order at buying and selling signals (SigPF==1, SigPF==2) and any of the order open prices that are already in the market... and if that distance is greater than PF_price_in_pips then the valid_signal=true should be returned. This is to avoid opening orders at prices very close to each other! And another thing... my EA only trades on opening of a new bar... not on all ticks... but I don't think it matters... I have to consider Bid or Ask prices anyway ...
help with this function... ! If something is not clear i will try to explain ... or give pictures! Just help me) Thank you!
I'm not sure I got the terms right, but...
int OrdTotal=OrdersTotal();
bool valid_signal=false;
int SigFF;
if(OrdersTotal()>0)
{
for(int i=OrdTotal-1; i>=0; i --)
{
if(!OrderSelect(i,SELECT_BY_POS))
continue;
if(OrderType()==OP_BUY && SigFF==1 && Ask+OrderOpenPrice()>PF_price_in_pips)
valid_signal=true;
else
valid_signal=false;
if(OrderType()==OP_SELL && SigFF==2 && OrderOpenPrice()-Bid>PF_price_in_pips)
valid_signal=true;
else
valid_signal=false;
}
}
Can you tell me which command to write so that when the fractals Sell1 and Sell2 open at the same time an order
Can you tell me which command to write so that when Sell1 and Sell2 fractals are opened at the same time an order is opened
But this must be a VERY VERY crude example
Hello Colleagues, recently joined your ranks :). I'm sick of pending orders and decided to use a script that I have downloaded from the Internet but it was not satisfying: I had errors in one direction only, and the other script only placed one order in each direction. It essentially consists in opening of a certain amount of pending orders in both directions. Question: How can I set a trailing stop on each order? This is a script, not an Expert Advisor. The orders were opened, the trailing stop was attached to them, and that is all, the script has done its job. How can I use the script to trigger a regular trailing stop which is executed by a right-click on an order? 4th MetaTrader Build 765.
Hello Colleagues, recently joined your ranks :). I'm sick of pending orders and decided to use a script that I have downloaded from the Internet but it was not satisfying: I had errors in one direction only, and the other script only placed one order in each direction. It essentially consists in opening of a certain amount of pending orders in both directions. Question: How can I set a trailing stop on each order? This is a script, not an Expert Advisor. The orders were opened, the trailing stop was attached to them, and that is all, the script has done its job. How can I use the script to trigger a regular trailing stop which is executed by a right-click on an order? 4th MetaTrader Build 765.
Hi all!
The task is as follows - I need to open orders after a certain distance Step on EURUSD.m to buy and on EURUSD.m1 to sell. This problem is solved in the code below.
However, if the price has gone against us, we still need to open buy orders for EURUSD.m, provided that the price has gone from the last order to sell at EURUSD.m1 at a distance of Step*2. This condition will work under the condition that this opening price is lower than the price of the last buy order for EURUSD.m.
I cannot figure out how to do it. I would be glad to help.
Freelancers do it all).
A very valuable and informative reply-commentary, I suggest you use it too...
As a matter of fact - there is no simple command that, after opening an order, hangs a standard trailing stop on top of it?