PureBytes Links
Trading Reference Links
|
I am trying to figure out how I can get this excellent script to draw box sizes based on Investors Intelligence's standards. My thinking is I could covert the "1" in:
if( scaling ==
"Traditional") Box =
Param(
"Box",
1,
0.2,
10,
0.1);
to a variable called "boxsize" and do something like this:
if( Close < 5) boxsize = 0.10; else if( Close >=5 AND Close < 10) boxsize =
0.20; else if( Close >=10 AND Close < 20) boxsize = 0.50; else if( Close >=20 AND Close < 100) boxsize = 1.00; else if( Close >=100 AND Close < 200) boxsize = 2.00; else
if( Close >=200 AND Close < 500) boxsize = 5.00; else if( Close >=500 AND Close < 1000) boxsize = 10.00; else if( Close >=1000 AND Close < 2000) boxsize = 20.00; else if( Close >=2000 AND Close < 5000) boxsize =
50.00;
This is giving me an Error 6, telling me the IF statement has to be numeric or boolean, that I can not use array here, please use array subscript operator to access array elements. I read up on array subscript operators and do not understand it enough. Can someone guide me on how to write this correctly? Will my approach work? Any help much appreciated.
On 4/25/07, Don Lindberg <dlindber@xxxxxxxxxxxxx> wrote:
Horray!!!! That did it !! Turning Plot
Grid to NO and Clicking on the chat gives me the values. Thanks to all who
helped solve this problem!
Don Lindberg
From: amibroker@xxxxxxxxx
ps.com [mailto:amibroker@xxxxxxxxx
ps.com] On Behalf Of Amon Ra
Sent: Wednesday, April 25, 2007
2:09 AM
To: amibroker@xxxxxxxxxps.com
Subject: RE: [AmiBroker] Re:
Identifying Pnf Patterns
You must click on the chart and the grids will apeared
Don Lindberg
<dlindber@xxxxxxxxxxxxx> wrote:
And here is the Code I am
using:
_SECTION_BEGIN
("Point
& Figure w Values adj");
SetChartBkColor
(ParamColor
("BackGroundColor"
, colorLightYellow));
GraphColor =
ParamColor(
"GarphColor",colorBlack);
GridColor =
ParamColor(
"GridColor", colorBlack);
Scaling =
ParamList(
"Scaling
Method",
"Traditional|Percentage|AVG
True
Range");
if
( scaling == "Traditional"
) Box = Param
("Box"
, 1
, 0.2
, 10
, 0.1
);
if
( scaling == "Percentage"
) Box = Param! < /font>
("Box "
, 1
, 0.2
, 10
, 0.1
)/100
* LastValue
(C);
if
( scaling == "AVG
True Range") Box =
Param(
"Box",
1,
0.3,
5,
0.1) *
LastValue(
ATR (
20));
Reverse =
Param(
"Reverse",
3,
1,
5);
PFL[
0] = Box *
ceil
(Low[0
]/Box) +
Box;
PFH[
0] = Box *
floor
(High[0
]/Box);
for
( i = 1
; i < BarCount; i++ )
if
(Low[i] <= PFL[j]
- Box)
PFL[j] = Box *
ceil(Low[i]/Box);
if
(High[i] >= PFL[j]
+ Reverse*Box)
PFH[j] = Box *
floor(High[i]/Box);
PFL[j] = PFL[j -
1] + Box;
if
(High[i] >= PFH[j]
+ Box)
PFH[j] = Box *
floor(High[i]/Box);
if
( Low[i] <= PFH[j]
- Reverse * Box )
PFH[j] = PFH[j -
1] - Box;
PFL[j] = Box *
ceil(Low[i]/Box);
delta = BarCount - j
-1
;
direction =
Ref(direction,
- delta);
Hi = Ref
(PFH, -delta) + Box/
2;
Lo = Ref(PFL, -delta)- Box/
2;
Cl = IIf
(direction ==
1, Hi, Lo);
Op = IIf
(direction ==
1, Cl - Box, Cl + Box);
PlotOHLC
(Op, Hi, Lo, Cl,""
, GraphColor , stylePointAndFigure|styleNoLabel, 0,
0 ,shiftChart);
Last =
Ref(
LastValue(C), -(BarCount
-1
));
Plot( Last,
""
, colorRed,styleNoLine|styleDots,
0 ,
0, shiftLastClose);
Value=
IIf(direction>0,
SelectedValue(Hi)-box/
2,
SelectedValue(Lo)+box/
2);
//-----------------------------------------------------------------------
//----------------------------------------------------------------------
PlotGridLines =
ParamToggle(
"PlotdGrid",
"Yes! |No",
0) ;
begin =
SelectedValue(
BarIndex());
end = LastValue
(
BarIndex());
per! iod = en d-begin +
1;
ScreenHigh =
LastValue(
HHV(cl, period ));
ScreenLow =
LastValue(
LLV( Cl, period) );
top= LineArray
( begin-shiftGrid, screenHigh,
end, screenhigh, 0
, 1
);
Bot= LineArray
( begin-shiftGrid, screenlow,
end, screenLow, 0
, 1
);
Plot( top,
""
, gridColor,styleLine|styleNoLabel
, 0
, 0
,shiftGrid);
Plot( bot,
""
, gridColor,styleLine|styleNoLabel,
0
, 0
, shiftGrid);
VerticalGrid =
IIf (
BarIndex() >= begin,
IIf(direction==
1, screenHigh, screenLow), Null);
Plot
(VerticalGrid, ""
, gridColor, styleStaircase|styleNoLabel,
0,
0,
1);
for ( n=
LastValue(bot); n<
LastValue(top) -
0.5*box; n =
n+box)
Plot
(
bot , ""
, gridColor, styleLine|styleNoLabel,
0
, 0
,shiftGrid);
text =
NumToStr(
LastValue(bot) +
0.5*box, format);
xposition = BarCount+shiftPriceaxis;
yPosition =
LastValue(bot)+
0.27*box;
PlotText
(text,
xPosition , yPosition, colorGreen);
//---------------------------------------------------------------------
//----------------------------------------------------------------------
" Instrument : "
+ Name
() + FullName()+"\n
" +
"Formula : "
+ "
Point & Figure (High/Low Range)" +
"\n " +
"Box : "
+ NumToStr
(Box, 4.4
) + "
" +
"Reverse : "
+ NumToStr
(Reverse, 2.0
) + "\n "
+
"ATR : "
+ WriteVal
(LastValue
(ATR
(100
)), format = 4.4
);
From:
amibroker@xxxxxxxxxps.com [mailto:amibroker@xxxxxxxxx
ps.com] On Behalf Of apfxtrader
Sent: Wednesday, April 25, 2007
12:16 AM
To: amibroker@xxxxxxxxxps.com
Subject: [amibroker] Re:
Identifying Pnf Patterns
Don,
Can you show a picture of what you have
-- Gary Nielson
__._,_.___
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
__,_._,___
|