PureBytes Links
Trading Reference Links
|
One thing wrong with your code is that you appear to be confusing the
equality check operator '==' with the assignment operator '='.
i.e. replace:
BSC1S= Cross(ValueWhen(BSC1=1,L,1), C);
with this:
BSC1S= Cross(ValueWhen(BSC1==1,L,1), C);
--- In amibroker@xxxxxxxxxxxxxxx, Rakesh Sahgal <rakeshsahgal@xxxx>
wrote:
> 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 ---------------------~-->
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/
|