[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] AFL Question



PureBytes Links

Trading Reference Links

Jehmac and Jayson,

Thanks for your responses.

I was able to sort out the problem with the
elimination of the "==" from the formula .

Jayson another question - Ihave defined the signal as
a crossover of PDI and MDI or vice-versa and
validation beiung the first close above the high or
low point of the signal day as the case may be.
However the buy/sell signals are coming on the the
crossover bar itself. Could you please check out the
code to see if I have made a mistake here as well?

Thanks in advance


Rakesh
--- Jayson <jcasavant@xxxxxxxxxxxx> wrote:
> Rakesh,
> 
> 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).
> 
> 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......
> 
> 
> 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));
> 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:
> 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.
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get a FREE REFINANCE QUOTE - click here!
http://us.click.yahoo.com/2CXtTB/ca0FAA/i5gGAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/