PureBytes Links
Trading Reference Links
|
<SPAN
class=861490703-12042003>Rakesh,
<SPAN
class=861490703-12042003>
First
you want the cross then you want the new high. Currently your code looks for
either/or. Perhaps you could use barssince() to test that the cross has occurred
over the last X periods. If true then your signal happens when cond 2
happens
so
something like .......
<SPAN
class=861490703-12042003>
<FONT
color=#282828 size=2>
BC1= Cross(<FONT
size=2>PDI(),MDI<FONT
color=#282828 size=2>());<FONT
color=#282828 face=Arial size=2>
Count=BarsSince<FONT face=Arial
size=2>(bc1)<10<FONT color=#282828
face=Arial size=2>;<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>));
Buy=<FONT face=Arial
size=2>count AND<FONT
color=#282828 size=2> bc11 ;
<FONT color=#0000ff face=Arial
size=2>Jayson
<FONT face=Tahoma
size=2>-----Original Message-----From: Rakesh Sahgal
[mailto:rakeshsahgal@xxxxxxxxx]Sent: Friday, April 11, 2003 8:41
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker]
AFL Question
Jehmac and Jayson,Thanks for your responses.I was able
to sort out the problem with theelimination of the "==" from the formula
.Jayson another question - Ihave defined the signal asa crossover of
PDI and MDI or vice-versa andvalidation beiung the first close above the
high orlow point of the signal day as the case may be.However the
buy/sell signals are coming on the thecrossover bar itself. Could you please
check out thecode to see if I have made a mistake here as
well?Thanks in advance> > >
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,H,1));> BSC1S=
Cross(ValueWhen(BSC1,L,1), C);> BSC2=PDI()>MDI() AND
Cross(ADX(),PDI()) ;> BSC2B= Cross(C,ValueWhen(BSC2,H,1));> BSC2S=
Cross(ValueWhen(BSC2,L,1), C);> > BC1=
Cross(PDI(),MDI());> BC11=
Cross(C,ValueWhen(BC1,H,1));<FONT color=#0000ff
face=Arial size=2>
>
SC1=Cross(MDI(),PDI());> SC11= Cross(ValueWhen(SC1,L,1), C);>
> Buy= BSC1B OR BSC2B OR BC1 ;> Sell=BSC1S OR BSC2S OR
SC1;> Buy=ExRem(Buy,Sell);> Sell=ExRem(Sell,Buy);> >
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone)>
,colorBrightGreen);>PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed);>
> > Jayson> -----Original Message-----> From: Rakesh
Sahgal [mailto:rakeshsahgal@xxxxxxxxx]> Sent: Friday, April 11, 2003 2:06
AM> To: amibroker@xxxxxxxxxxxxxxx> Subject: [amibroker] AFL
Question> > > I had approached the group on this subject
earlier> on> also. Basically I am trying to set up trade>
initiation> triggers based up on the interplay of the ADX, PDI>
and> the DMI.> > This is part is not ambiguous.The
conditions are as> follows:> > Buy condition - PDI
crossing over MDI.> Validation - First close above the high of
the> crossover day subsequent to the crossover.> > Sell
condition - MDI crossing over PDI.> Validation - First close below
the low of the> crossover day subsequent to the crossover.>
> Now the part where ambiguity comes in.> > 1. PDI is
greater than MDI. ADX rises above PDI.> This> can act as a trigger
point for both further upside> or> termination of present rise.
The validation points> being (a) close above the high of the crossover
day> for upmove and (b) close below the low of the> crossover day
for end of upmove.> > 2. MDI is greater than PDI. ADX rises obove
MDI.> This> again can act as a trigger point for both
further> downisde or termination of present fall. The> validation
points being (a) close above the high of> the crossover day for end of
downmove and (b) close> below the low of the crossover day for
further> downmove.> > The conditions here are fairly simple
and I think I> have been able to correctly put them into AFL
code.> I> am appending below the code for verification. I
will> appreciate if one of the experts on the group could> please
take the time and give it a glance.> > Secondly - This is where I
am completly at a loss> for> ideas. I want the buy/sell arrows
ONLY on the first> day of the validation triggers. What I am getting
is> buy and sell arrows every day all over the chart.> > Is
my coding aboslutely wrong ? What is it that I am> not doing right
here?> > I hope someone will please help me out on this
one.> Thanks in advance> > Rakesh> > >
> --------> 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
more> http://tax.yahoo.com>
> 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:> <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 Yahoo!> Terms of
Service.> >
__________________________________________________Do you
Yahoo!?Yahoo! Tax Center - File online, calculators, forms, and more<A
href="">http://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
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.
|