PureBytes Links
Trading Reference Links
|
Yes you can use PlotText. Note, it is EXTREMELY slow so don't use too
many. (I have already provided an example to AB Support.)
Here is code that was being discussed here just a week or two ago. I
believe the topic was multi-color lines or similar. You will find the
PlotText commands near the top and inside a precedure (which is
certainly not required to use PlotText):
SetBarsRequired( 10000, 0 ); //Oddly the text disappears if I comment
out this line. TLH
Count = 0;
GraphXSpace = 0;
Title = "";
SetChartOptions(0,chartShowDates);
procedure ribbon( Caption, Color )
{
firstbar = Status( "firstvisiblebarindex" );
lastbar = Status( "lastvisiblebarindex" );
xOffset = ( lastbar - firstbar ) / 100;
yOffset = 0.6;
y2 = ++Count;
y1 = y2 - 1;
Plot( y2, "", colorBlack, styleLine | styleNoLabel );
Plot( 0, "", colorBlack, styleNoDraw | styleNoLabel );
Plot( y2, "", Color, styleArea | styleNoLabel );
PlotText( Caption, firstbar + xOffset, y2 - yOffset, colorBlack );
}
//Plots that go on top of ribbons. Must use styleOwnScale or
LeftAxisScale
Plot(C,Name(),1,styleCandle | styleOwnScale );
/********************************** RIBBONS
***********************************/
//RSI Ribbon
colorRSI = IIf( RSI() > 70, colorRed, IIf( RSI() < 30, colorGreen,
colorYellow ) );
ribbon( "RSI-14", colorRSI );
//MACD Ribbon
colorMACD = IIf( MACD() > Signal(), colorGreen, colorRed );
ribbon( "MACD", colorMACD );
//14 Day CCI Ribbon
myCCI = CCI(14);
rangeCCI = ( (myCCI - LLV(myCCI,14)) / (HHV(myCCI,14) - LLV(myCCI,14)) )
* 100; // Calculate where the close is in relation to this 21 day
range
RCCI = (255 - ( (rangeCCI / 100) * 255 ) );
// Red Color component
GCCI = (rangeCCI / 100) * 255;
ribbon( "CCI-14", ColorRGB(RCCI ,GCCI ,0));
//21 Day Range Ribbon
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
ribbon( "21 Day Range", ColorRGB(R21,G21,0));
//250 Day Range Ribbon
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
ribbon( "250 Day Range", ColorRGB(R250,G250,0));
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Mr. Valley
Sent: Tuesday, August 22, 2006 00:30
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Locking Right Axis and styleLeftAxisScale for
Text Display?
Terry,
Thanks, Each of the values are at the top of the screen, rather than
down the left side.
Can I use PlotText() to plot the value left justifed on the visible
screen on each line?
Do you know how to use PlotText()? I can't but one example. MV
GraphXSpace = 20;
Plot(Close,"Close",1,1);
Plot(LastValue(H,89),"89HIGH",colorRose,1 );
Plot(LastValue(L,89),"89LOW",colorPaleGreen,1 );
Plot(Close,"Close",1,1 | styleLeftAxisScale ); // Close added to Left
Axis to set Default scale the same as right axis
Plot(LastValue(H,89),"89HIGH",4,1 | styleLeftAxisScale );
Plot(LastValue(L,89),"89LOW",5,1| styleLeftAxisScale );
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On
Behalf Of Terry
Sent: Monday, August 21, 2006 7:35 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Locking Right Axis and styleLeftAxisScale for
Text Display?
MV,
First comment, if you just want lines you can simply do this:
Plot(89,"89HIGH",colorRose );
Or this:
PlotGrid(89,colorRose );
Second, I have many StyleLeftAxisScale plots and I have never seen a
left side scale shown. Might be me.
Third, StyleLeftAxisScale is to show a plot that fills the full screen,
but has drastically different values than the plots that do not use
StyleLeftAxisScale or StyleOwnScale. The actual scale is determined by
the min/max values of whatever you put on that screen. With
StyleOwnScale you can force a range like this:
Plot(89,"89HIGH",colorRose, StyleOwnScale, 0, 100 );
This means the scale is FIXED from 0 to 100. If you plot values larger
or smaller than those, they simply go "off chart".
There is no such adjustment for StyleLeftAxisScale. You could use the
above, but then the whole point is moot if there is no "left scale"
anyway, right?
I have seen some exotic code from Fred in Fred's Equity Line where he
computes his own min/max values. I believe this code is posted in the
Library.
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Mr. Valley
Sent: Monday, August 21, 2006 07:16
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Locking Right Axis and styleLeftAxisScale for
Text Display?
Terry,
Thanks for the reply, let me rephrase...
Using ...
GraphXSpace = 20;
Plot(Close,"Close",1,1);
Plot(LastValue(H,89),"89HIGH",colorRose,1 );
Plot(LastValue(L,89),"89LOW",colorPaleGreen,1 );
Plot(LastValue(H,89),"89HIGH",4,1 | styleLeftAxisScale );
Plot(LastValue(L,89),"89LOW",5,1| styleLeftAxisScale );
1.)How do I plot the values on the left side of the screen "at the line
level" so when the line moves up and down, so does the test as well?
Since both of these values plotted are identical, the "lines" themselves
should be on top of one another, so I figure the scaling is independent.
I didn't want to plot the Values in the Title line, I just wanted to
plot the Values on the line on the left side of the screen.
2.)Why don't both lines overlap if the default scaling is the same and
the values are the same?
3.)Is there a way to link the scaling of the Right and Left Axis?
Thanks,
MV
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On
Behalf Of Terry
Sent: Sunday, August 20, 2006 7:46 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Locking Right Axis and styleLeftAxisScale for
Text Display?
I don't understand your entire question, however:
StyleLeftAxisScale is a way to give you an independent scale when you
have a plot that is in an entirely different range than your regular
plot. Example, SRSI (0 to 1) with Price on normal right axis. If you
want the scale to be the same, just plot them both on the regular axis!
StyleOwnScale was added more recently as a more flexible way to control
plot scale. I still use both methods for alternate scale plots.
What I don't follow is "left justified text at the line level". "\n" is
a line break and the text following is printed on the NEXT line and is
left justified. Send a screen shot or something to show what is wrong
and what you want. There is no difference in title plot titles whether
or not you use any of the alternate scaling styles.
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of Mr. Valley
Sent: Sunday, August 20, 2006 19:55
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Locking Right Axis and styleLeftAxisScale for Text
Display?
All,
1.) How do you plot Text Left Justified at the Line Level using
styleLeftAxisScale not at the Title Level and the use of \n doesn't do
it.
Apparently the default scale for the styleLeftAxisScale is the
RightAxisScale until an individual StyleOwnScale is used.
2.) Is there a handy way Plot LeftJustified text at the line level using
only the RightAxisScale as well?
3.) Is there such a thing as SetChartOptions to lock the
styleLeftAxisScale to the same scale as the current RightAxis
automatically?
Thanks in advance.
MV
example for ^DJI symbol
/* styleLeftAxisScale Plot */
Plot(Close,"Close",1,1);
Plot(11380,"11380 Text Inserted Here to be at the line level left
justified",10,1 | styleLeftAxisScale);
|