Breakout from consolidation above Bollinger Band
Author: steve999
Creation Date: 12/26/2015 6:25 AM
profile picture

steve999

#1
Hey all you smart ones, yea I am new to WL and not a programmer.

What I need is an algo I'd like to use on high beta stocks, even nugt, it's inverse and vxx, xiv,and edz, and possibly others.

It goes like this.

It operates on the 30 minute candle period.

It's looking for a breakout from consolidation to buy in requiring 3 things:

1) price action break out up above the 30 min bol band (20, 1.5)
and
2) 30 min adx above 16
and
3) 30 min adx increasing

It sells 70% of the shares on share price action lower than Eavg 10.
It sells the remaining 30% of shares when it breaks the mid bol band line

Anyone have this guy already built or can put it together/
Thank you very much.
Steve

profile picture

Eugene

#2
QUOTE:

It operates on the 30 minute candle period.

It's looking for a breakout from consolidation to buy in requiring 3 things:

1) price action break out up above the 30 min bol band (20, 1.5)
and
2) 30 min adx above 16
and
3) 30 min adx increasing

It sells 70% of the shares on share price action lower than Eavg 10.
It sells the remaining 30% of shares when it breaks the mid bol band line


Here you go. Create a 30-min DataSet, update it, and run the strategy code:

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

steve999

#3
Geesh.
You're good.
Many thanks Eugene.


By the way, what is the best performing code you are aware of?


Could be wrong, but it's looking like it's selling on an ema of 20, not ema10.

And at first glance, I am not seeing where to edit.
TY.
profile picture

Eugene

#4
QUOTE:
Could be wrong, but it's looking like it's selling on an ema of 20, not ema10.

You're right. Code above has been edited.

QUOTE:
By the way, what is the best performing code you are aware of?

See my response in this thread re: Strategy Ranking - an undervalued but very useful tool:

What is the best indicator of entry?

profile picture

steve999

#5
One last request, you have been fantastic.
Could you add the condition that the ADX be above its own 9ema.
Many thanks.
profile picture

Eugene

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

steve999

#7
Sorry, would you insert this code.
I am just getting errors.
ty

Think I have to declare the new ema 9 on the adx var first.
Anyway, not getting it to work.
TY
profile picture

Eugene

#8
No problem. Here's it:

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

steve999

#9
TY
Not sure why the ADX ema9 line does not plot here???
profile picture

steve999

#10
So you have been fantastic, Eugene.
And I, a total pain in the rear.
So close here, very much would like to see the ema9 of the ADX plotted with it as well.

I can then tinker with fine tuning the parameters.
Many thanks.
Steve
profile picture

Eugene

#11
As constant modifications of code are not covered by our support policy, let's make understanding this building block a DIY excercise for you. To become able to tweak the parameters you have to start somewhere so this is a good opportunity.

To plot EMA of ADX you may define it at first (as I did with EMA, SMA and ADX) and then plot. But an alternative tactics is even simpler for a newbie - you'd need just one line of code to plot it on-the-fly. 'Extract' the EMA of ADX from my boolean condition in post #6...
CODE:
Please log in to see this code.

...then insert it into a new PlotSeries statement. You have several examples of that in post #8:
CODE:
Please log in to see this code.


For more information refer to:

1. QuickRef (strike F11) > PlotSeries
2. Help menu > WealthScript Programming Guide > Indicators, also "Series Method".

This is not nearly rocket science so I do expect that you learn this quickly on your own.
profile picture

steve999

#12
Excellent.
Got it to plot.
Thank you.
profile picture

Eugene

#13
steve999 asked elsewhere:

I have been out of the country for a number of months and have lost touch with the programming here. Been beating my head against the wall.

I have a strategy that I want to work with 30 min candles (It currently appears to work on dailies).

It triggers a buy when the ADX crosses up over a value of 21 AND the price exceeds the 1.5 Standard Deviation bollinger band.

I think it should sell 70% when the price falls below the 8 ema and the remaining 30% when the price fall below the 12 ema though this needs a touch up as well.

The big problem is that it works on (and plots) from the daily setting, not 30 minutes.

Can one of you experts inform me how -- or else convert -- to 30 minutes for me.

Much appreciated.
Steve

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

Eugene

#14
No problem and nothing to convert here. Code runs perfectly. "Create a 30-min DataSet, update it, and execute" - my advice in post #2 still applies.
profile picture

steve999

#15
Sorry Eugene,
I compile and run this -- and get a daily chart and analysis.
What am I doing wrong?
TY.
profile picture

steve999

#16
I get it.
Sorry and many thanks Eugene!
Steve