Widner Projection Band Strategy with ATRModified
Author: mc3273
Creation Date: 10/24/2014 12:19 PM
profile picture

mc3273

#1
Good Morning

Would you be able to assist, I am trying to change the sell portion of the Wider Band Strategy to encompass the Modified ATRSR exit strategy.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Hi,

Are we supposed to guess how are you trying to encompass this or that code? ;) A good habit is to describe how exactly you're trying to modify something, with rules in plain English.

1. What is this for?
CODE:
Please log in to see this code.

2. Don't duplicate the "atrStop" in the entry/exit sections; you've already defined it above.

3. Before making an entry/exit, you're comparing the price you need against the current atrStop level. This seems copied from the original code correctly.

4. What is this for?
CODE:
Please log in to see this code.
profile picture

mc3273

#3
Sorry Eugene, thanks so much for helping

I am trying to integrate an additional entry condition on the entry and ATR Trailing Stop on the exit into this Wider Projection Band System


Entry -
1)Trigger based on the Parameter set below set in the original script
paramPer = CreateParameter("Band lookback", 20, 2, 40, 1);
paramDip = CreateParameter("Limit price", 0.96, 0.9, 0.99, 0.01);
2) If possible I would like to include a Momentum (12, Close) parameter based on a 3 Min Intraday scale.
So once the Band Limit value is set by the 1st condition, the trade would trigger if the value is equal or lower than the Band limit and hits the Momentum parameter.


Exit

1) ATR Trailing Stop (Parameter)- ATR Per. 3-21 Days, and ATR Factor, 1.6 to 3.5 - This would need to be set in place on a 3 Min Intraday scale on the next bar after entry.
2) Time Based Parameter that will sell at market (1 day after entry to 20 days after entry)

I would also like to plot the entry and exits if possible, and have the Quote screen reflect the threshold of the entry and exits values.


I hope this helps and makes sense.




CODE:
Please log in to see this code.
profile picture

Eugene

#4
What do you mean by "3-min intraday scale", precisely? For both the entry and exit. You mix intraday with references to daily exit and it's not clear. What is the bar scale the system is applied to?


QUOTE:
2) If possible I would like to include a Momentum (12, Close) parameter based on a 3 Min Intraday scale.

Sure. It's so trivial and covered by so many examples that it doesn't require much explanation. See:

* WealthScript Programming Guide > DataSeries > Accessing a Single Value from a DataSeries
* Wiki for standard indicators: Momentum


QUOTE:
2) Time Based Parameter that will sell at market (1 day after entry to 20 days after entry)

This topic is becoming popular; I'm going to add it to the FAQ. Here's how:

Sell after X days

Or if your "3 minute" turns out to be a pure intraday thing, then exiting after N days in an intraday strategy is accomplished like this:

Building blocks of Intraday trading strategies


QUOTE:
1) ATR Trailing Stop (Parameter)- ATR Per. 3-21 Days, and ATR Factor, 1.6 to 3.5

You were already moving in the right direction with this; just don't insert an extra "atrStop":

CODE:
Please log in to see this code.
profile picture

mc3273

#5
Hi Eugene

I think the issue I am struggling with is the projection band strategy is set up as a daily scale strategy. The existing exit is to sell at Market next day (bar +1). I would like to insert an ATR Trailing stop parameter that will provide some intraday protection on the same day the security is bought. Usually after entry I how to manually watch a 1 DAY 3 Min chart with a Trailing stop. So I am confused as to how the strategy will go from a daily one to identify the entry, to an intraday to perform the Trailing stop.

Thanks
profile picture

Eugene

#6
Mark,

So you open a 3-minute chart, load 1 day of data, and what do you do with it -- precisely? Do you watch the intraday trailing stop based on ATRModified?

If you want to access an intraday indicator from a higher time frame, it's possible (Accessing Intraday data from Daily. If you want to update a Daily indicator (trailing level etc.) using intraday data, that's possible too - albeit with more effort (Updating a Daily indicator using Intraday values, ATR multiple time scales).
profile picture

mc3273

#7
Yes once a trade is entered I open a 3 min 1 day of data chart and create an alert on the Intraday trailing stop based on ATRModified. Based on your responses it looks like I am trying to Update a daily indicator using Intraday values.
profile picture

Cone

#8
One thing's for sure. If you need Wealth-Lab to trade on a 3-minute scale, then you need to use a 3-minute base time frame (chart). That means you have to rewrite the strategy to access Daily data from the 3-minute bars, or, you can pull in Daily data directly and synchronize it with the 3-minute chart.

As you'll see, writing code for intraday strategies adds complexity. For example, now that you're trading intraday with a daily indicator, the limit order has to be placed on each bar of the day. But, you have to make sure it trades only once per day. Also, this code will allow you to enter a position on the same day you exit. Another one. If you don't want that, you'll need to add even more code.

p.s. I removed the upper band since it is not used in the strategy.

CODE:
Please log in to see this code.