PureBytes Links
Trading Reference Links
|
Dave,
Try this code. There's an Parameter to show the price plot too.
// "Heatmap"
SetChartOptions(1,chartShowDates);
_SECTION_BEGIN("Price Chart");
if (ParamToggle("Show Price Chart?","No|Yes",1))
{
Plot(C,Name(),colorBlack,styleCandle|styleLeftAxisScale);
}
_SECTION_END();
numbars = LastValue(Cum(Status("barvisible"))); //count of number of
bars in view - the zoom factor so to speak
barvisible = Status("barvisible");
FVB = ValueWhen(barvisible AND Ref(barvisible,1),BarIndex(),1) -
numbars;
if(numbars > 50) shift = 0.04; else if (numbars > 25) shift = 0.06; else
shift = 0.12; //keeps the text more or less in place at various zoom
factors
barOffset = LastValue(FVB) + shift * numbars;
_SECTION_BEGIN("RSI Color Bar");
RSIColor = IIf( RSI(14) > 70, colorRed, IIf( RSI(14) < 30, colorGreen,
colorYellow));
Plot( 10, "", RSIColor, styleArea|styleOwnScale|styleNoLabel, 0, 100);
Plot( 11,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("RSI-14", barOffset , 41.00, colorBlack);
_SECTION_END();
_SECTION_BEGIN("MACD Color Bar");
m = MACD();
s = Signal();
MACDColor = IIf( m > s, colorGreen, colorRed);
Plot( 20, "", MACDColor, styleArea|styleOwnScale|styleNoLabel, 0, 100);
Plot( 21,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("MACD", barOffset , 41.05, colorBlack);
_SECTION_END();
_SECTION_BEGIN("21 Day RangeColor Bar");
H21 = HHV(H,21);
// Highest High over last 21 days
L21 = LLV(Low,21);
// Lowest Low over last 21 days
P21DR = ( (Close - L21) / (H21 - L21) ) * 100;
// Calculate where the close is in relation to this 21 day range
R21 = (255 - ( (P21DR/100)*255 ) );
// Red Color component
G21 = (P21DR/100)*255;
// Green Color component
Plot( 30, "", ColorRGB(R21,G21,0), styleArea|styleOwnScale|styleNoLabel,
0, 100);
Plot( 31,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("21 Day Range", barOffset , 41.09, colorBlack);
_SECTION_END();
_SECTION_BEGIN("250 Day RangeColor Bar");
HH250 = HHV(H,250);
// Highest High over last 250 days
LL250 = LLV(L,250);
// Lowest Low over last 250 days
P250DR = ( (Close - LL250) / (HH250 - LL250) ) * 100;
// Calculate where the close is in relation to this 250 day range
R250 = (255 - ( (P250DR/100)*255 ) );
// Red Color component
G250 = (P250DR/100)*255;
// Green Color component
Plot( 40, "", ColorRGB(R250,G250,0),
styleArea|styleOwnScale|styleNoLabel,0, 100);
Plot( 41,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("250 Day Range", barOffset , 41.1325, colorBlack);
_SECTION_END();
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of MarketMonk777
Sent: Tuesday, July 25, 2006 20:36
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Multi Row Colored Ribbons
Hi Bill,
I was very excited to see your code but probably due to my inexperience
I was unable to insert it into my code and get it to work.
Basically, I was trying to give each ribbon a title and have that title
near the left edge of the chart. In order to do so, I would need to
know what that x bar number is.
I tried the code you supplied and all combinations of the offset
multiplier with no luck. The title was no where to be found on the
screen.
Dave
MM
_____
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of wavemechanic
Sent: Tuesday, July 25, 2006 7:20 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Re: Multi Row Colored Ribbons
Not sure what you are going after. Did you notice that the code posted
before lets the user position the label anywhere on the ribbon and it
will not scroll off.
barsInView = Status("firstvisiblebarindex") -
Status("lastvisiblebarindex");
barOffset = Param("Offset Bar", .99, 0, 1, .01);
textOffset = BarCount - (barOffset * barsInView);
Bill
----- Original Message -----
From: MarketMonk777 <mailto:dlittner@xxxxxxxxxxxxx>
To: amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, July 25, 2006 9:47 PM
Subject: RE: [amibroker] Re: Multi Row Colored Ribbons
Well I am so happy to have it as is. Imagine having 10 or more ribbons
in a single pane, the ability to have each labeled is outstanding. If
it should scroll off the screen oh well.
I like to say that I will help you figure it out but think it is a
little above my skills at the moment. For some reason it looks like it
gets painted once whereas the price or indicator values which are
already in an array get displayed as each new bar becomes visible.
Dave
MM
_____
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Terry
Sent: Tuesday, July 25, 2006 6:04 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Multi Row Colored Ribbons
It simply CUMs (Same as SUM, but without having to define how many bars
to Sum) the number of visible bars. Thus the left edge is barCount -
this value. I added 1 to that to keep it off the left edge.
I noticed it does not move when you scroll back in history. I'm working
on that problem.
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of MarketMonk777
Sent: Tuesday, July 25, 2006 15:25
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Multi Row Colored Ribbons
Thanks Terry, that did the trick. I would have never figured that out.
Now I am trying to understand the logic behind it.
Much appreciated.
Dave
MM
_____
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Terry
Sent: Tuesday, July 25, 2006 12:20 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Multi Row Colored Ribbons
Here is your code modified to always PlotText at the left edge of the
chart regardless of the zoom level.
SetChartOptions(1,chartShowDates);
numbars = LastValue(Cum(Status("barvisible")));
NumToStr(numbars ,1);
_SECTION_BEGIN("RSI Color Bar");
RSIColor = IIf( RSI(14) > 70, colorRed, IIf( RSI(14) < 30, colorGreen,
colorYellow));
Plot( 10, "", RSIColor, styleArea|styleOwnScale|styleNoLabel, 0, 100);
Plot( 11,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("RSI-14", BarCount - numbars + 1, 41.00, colorBlack);
_SECTION_END();
_SECTION_BEGIN("MACD Color Bar");
m = MACD();
s = Signal();
MACDColor = IIf( m > s, colorGreen, colorRed);
Plot( 20, "", MACDColor, styleArea|styleOwnScale|styleNoLabel, 0, 100);
Plot( 21,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("MACD", BarCount - numbars + 1, 41.05, colorBlack);
_SECTION_END();
_SECTION_BEGIN("21 Day RangeColor Bar");
H21 = HHV(H,21);
// Highest High over last 21 days
L21 = LLV(Low,21);
// Lowest Low over last 21 days
P21DR = ( (Close - L21) / (H21 - L21) ) * 100;
// Calculate where the close is in relation to this 21 day range
R21 = (255 - ( (P21DR/100)*255 ) );
// Red Color component
G21 = (P21DR/100)*255;
// Green Color component
Plot( 30, "", ColorRGB(R21,G21,0), styleArea|styleOwnScale|styleNoLabel,
0, 100);
Plot( 31,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("21Day Range", BarCount - numbars + 1, 41.09, colorBlack);
_SECTION_END();
_SECTION_BEGIN("250 Day RangeColor Bar");
HH250 = HHV(H,250);
// Highest High over last 250 days
LL250 = LLV(L,250);
// Lowest Low over last 250 days
P250DR = ( (Close - LL250) / (HH250 - LL250) ) * 100;
// Calculate where the close is in relation to this 250 day range
R250 = (255 - ( (P250DR/100)*255 ) );
// Red Color component
G250 = (P250DR/100)*255;
// Green Color component
Plot( 40, "", ColorRGB(R250,G250,0),
styleArea|styleOwnScale|styleNoLabel,0, 100);
Plot( 41,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("250 Day Range", BarCount - numbars + 1, 41.1325, colorBlack);
_SECTION_END();
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of MarketMonk777
Sent: Tuesday, July 25, 2006 09:36
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Multi Row Colored Ribbons
Hi Terry,
PlotText did give me some troubles as well. I had to "play" around with
the
numbers to get the ribbon row titles lined up properly. If you find a
way
to "automatically" or "programatically" place it in those locations,
please
do share the method with us.
Dave
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf
Of Terry
Sent: Tuesday, July 25, 2006 8:17 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Multi Row Colored Ribbons
Oops! PlotText IS there, it's just fixed farther left than my display
was
set to. Must be some way to find the visible bars and plot it there so
it's
always in the right place.
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf
Of MarketMonk777
Sent: Tuesday, July 25, 2006 08:41
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Multi Row Colored Ribbons
Hi Terry,
No I have not posted the code yet so here it is:
Btw - I found that it works by having each ribbon as it's own section
_SECTION_BEGIN("RSI Color Bar");
RSIColor = IIf( RSI(14) > 70, colorRed, IIf( RSI(14) < 30, colorGreen,
colorYellow)); Plot( 10, "", RSIColor,
styleArea|styleOwnScale|styleNoLabel,
0, 100); Plot( 11,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0,
100
); PlotText("RSI-14", BarCount-157, 41.00, colorBlack); _SECTION_END();
_SECTION_BEGIN("MACD Color Bar");
m = MACD();
s = Signal();
MACDColor = IIf( m > s, colorGreen, colorRed); Plot( 20, "", MACDColor,
styleArea|styleOwnScale|styleNoLabel, 0, 100); Plot(
21,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("MACD", BarCount-157, 41.05, colorBlack); _SECTION_END();
_SECTION_BEGIN("21 Day RangeColor Bar");
H21 = HHV(H,21);
// Highest High over last 21 days
L21 = LLV(Low,21);
// Lowest Low over last 21 days
P21DR = ( (Close - L21) / (H21 - L21) ) * 100;
// Calculate where the close is in relation to this 21 day range
R21 = (255 - ( (P21DR/100)*255 ) );
// Red Color component
G21 = (P21DR/100)*255;
// Green Color component
Plot( 30, "", ColorRGB(R21,G21,0), styleArea|styleOwnScale|styleNoLabel,
0,
100);
Plot( 31,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("21Day Range", BarCount-157, 41.09, colorBlack);
_SECTION_END();
_SECTION_BEGIN("250 Day RangeColor Bar");
HH250 = HHV(H,250);
// Highest High over last 250 days
LL250 = LLV(L,250);
// Lowest Low over last 250 days
P250DR = ( (Close - LL250) / (HH250 - LL250) ) * 100;
// Calculate where the close is in relation to this 250 day range
R250 = (255 - ( (P250DR/100)*255 ) );
// Red Color component
G250 = (P250DR/100)*255;
// Green Color component
Plot( 40, "", ColorRGB(R250,G250,0),
styleArea|styleOwnScale|styleNoLabel,
0, 100);
Plot( 41,"",colorBlack,styleOwnScale|styleArea|styleNoLabel,0, 100 );
PlotText("250 Day Range", BarCount-157, 41.1325, colorBlack);
_SECTION_END();
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf
Of Terry
Sent: Tuesday, July 25, 2006 7:29 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Multi Row Colored Ribbons
Cool chart, even if it doesn't have application :-) Did you post the
final
code that creates this? I must've missed it.
Thanks.
--
Terry
--- In amibroker@xxxxxxxxxxxxxxx, "MarketMonk777" <dlittner@xxx> wrote:
>
> This is purely experimental and may turn out to be a waste of time.
> Your idea has merit and will file it away should I ever go so far
> as converting any of them to "buy" signals.
> > Long_color = up; //"up" is your variable.
> > Short_color = down; //daown is your variable too.
> > dynamic_color = IIf(Long_color, colorGreen , IIf(Short_color,
> colorRed ,
> > colorBlue)) ;
> >
> > Plot( MACD() , "MACD" , dynamic_color , ParamStyle ("Style" ,
> > styleNoLabel| styleThick ) );
------------------------ Yahoo! Groups Sponsor --------------------~-->
GFT
Forex Trading Accounts As low as $250 with up to 400:1 Leverage. Free
Demo.
http://us.click.yahoo.com/lpv1TA/jlQNAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to SUPPORT
{at}
amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
http://groups.yahoo.com/group/amibroker/
amibroker-unsubscribe@xxxxxxxxxxxxxxx
http://docs.yahoo.com/info/terms/
_____
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.4/396 - Release Date: 07/24/06
|