PureBytes Links
Trading Reference Links
|
<SPAN
class=920520815-11042003>Rakesh,
<SPAN
class=920520815-11042003>
at a
quick (very quick) glance I see a couple of things. First your use of = in the
top section is wrong. = assigns variables while == (double equal sign) means
"Equal to" in AFL. Actually since what you are really after is the condition
being either true or false you could eliminate the == all together. Your
condition , by definition, is either True (1) or False (0).
<SPAN
class=920520815-11042003>
to
eliminate the multiple signals you should use the Exrem function. for further
explanation you could check the help files for Operators and for exrem.
Try......
<SPAN
class=920520815-11042003>
<FONT
color=#0000ff size=2>
Plot(<FONT color=#0000ff
size=2>ADX(),<FONT color=#ff00ff
size=2>"ADX",<FONT color=#000000
size=2>colorWhite,<FONT
color=#ff00ff size=2>1);
Plot(<FONT
size=2>PDI(),"PDI"<FONT
size=2>,colorBrightGreen<FONT
size=2>,1<FONT
color=#0000ff>);
Plot(<FONT
size=2>MDI(),"MDI"<FONT
size=2>,colorRed,<FONT
size=2>1);
BSC1=MDI() > <FONT
size=2>PDI() <FONT
size=2>AND Cross<FONT
size=2>(ADX(),<FONT
size=2>MDI());
BSC1B= Cross(<FONT
size=2>C,<FONT
size=2>ValueWhen(BSC1,<FONT
size=2>H,1<FONT color=#282828
size=2>));
BSC1S= Cross(<FONT
size=2>ValueWhen(BSC1,<FONT
size=2>L,1<FONT
size=2>), C<FONT
color=#0000ff>);
BSC2=PDI()><FONT
size=2>MDI() <FONT
size=2>AND Cross<FONT
size=2>(ADX(),<FONT
size=2>PDI())
;
BSC2B= Cross(<FONT
size=2>C,<FONT
size=2>ValueWhen(BSC2,<FONT
size=2>H,1<FONT color=#282828
size=2>));
BSC2S= Cross(<FONT
size=2>ValueWhen(BSC2,<FONT
size=2>L,1<FONT
size=2>), C<FONT
color=#0000ff>);
BC1= Cross(<FONT
size=2>PDI(),MDI<FONT
color=#282828 size=2>());
BC11= Cross(<FONT
size=2>C,<FONT
size=2>ValueWhen(BC1,<FONT
size=2>H,1<FONT color=#282828
size=2>));
SC1=Cross(<FONT
size=2>MDI(),PDI<FONT
color=#282828 size=2>());
SC11= Cross(<FONT
size=2>ValueWhen(SC1,<FONT
size=2>L,1<FONT
size=2>), C<FONT
color=#0000ff>);
Buy= BSC1B <FONT
size=2>OR BSC2B <FONT
size=2>OR BC1
;
Sell=BSC1S <FONT
size=2>OR BSC2S <FONT
size=2>OR
SC1;
Buy=<FONT
size=2>ExRem(Buy<FONT
size=2>,Sell<FONT
color=#0000ff>);<FONT
color=#0000ff>
Sell=ExRem<FONT
size=2>(Sell,<FONT
size=2>Buy<FONT
color=#0000ff>);
PlotShapes(<FONT
size=2>IIf(Buy<FONT
size=2>,shapeUpArrow<FONT
size=2>,shapeNone<FONT color=#282828
size=2>)
,colorBrightGreen<FONT
color=#282828 size=2>);
PlotShapes(<FONT
size=2>IIf(Sell<FONT
size=2>,shapeDownArrow<FONT
size=2>,shapeNone<FONT
size=2>),colorRed<FONT color=#282828
size=2>);
Jayson
<FONT face=Tahoma
size=2>-----Original Message-----From: Rakesh Sahgal
[mailto:rakeshsahgal@xxxxxxxxx]Sent: Friday, April 11, 2003 2:06
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] AFL
QuestionI had approached the group on this subject
earlier onalso. Basically I am trying to set up trade initiationtriggers
based up on the interplay of the ADX, PDI andthe DMI.This is part is
not ambiguous.The conditions are asfollows:Buy condition - PDI
crossing over MDI.Validation - First close above the high of
thecrossover day subsequent to the crossover.Sell condition -
MDI crossing over PDI.Validation - First close below the low of
thecrossover day subsequent to the crossover.Now the part where
ambiguity comes in.1. PDI is greater than MDI. ADX rises above PDI.
Thiscan act as a trigger point for both further upside ortermination of
present rise. The validation pointsbeing (a) close above the high of the
crossover dayfor upmove and (b) close below the low of thecrossover day
for end of upmove.2. MDI is greater than PDI. ADX rises obove MDI.
Thisagain can act as a trigger point for both furtherdownisde or
termination of present fall. Thevalidation points being (a) close above the
high ofthe crossover day for end of downmove and (b) closebelow the low
of the crossover day for furtherdownmove.The conditions here are
fairly simple and I think Ihave been able to correctly put them into AFL
code. Iam appending below the code for verification. I willappreciate if
one of the experts on the group couldplease take the time and give it a
glance.Secondly - This is where I am completly at a loss forideas. I
want the buy/sell arrows ONLY on the firstday of the validation triggers.
What I am getting isbuy and sell arrows every day all over the
chart.Is my coding aboslutely wrong ? What is it that I amnot doing
right here?I hope someone will please help me out on this one.Thanks
in advanceRakesh--------AFL
CODE--------Plot(ADX(),"ADX",colorWhite,1);Plot(PDI(),"PDI",colorBrightGreen,1);Plot(MDI(),"MDI",colorRed,1);BSC1=MDI()
> PDI() AND Cross(ADX(),MDI()); BSC1B=
Cross(C,ValueWhen(BSC1=1,H,1));BSC1S= Cross(ValueWhen(BSC1=1,L,1),
C);BSC2=PDI()>MDI() AND Cross(ADX(),PDI()) ;BSC2B=
Cross(C,ValueWhen(BSC2=1,H,1));BSC2S= Cross(ValueWhen(BSC2=1,L,1),
C);BC1= Cross(PDI(),MDI());BC11=
Cross(C,ValueWhen(BC1=1,H,1));SC1=Cross(MDI(),PDI());SC11=
Cross(ValueWhen(SC1=1,L,1), C);Buy= BSC1B==1 OR BSC2B==1 OR BC1==1
;Sell=BSC1S==1 OR BSC2S=1 OR
SC1==1;PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBrightGreen);PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed);__________________________________________________Do
you Yahoo!?Yahoo! Tax Center - File online, calculators, forms, and
morehttp://tax.yahoo.comSend
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|