Click here to Login





                                                   Stop Loss behavior

  0

0
Dave Walton
2014-08-28 08:39:22


Hi QS, can you provide some clarity on how stops work in the simulator? Below is my understanding based on trial and error:

"Settings -> Capital" then "Activate stop immediately".
Only if this is set will the simulator look at the low/high of the current bar to check if the stop creates an order. Then the order triggers on the same bar at the stop price.

It appears that if that item is no set, the check to generate a stop is done with the open/close only. So if you have a bar with a huge wick that would trigger an intraday stop, it will never trigger if the close is above the stop level. I wasn't expecting this behavior. It is valid but probably not how most people think it works and/or really trade.
I assumed that the high/low would still trigger a stop, just that the order would be sent for the next bar.

Was this the intent in the implementation?



QuantShare
2014-08-28 09:09:35

  0

Best Answer
Yes, it works that way.
If you want to use high/low, check "Activate stop immediately".



Dave Walton
2014-08-28 12:09:50

  0

Understood but it would be nice to provide the option to look at high/low of the current bar but exit on a subsequent bar.

I've implemented this in AMM for my purposes.



QuantShare
2014-08-28 14:08:12

  0

Thanks Dave for the suggestion.


Seeker
2014-11-09 08:50:52

  0

The back testing results drastically differs for me when "Activate Stop Immediately" is checked in my hourly system which has trailing stop. While "unchecked", the system shows very decent profit but with the "activate stop immediately" checked, the results turn very negative. What can be close to the real life situation; checked or unchecked? In real-life, if I keep the hourly system in such a way that stops are executed based on the hourly close (rather than the intra-hour high/low), would it be similar to keeping the "activate stop immediately" unchecked?
As this discussion is on simulator stops, may I ask how exactly the trailing stop works? What is the initial trailing stop level when the position starts? Also, any help on how to make the trailing stop calculate only based on the hourly close price?



QuantShare
2014-11-10 01:13:42

  0

- if I keep the hourly system in such a way that stops are executed based on the hourly close (rather than the intra-hour high/low), would it be similar to keeping the "activate stop immediately" unchecked?

No, "activate stop immediately" tells QS to exit a position as soon as the price crosses the stop level.


- What is the initial trailing stop level when the position starts?

At the entry price.


- Also, any help on how to make the trailing stop calculate only based on the hourly close price?

You mean instead of using high/low?



Seeker
2014-11-10 01:50:31

  0

Firstly, when "activate stop immediately" is not activated, does it look at high/low or only the close of the hour (even when I run the system as an ATS on live feed)?

As I have mentioned, when it is not activated I'm getting very good profitability in the backtest results but when activated it changes drastically to the negative. My attempt is to mimic the first situation (of high profitability) while running this system as an ATS. Also what could be the reason for the results to change to extreme negative while this option is activated?

On trailing stop when u say at the entry price (at the commencement of the trade), do u mean x% from the entry price or entry price itself? I have a 2% trailing stop in the system.



QuantShare
2014-11-11 00:53:27

  0

