Alan,

run this in explore mode....I will post for indicator builder later if you want 
to visualize....

Anthony

Mmdi=MDI(Param("NedMDI",14,1,20,1));

Ppdi=PDI(Param("PosPDI",14,1,20,1));

Crossup=Cross(Ppdi,Mmdi);

Crossdown=Cross(Mmdi,Ppdi);

Filter=1;

/***Current State ******/

stateUp=BarsSince(Mmdi > Ppdi);

stateDown=BarsSince(Mmdi < Ppdi);

AddColumn(stateUp,"currentUp");

AddColumn(statedown,"CurrentDown");


  ----- Original Message ----- 
  From: Alan 
  To: [email protected] 
  Sent: Sunday, November 22, 2009 3:03 PM
  Subject: Re: [amibroker] Re=Days since DMI crossover


    
  Hi Anthony:

  Thank you for your interest in helping me with my problem.  I want to either 
do a Scan or an Exploration that will generate a table of stocks where the 
negative DMI has crossed above the positive DMI and show how many days ago the 
crossover took place.  I am using a Filtered list that contains the 100 stocks 
comprising the QQQQ's which I have previously submitted to the forum as an 
attachment.

  Regards,
  Alan


  Anthony Faragasso wrote: 

Hi Alan,

Please post your rules again....I will revert with possible solution..

Anthony


----- Original Message ----- 
From: "Alan" <[email protected]>
To: <[email protected]>
Sent: Sunday, November 22, 2009 9:29 AM
Subject: Re: [amibroker] Re=Days since DMI crossover


  Hi soni67c:

Thanks for the code. I tried it and here is a snippit of the results
after a scan:

Ticker Trade Date Close
AAPL Sell 10/28/2009 192.4
AAPL Buy 11/5/2009 194.03
AAPL Sell 11/20/2009 199.92
ADBE Sell 10/22/2009 35.17


This table shows a sell signal on 10/28/09 while MDI is still positive,
a buy signal on 11/05 when on the stock chart is shows a buy signal on
11/04, and the table shows a sell signal on 11/20/09 again while MDI is
still positive. So I must not be doing something right. I am using a
filter list of the QQQQ's and Scan set for n=30. Any ideas why I am
getting these results?

Regards,
Alan

soni67c wrote:
    Hello Alan,
Check this formula...this is what you want :).

Range = Param(" +DI - D range", 10, 5, 30,1 );
Plot(PDI(Range),"",5,1);
Plot(MDI(Range),"",4,1);
Plot(ADX(Range),"",13,1);
Buy = Cross(PDI(Range), MDI(Range));
Sell = Cross(MDI(Range), PDI(Range));
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,20,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,20,0);
bars=SelectedValue(Min( BarsSince( Cross(PDI(Range) , MDI(Range) )),
BarsSince( Cross( MDI(Range), PDI(Range))) ));
prevclose=Ref(Close,-bars);
Com=EncodeColor(colorTan)+("\n\nCurrently the +DMI ("+Range+") is "+
WriteIf(PDI(Range) > MDI(Range),"bullish","bearish")+", and it crossed "+
WriteIf(PDI(Range) > MDI(Range),"above","below")+" -DMI ("+Range+")
."+"\n"+EncodeColor(colorAqua)+
WriteVal( Min( BarsSince( Cross( PDI(Range), MDI(Range) )), BarsSince(
Cross( MDI(Range), PDI(Range)))), 0.0)+
" period(s) ago.")+EncodeColor(colorTan)+
Com=("\n\nSince the +DMI crossed -DMI, "+Name()+ "'s price has :
")+EncodeColor(colorGold)+"\n"+
WriteIf(Close>prevclose,"increased %","decreased
%")+WriteVal(100*(Close-prevclose)/prevclose)+
EncodeColor(colorTan)+Com=("\n\nAnd has ranged from a high of "+
WriteVal(HHV(High,bars+1),6.2)+" to a low of
"+WriteVal(LLV(Low,bars+1),6.2));
Title = EncodeColor(colorWhite)+ "ABS3" + " - " + Name() +
EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"
"+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+ Com;

Thank you




__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4627 (20091121) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
      
------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links



    


------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links




__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 4627 (20091121) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




  


  

Reply via email to