Reply

trailing stop update

9 replies

huangwh88

Customer, bbp_participant, community, 113 replies.

Visit profile

7 years ago #116468

Hello, 

 

I believe that trailing stops are only updated at the open of a new bar. 

 

If my EA is running when a new bar opens, which is processed first, the new trailing stop, or the IF conditions in the EA?

 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #142027

Hello,

 

the trailing stop is being done by “manageStop();” function which is behind conditions created in Wizard so the IF will be processed first

0

huangwh88

Customer, bbp_participant, community, 113 replies.

Visit profile

7 years ago #142034

Hello,

 

the trailing stop is being done by “manageStop();” function which is behind conditions created in Wizard so the IF will be processed first

 Deeply appreciated Tomas!

0

Rico

Subscriber, bbp_participant, community, 15 replies.

Visit profile

7 years ago #142200

Just for the record, i can see in live trading that trailing stops aren’t only updated at the start of bars – that wouldn’t make sense for, say, an hourly or daily strategy. But if you have a bar open prices EA, maybe in backtesting they’re only updated at the start of bars?

 

In any case, my question is this: from looking at logs, i can see trailing stops move up unevenly, which i gather is a function of time and price ie prices may jump from here to there, rather than progress in even steps, and may only be updated in time unevenly as well. However they appear to move in points, rather than pips.

 

Lots of log entries are created for moving the trailing stop, which i’d rather not see.

 

Is there a way to make the trailing stop move in pips rather than points?

0

huangwh88

Customer, bbp_participant, community, 113 replies.

Visit profile

7 years ago #142244

Just for the record, i can see in live trading that trailing stops aren’t only updated at the start of bars – that wouldn’t make sense for, say, an hourly or daily strategy. But if you have a bar open prices EA, maybe in backtesting they’re only updated at the start of bars?

 

In any case, my question is this: from looking at logs, i can see trailing stops move up unevenly, which i gather is a function of time and price ie prices may jump from here to there, rather than progress in even steps, and may only be updated in time unevenly as well. However they appear to move in points, rather than pips.

 

Lots of log entries are created for moving the trailing stop, which i’d rather not see.

 

Is there a way to make the trailing stop move in pips rather than points?

Hi Rico, 

 

I have the same issue as you. According to the SQ manual, trailing stops are only updated at bar open, but based on MT4 strategy tester backtesting, that is not the case. I am trying to find out what causes the stop to be updated. 

 

Tomas, could you please enlighten me:

 

1) Can a trailing stop be moved within the bar?

 

2) Must a new open profit high be reached in order for the stop to be moved?

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #142259

Hello,

 

there are two type of trailing:

 

Profit Trailing a simple trailing stop that trails the Stop Loss specified distance from highest achieved profit. This condition is evaluated on open bar (not on every tick).

 

Stop Trailing more advanced trailing stop that can use a value of indicator or price (Open, High, Low, Close) to trail the Stop Loss. For example the rule can trail SL at Lowest(20) + 20 pips. This condition is evaluated on open bar (not on every tick).

 

The strategy code for MetaTrader contains order that prevents trailing from being processed unless bar is closed. See the screen attached

 

You can also attac the STR file or send me to [email protected] so I can test on my side

File: code.jpgcode.jpg

0

Rico

Subscriber, bbp_participant, community, 15 replies.

Visit profile

7 years ago #142262

This explanation doesn’t make sense to me on two levels:

1) if a trailing stop is only evaluated on bar open, what use would it be if you’re on a daily chart? It moves the trailing stop once a day?

2) please take a look at the following entries in my Experts tab for an ea created with SQ:

2017.03.27 07:25:47.421 Timer GBPUSD,H1: modify #34496308 buy 0.19 GBPUSD at 1.24861 sl: 1.25496 tp: 1.44860 ok

2017.03.27 07:25:47.171 Timer GBPUSD,H1: —VERBOSE— 2017.03.27 10:26 Moving trailing stop for order with ticket: 34496308, Magic Number: 1003 to :1.25496
2017.03.27 07:25:43.515 Timer GBPUSD,H1: modify #34496308 buy 0.19 GBPUSD at 1.24861 sl: 1.25495 tp: 1.44860 ok
2017.03.27 07:25:41.796 Timer GBPUSD,H1: —VERBOSE— 2017.03.27 10:26 Moving trailing stop for order with ticket: 34496308, Magic Number: 1003 to :1.25495
2017.03.27 07:25:41.796 Timer GBPUSD,H1: modify #34496308 buy 0.19 GBPUSD at 1.24861 sl: 1.25488 tp: 1.44860 ok
2017.03.27 07:25:40.468 Timer GBPUSD,H1: —VERBOSE— 2017.03.27 10:26 Moving trailing stop for order with ticket: 34496308, Magic Number: 1003 to :1.25488
2017.03.27 07:25:40.453 Timer GBPUSD,H1: modify #34496308 buy 0.19 GBPUSD at 1.24861 sl: 1.25481 tp: 1.44860 ok
2017.03.27 07:25:38.296 Timer GBPUSD,H1: —VERBOSE— 2017.03.27 10:25 Moving trailing stop for order with ticket: 34496308, Magic Number: 1003 to :1.25481
 
This log is telling me the trailing stop has moved a few times within 1 minute! And the ea was on a one hour chart.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

7 years ago #142294

Hello,

 

can you send the STR file to [email protected]? I will test on my side. I will try also nother EAs with trailing

0

Rico

Subscriber, bbp_participant, community, 15 replies.

Visit profile

7 years ago #142302

What is the STR file? If you mean sqw file, i’ve already sent it: Timer.sqw

0

Rico

Subscriber, bbp_participant, community, 15 replies.

Visit profile

7 years ago #142535

Just in case someone else is wondering what the answer to this issue is, here’s the response i received from Tomas by email:

 

“With open position in EA Wizard the trailing stop works according to MetaTrader system which is to update on every tick. This is why trailing works intra-bar.”

0

Viewing 9 replies - 1 through 9 (of 9 total)