Suppose the robot took a long position and reached +100 ticks
(Stop loss was set at -50) Trailing jumped to +50,
A correction occurs and price moves back by +50 ticks. At this point, instead of the trailing edge taking us out of the position, we buy one more contract at the current price and set the stop loss at the same -50 ticks.
Eugen8519: I always do that, I re-test almost all of them.
Suppose the robot took a long position and reached +100 ticks
(Stop loss was set at -50) Trailing jumped to +50,
A correction occurs and price moves back by +50 ticks. At this point, instead of the trailing order knocking us out of the position, we buy one more contract at the current price and set the stop loss at the same -50 ticks.
And this is repeated 2-3 times?
You may buy them at a certain price, you may buy them at a certain moment and then you'll have to buy them again.
Hello. Could you please tell me how to change trailing step in the built-in trailing stop from 1 pip to 5 pips? In other words, I want it to be pulled up every 5 pips? Yep.
askbid3737: Hello. Could you please tell me how to change the trailing step in the built-in tra iling stop, from 1 pip to 5 pips? In other words, I want it to be pulled up every 5 pips? Yep.
SelectTrailing Stop and the menu item "Set Level... "
Of course there is everything your heart desires. You just need to look into the kodobase and test all the EAs, they are definitely there - I always do that and almost all the EAs I re-test.
I've done a lot of testing there myself, but I haven't come across a suitable option.
I think that the problem is to make the second trailing stop, like a trailing stop, but with a task to buy a contract.
After all, in the long position, when you pull up the trailing stop, a limit order (sell stop) is opened, if I'm not mistaken.
And it is exactly sell stop that is changed to BUY ORDER.
This is my trailing stop.
void Trailing()
{
if(InpTrailingStop==0)
return;
for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of open positionsif(m_position.SelectByIndex(i))
if(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==m_magic)
{
if(m_position.PositionType()==POSITION_TYPE_BUY)
{
if(m_position.PriceCurrent()-m_position.PriceOpen()>ExtTrailingStop+ExtTrailingStep)
if(m_position.StopLoss()<m_position.PriceCurrent()-(ExtTrailingStop+ExtTrailingStep))
{
if(!m_trade.PositionModify(m_position.Ticket(),
m_symbol.NormalizePrice(m_position.PriceCurrent()-ExtTrailingStop),
m_position.TakeProfit()))
Print("Modify ",m_position.Ticket(),
" Position -> false. Result Retcode: ",m_trade.ResultRetcode(),
", description of result: ",m_trade.ResultRetcodeDescription());
}
}
else
{
if(m_position.PriceOpen()-m_position.PriceCurrent()>ExtTrailingStop+ExtTrailingStep)
if((m_position.StopLoss()>(m_position.PriceCurrent()+(ExtTrailingStop+ExtTrailingStep))) ||
(m_position.StopLoss()==0))
{
if(!m_trade.PositionModify(m_position.Ticket(),
m_symbol.NormalizePrice(m_position.PriceCurrent()+ExtTrailingStop),
m_position.TakeProfit()))
Print("Modify ",m_position.Ticket(),
" Position -> false. Result Retcode: ",m_trade.ResultRetcode(),
", description of result: ",m_trade.ResultRetcodeDescription());
}
}
}
I was thinking about leaving it and adding a trailing buy/sell.
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.
Is it true that CalendarValueHistory() does not work in debug mode on historical data?
No matter what dates it asks for, there are always 0 values. It works fine in debug mode.
Is it true that CalendarValueHistory() does not work in debug mode on historical data?
No matter what dates it asks for, it always has 0 values. In debug, realtime works fine.
ok, in backtest it doesn't work
I always do that, I re-test almost all of them.
You may buy them at a certain price, you may buy them at a certain moment and then you'll have to buy them again.
Hello. Could you please tell me how to change the trailing step in the built-in tra iling stop, from 1 pip to 5 pips? In other words, I want it to be pulled up every 5 pips? Yep.
SelectTrailing Stop and the menu item "Set Level... "
Of course there is everything your heart desires. You just need to look into the kodobase and test all the EAs, they are definitely there - I always do that and almost all the EAs I re-test.
I was thinking about leaving it and adding a trailing buy/sell.
Maybe someone has an idea?
Eugen8519 Может у кого есть идея?
you could also add a trawl like this - and you can execute any command from the object
https://www.mql5.com/ru/forum/233860/page43#comment_13219147
Hi all!
Can you tell me if it is possible to use MT4 synchronously from a smartphone and a PC on one account?
So, what to place orders via smartphone, and see and edit in PC realtime?
Thank you!
Hi all!
Can you tell me if it is possible to use MT4 synchronously from a smartphone and a PC on one account?
So, what to place orders via smartphone, and see and edit in PC realtime?
Thank you!
This is a branch on MQL5.
Orders and positions (MQL5) are equally placed, modified and closed via PC or smartphone, manually, in real time.