Cancelling / modifying stop level
Author: electricessence
Creation Date: 7/14/2017 8:39 PM
profile picture

electricessence

#1
So far just SellAtStop(...) seems to work as expected but I'm a bit confused about what it's doing under the hood and how I can control that.

Is the condition Day or GTC? It looks like in WL that it's GTC but is it really?

How can I 'cancel' a stop level? For example. After the last bar of the day I want to cancel the stop so it doesn't fire in the morning when there's high volatility.
profile picture

Eugene

#2
QUOTE:
Is the condition Day or GTC?

Day (Bar).

QUOTE:
How can I 'cancel' a stop level?

Don't issue the stop order. When a complete bar updates, your strategy executes over all the bars in the chart and determines if it wants to exit the position on a stop on the next bar. If it doesn't, you don't do anything, otherwise you place a stop order for the next bar.
profile picture

Cone

#3
When backtesting intraday strategies, it might be a good idea to condition entry signals to not fire on the last bar of the day (so as not to create an alert to buy on the open of the next day), and, if you don't want to participate in the first 10 minutes, you can condition that too.

Assume you're trading 1 minute bars. This example will prevent Alerts from occurring on the last bar of the day and at the same time only allow alerts after the first 10 minutes.

CODE:
Please log in to see this code.


Here's a link to the wiki page with more helpful functions for intraday trading/backtesting found in Community.Components.
profile picture

electricessence

#4
Ok great.
profile picture

electricessence

#5
What's this
CODE:
Please log in to see this code.
?
profile picture

Cone

#6
Tip:
Once you have the code in the Editor, put the cursor on the WealthScript keyword you want to look up and hit F1 to open its entry in the QuickRef. ;)

Alternatively, strike F11 to open the QuickRef and type in your search.