When "activate stop immediately" is activate, the position is closed when the high/low touches the stop level.
When ATS is running, the position will be closed as soon as the last price touches the stop level (it doesn't wait until the bar is formed)

Regarding your trading, that depends on a lot of things. You may create a different system and get opposite results. That situation isn't a rule. Just analyze your trades and see what may be causing this.

If you have 2% trailing stop then the stop is calculated as follow:
Highest value during the trade lifetime * (1 - 0.2)
That threshold changes each time a new highest value is detected.



Seeker
2014-11-11 02:40:58

  0

Is there any way to get the "activate stop immediately" to be activated from the second bar onwards. On the bar where the position is taken its not activated but is activated from the next bar. I think that may considerably change the situation.


QuantShare
2014-11-11 12:58:20

  0

You may enable "activate stop immediately", set a stop value that is unlikely to be hit then update the stop level on the next bar. This can be implemented only using the money management script.


Seeker
2014-11-13 04:34:23

  0

"When "activate stop immediately" is activate, the position is closed when the high/low touches the stop level.
When ATS is running, the position will be closed as soon as the last price touches the stop level (it doesn't wait until the bar is formed)"

This will happen only when "analyze on incoming ticks" is enabled for the ATS, right? I guess when it is enabled, apart from the stop loss, it would process all the trading system signals also based on the last live price rather than wait for the bar to close. How can I use it in such a way that stop loss (in my case trailing stop) is triggered on the live price but the trading system signal is calculated/triggered only based on the bar close?

I am once again trying to think loud on the stop loss mechanism when "activate stop immediately" is chosen. In backtesting, the trade is exited at the exact stop price when the high/low exceeds the stop price. Am I right in thinking that there is an anomaly here especially when it comes to Trailing Stop. Lets suppose after the open of the bar (hourly time-frame) , the low price is made (say, 122). Prices then rise to a high of 125. For the ongoing long trade, the 2% trailing stop will now be 2% below 125 which is 122.50 and the bar's low which was made earlier is 122. In the backtest, this will trigger exit of the long trade at 122.50 while in real life it wouldnt be the case as the high (on which the trailing stop is computed) is made after the low. Am I right or am i getting lost!



QuantShare
2014-11-14 00:36:24

  0

Note that trailing stop is always readjusted at the close of the bar so the issue you are describing doesn't apply here. However, it applies when combining several stops.

For what you want to do, you just need to create two trading systems, one with "When "activate stop immediately" active (for backtesting) and one with "When "activate stop immediately" disabled (for ATS).



Seeker
2014-11-14 01:22:10

  0

"Note that trailing stop is always readjusted at the close of the bar"

Could you please throw little more light on it?

"one with "activate stop immediately" disabled (for ATS)"

Actually, i want the stop to be triggered as soon as the last tick crosses it. But i don't want the buy,sell, short,cover signals of the trading system triggered on the live ticks. It should be triggered only based on the prices at the end of the bar (only on the completed hourly bar). My stop is a 2% trailing stop. That should be triggered on the live prices without waiting for the completion of the hourly bar.



QuantShare
2014-11-14 10:11:18

  0

What I meant is that when "activate stop immediately" is enabled in backtest mode then it is executed exactly that stop level only if that level is between high/low of the ended bar.
In live ATS mode, "activate stop immediately" generates real stops which are handled by the broker. Note that doesn't apply to the trailing stop. Trailing stop is always handled by QuantShare.

- "Actually, i want the stop to be triggered as soon as the last tick crosses it. But i don't want the buy,sell, short,cover signals of the trading system triggered on the live ticks"

Just do the opposite. Deactivate "activate stop immediately" for ATS.



Seeker
2014-11-14 10:24:18

  0

Sorry to press you further with this. So, I deactivate "activate stop immediately" in the ATS and also keep "Analyze on each incoming tick" active? So far, I have been keeping both de-activated. This was resulting in stop execution also happening only at the completion of the hourly bar.


QuantShare
2014-11-15 03:19:09

  0

You cannot have a stop execution at the end of the bar and order generation for each incoming tick.
You can only do that using the money management script.



Seeker
2014-11-15 04:41:08

  0

What I need is stop execution on each incoming tick but other system orders at the completion of the bar.


QuantShare
2014-11-17 00:28:26

  0

"What I need is stop execution on each incoming tick but other system orders at the completion of the bar"

Enable "activate stop immediately" and disable "analyze on incoming ticks".
This would work only on ATS when connected to IB (This is because stop orders are handled by IB in this case)



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Stop Loss for the N-first Trading Bars only
Stop Mgmt v 1.1
Trade Plan - Entries/Profit Target/Stop Loss
Decreasing the Trailing Stop Level every Trading Bar
Disable or Enable your Stop Rules

How-to Lessons
How to optimize the stop limit of a trading system
How to create a volatility-based Stop - Dynamic stop based on the...
How to optimize the number of positions in a trading system
How to create and trade a Neural Network model
How to set order type of a trading system programmatically

Related Forum Threads
Setting stop loss for each trade
Profit loss protection trailing stop line on chart .
Stop Loss effective only for 1st 2 bar of order ..
Stop Loss for Intraday Trading System
Stop Loss after N days

Blog Posts
QuantShare Trading Software: New Features in the 3.3.2 Version
Trading orders - Part 2
The Ultimate Guide to Create Trading Systems in QuantShare
5 position sizing techniques you can use in your trading system
Backtesting a Strategy Based on Bond and Stock Index ETFs









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.