Then your function should work correctly for the conditions in the comments:
int RFilter()
{
if ( R(2)> -barier && R(1) < -barier ) return (-1); // Short pose, if the indicator value on the previous bar is higher than the lower bar and the current one is lower than this bar
if ( R(2)< barier && R(1) > barier ) return (1); // Long pose if the indicator value is below the upper barrier on the previous bar and is above it on the current bar
return(0); // do nothing in all other cases
}
but this barrier just opens:
int RFilter()
{
double barierH = barier;
double barierL = -barier;
if ( R(2)> barierL && R(1) < barierL ) return (-1); // Short pose if the indicator value on the previous bar is higher than the lower bar and the current one is lower than this bar
if ( R(2)< barierH && R(1) > barierH ) return (1); // Long position if the indicator value is below the upper barrier on the previous bar and is above this barrier on the current one
OrderModify error 1. The first two trades modify, the third remains without a stop and drains the deposit. All trades are Buy.
I will add: second trade correct trawl, but at some point OrderModify error 1 very many times then Stack overflow . Apparently that's why 3 trades remain without stop.
void Trall()
{
int total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==true)
{
if (Bid - OrderOpenPrice()>TralOneStep*Point && OrderStopLoss()<=OrderOpenPrice())
{
if (OrderStopLoss() != Bid-NormalizeDouble(TralOneStep*Point,Digits))
{
if (OrderModify (OrderTicket(),OrderOpenPrice(),
Bid-NormalizeDouble(TralOneStep*Point,Digits),
OrderTakeProfit(),0,CLR_NONE)== false)
{
Trall();
}
}
}
RefreshRates();
if(Bid - OrderOpenPrice()>Tral*Point && Bid-OrderStopLoss()>=Tral*Point)
{
if (OrderStopLoss() != Bid-NormalizeDouble(Tral*Point,Digits))
{
if (OrderModify (OrderTicket(),OrderOpenPrice(),
Bid-NormalizeDouble(Tral*Point,Digits),
OrderTakeProfit(),0,CLR_NONE)== false)
{
Trall();
}
}
}
}
}
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
CodeBase has a script for editing such things.
You'll have to disconnect from the internet, though.
Apparently it's on a forum somewhere
Apparently it's on a forum somewhere
Then I'm deleting
Then your function should work correctly for the conditions in the comments:
int RFilter()
{
if ( R(2)> -barier && R(1) < -barier ) return (-1); // Short pose, if the indicator value on the previous bar is higher than the lower bar and the current one is lower than this bar
if ( R(2)< barier && R(1) > barier ) return (1); // Long pose if the indicator value is below the upper barrier on the previous bar and is above it on the current bar
return(0); // do nothing in all other cases
}
but this barrier just opens:
int RFilter()
{
double barierH = barier;
double barierL = -barier;
if ( R(2)> barierL && R(1) < barierL ) return (-1); // Short pose if the indicator value on the previous bar is higher than the lower bar and the current one is lower than this bar
if ( R(2)< barierH && R(1) > barierH ) return (1); // Long position if the indicator value is below the upper barrier on the previous bar and is above this barrier on the current one
return(0); // Do nothing in all other cases.
}
Help with trawl please.
OrderModify error 1. The first two trades modify, the third remains without a stop and drains the deposit. All trades are Buy.
I will add: second trade correct trawl, but at some point OrderModify error 1 very many times then Stack overflow . Apparently that's why 3 trades remain without stop.
Hi, could you please tell me what are the minimum levels for Alpari, no matter what stop loss i set, i still get error 130?
You should at least read something for starters....
Good morning !
My 3 questions are hanging .... Maybe they should be repeated periodically so they don't get lost and wait for answers ?