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

[amibroker] indicator- % of vol that is negative



PureBytes Links

Trading Reference Links

Hey everyone. I've been working on building an indicator and have been unable to get it to work.I've been using AB mostly for charting ,explorations,etc,and have only built a couple of very simple indicators up to this point,so I'm having a bit of a hard time with this and am hoping someone can point me in the right direction.

Basically, I'd like to look at the Dow and find what % of the volume at the end of each day is negative and what % of the point change is negative and plot it as a line on a 0-100 scale.(it would look similar to an RSI).

Each day,the indicator would tally up all of the negative point changes,and all the positive changes and find what % of the points were negative.It would also do the same for the vol.

For example,  pnp=tnp/(tpp+tnp)* 100;  represents ,"the % of neg. points = total neg. pts / (total positive pts + total neg. points)*100"

I'd would do the same for the volume and plot each line seperately on the same graph.

I started by assigning each symbol in the Dow a variable,
   v_aa=Foreign("AA","V",1); (for the volume)
   p_aa=Foreign("AA","C",1); (for the points)

I then used IIF to find which stocks closed lower than yesterday and assigned it a variable depending on whether it was positive or negative.
   np_aa=  IIf (p_aa<Ref(p_aa,-1),Ref(p_aa,-1) - p_aa, 0);

"  /*if todays close is < yesterdays close,subtract todays close from yesterdays and assign it the varible "np_aa", else nothing*/"

..and again for positive close.
   pp_aa=  IIf (p_aa<Ref(p_aa,-1),0,p_aa-Ref(p_aa,-1)  );

"/*if todays close is < yesterdays close,do nothing, else subtract yesterdays close from todays and assign it the varible "pp_aa"*/  "

 So now I have a two lists of  Dow stocks that have closed up for the day,  closed down,and I add each list up to come up with a total of up points and a total of down points.

   /* find total up points. tpp="total positive points"*/

tpp =(pp_aa+ pp_axp+ pp_ba+ pp_bac+ pp_c+ pp_cat+ pp_cvx+ pp_dd+ pp_dis+ pp_ge+ pp_gm+ pp_hd+ pp_hpq+ pp_ibm+ pp_intc+ 
      pp_jnj+ pp_jpm+ pp_kft+ pp_ko+ pp_mcd+ pp_mmm+ pp_mrk+ pp_msft+ pp_pfe+ pp_pg+ pp_t+ pp_utx+ pp_vz+ pp_wmt+ pp_xom);

   /* find total down points. tnp="total negative points"*/

tnp=(np_aa+ np_axp+ np_ba+ np_bac+ np_c+ np_cat+ np_cvx+ np_dd+ np_dis+ np_ge+ np_gm+ np_hd+ np_hpq+ np_ibm+ np_intc+ 
     np_jnj+ np_jpm+ np_kft+ np_ko+ np_mcd+ np_mmm+ np_mrk+ np_msft+ np_pfe+ np_pg+ np_t+ np_utx+ np_vz+ np_wmt+ np_xom);

I use the same method for finding the up and down volume.

Then I find the % of the total points that is negative..

      /* find the percentage of negative points. pnp="percentage of neg.points"*/

pnp=tnp/(tpp+tnp)* 100;

Again I do the same for the volume.

Now I have two seperate values that I want to plot on the same graph with a 0-100 scale,which I tried do this way...

    SetChartOptions(0,0,chartGrid10|chartGrid90);
Plot(pnp,"% of neg. pts.",colorYellow);
Plot(pnv,"% of neg. vol.",colorBlue);

First,the header,or title (I'm not sure of the correct term) lists the stock which is displayed in the chart above the indicator.I thought using the foreign function would allow me to plot an indicator based on data other than the symbol that is being currently displayed.

Also I have no data showing up in the indicator window. It says "empty" for both vol. and points.

Sorry for the long post,I just wanted to give enough info.I hope I've been clear enough for people to have an idea what I'm trying to do.I'm sure I'm making this a lot more complicated than it needs to be,but like I said I'm still trying to get the hang of programming.If anyone could give me a few pointers and a nudge in the right direction it would be greatly appreciated. Thanks .   -jim 



   

 


              

 



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

**** 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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/