![]() |
3-bar breakouts |
Post Reply
|
Page 123> |
| Author | |
peter1
Regular
Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options
Quote Reply
Topic: 3-bar breakoutsPosted: 12 Nov 2008 at 1:30pm |
|
I have been trying to learn a little Bullscript by creating a simple buy/sell indicator. ---------------------
My next task is to create a ribbon based on this indicator. The plan is to display this ribbon using a higher timeframe than the timeframe of the chart. eg I want to look for the buy signals on a weekly chart when the last signal in the monthly ribbon was a buy. I know how to mange the timeframe in the ribbons using the advanced menu tab.
There is a similar issue with the ribbon in that the displayed colors default to white when a signal has not occured (inside bars). This creates a tricolored ribbon instead of a bicoloured ribbon and looks unclear. Would someone like to suggest any ideas to fix this please.
Edited by peter1 - 12 Nov 2008 at 1:32pm |
|
![]() |
|
rcameron
Moderator Group
Joined: 04 Aug 2008 Posts: 21 |
Post Options
Quote Reply
Posted: 21 Nov 2008 at 6:48pm |
|
If you don't want to show the markers just double click on the markers on the chart and under Style de-select the marker icon. It can be turned on again by selecting the indicator in the header of the chart and selecting the marker icon again. This will hide all markers but I think you want to selectively only show the most recent markers, sorry can't help on this one. What about changing the size of the marker under 'Style' to de-clutter?
When coding the ribbon set a colour to reflect the satisfaction of the criteria, say [color=green] when the breakout occurs and then add [color=red] at the end of the code to define the default colour. I think my example below should help.
[color =green; name=Bullish][fillstyle =solid]value1-value2>=0; [color =red; name=Bearish][fillstyle =solid]value1-value2<0; [color =red] |
|
![]() |
|
maximo
BullCharts Guru
Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options
Quote Reply
Posted: 25 Nov 2008 at 2:03pm |
|
Hi Peter,
If you just want to display the lastest signal/marker? you can use Lastvalue(Barnumber) function to return the current barnumber and get your script to only check for your criteria on the most recent bar or a few bars from the recent bar, so previous signals will disappear as the chart updates while any new one will be displayed.
Here's a Trend Ribbon which only colours long or short. You can adapt it to your signal.
{ Momentum Trend Ribbon } [target =Ribbon]MBO:= Ma(C,25,S) - Ma(C,200,S);{ Trend detection based on new Highs & Lows of Momentum Oscillator } Condition1:= hhv(MBO,89) > ref(hhv(MBO,89),-1) or llv(MBO,89) > ref(llv(MBO,89),-1);Condition2:= llv(MBO,89) < ref(llv(MBO,89),-1) or hhv(MBO,89) < ref(hhv(MBO,89),-1);Signal:= If(Condition1 = True, 1,If(Condition2 = True, -1, prev));[color =rgb(98,217,98)] Signal=1[color =rgb(226,118,118)] Signal=-1Edited by maximo - 25 Nov 2008 at 3:57pm |
|
![]() |
|
peter1
Regular
Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options
Quote Reply
Posted: 26 Nov 2008 at 3:57pm |
|
Thanks for replying.
My first query was how to make the redundant signals invisible. You can see the redundant signals in the chart. [ I think I might have posted an image!]
![]() |
|
![]() |
|
peter1
Regular
Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options
Quote Reply
Posted: 26 Nov 2008 at 4:35pm |
|
Maximo (you legend), your suggestions worked a treat.
Here is the ribbon with the indicator.
![]() |
|
![]() |
|
maximo
BullCharts Guru
Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options
Quote Reply
Posted: 27 Nov 2008 at 12:38am |
|
Aha! now remove the redundant signals. It was on my to do list for a while.. Increase breakout period for fewer trades & generally larger trends.
[Description="Breakout Signals"] [Target=Price] n := input("Breakout period",3,0);SignalLong := if(High > hist(HHV(H,n),1),1,0);SignalShort := if(Low < hist(LLV(L,n),1),1,0);SigLong := if(SignalLong,1,if(SignalShort,0,prev));SigShort := if(SignalShort,1,if(SignalLong,0,prev));[linestyle =marker; marker=long; name=""]If (SigLong and SigLong <> hist(SigLong,1),1,0);[linestyle =marker; marker=short; name=""]If (SigShort and SigShort <> hist(SigShort,1),1,0);Edited by maximo - 27 Nov 2008 at 12:49am |
|
![]() |
|
peter1
Regular
Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options
Quote Reply
Posted: 27 Nov 2008 at 11:36am |
|
Maximo - well done.
Here are the results of your code (unaltered).
![]() |
|
![]() |
|
peter1
Regular
Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options
Quote Reply
Posted: 27 Nov 2008 at 11:49am |
|
"Increase breakout period for fewer trades & generally larger trends."
A good observation and a valid suggestion. This technique works best in a trending instrument. You should see the signals on the crude oil chart. Forex works well also.
Stocks require additional filters, index trend filter, stock trend filter, volatility filters etc.
Next difficulty and it deals with the chart timeframes.
I can get set this ribbon to weekly and change the chart to daily. No problem. The idea is to take the daily setups that are in sync with the weekly signals.
I am unable to set the ribbon to monthly and view the weekly chart with the monthly ribbon. The ribbon changes to weekly and ignores the convert to monthly command. Is this me or a Bullcharts problem?
|
|
![]() |
|
peter1
Regular
Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options
Quote Reply
Posted: 27 Nov 2008 at 12:02pm |
|
For those interested, here are the signals on the crude oil weekly chart.
![]() |
|
![]() |
|
peter1
Regular
Joined: 27 Aug 2008 Location: Sydney Posts: 56 |
Post Options
Quote Reply
Posted: 27 Nov 2008 at 12:13pm |
|
It just occured to me that the inability to see the monthly ribbon on a weekly chart may be due to a conflict with the dates. A monthly timeframe can start /end within a weekly period and this might cause a conflict within Bullcharts.
|
|
![]() |
|
Post Reply
|
Page 123> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |