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

[amibroker] Re: plotting x against y



PureBytes Links

Trading Reference Links

hi Dimitri,

well in general the x-values would be floats. Still I am interested 
to know how you would assign certain integers to certain bars.

The code for my example is shown below and can be dragged directly 
inside the indicator builder. Now I only plot the Y-values but the X-
values should go from 0 to 1 (or from 0 to 100 if I express it in %).

In the code I setup the X-array as:

fra=BarIndex()/(BarCount-1);

The length of this array is determined by the current symbol. Is it 
possible to assign an array of 100 elements to the array "fra" 
instead? An array that has a 100 elements from 0 to 1.  

All is no big deal. I was just curious if Plot(x,y) would be possible.

thanks and regards,

Ed

the code:

profit_chances = Param("profit_chances",75,0,100,0.1);
profit_perc = Param("profit_perc",2,0,100,0.1);
loss_perc = Param("loss_perc",10,0,100,0.1);

fra=BarIndex()/(BarCount-1);
resu=fra;

loss_chances = 100 - profit_chances;

for (j=0;j<BarCount;j++) {

acc=1;

	for (i=0;i<profit_chances;i++) {

		acc = acc + (acc*fra[j])*(profit_perc/100);
		i=IIf(acc < 0.01,profit_chances-1,i);

	}

	for (i=0;i<loss_chances;i++) {

		acc = acc - (acc*fra[j])*(loss_perc/100);
		i=IIf(acc < 0.01,loss_chances-1,i);

	}

resu[j]=acc;

}

resu = resu * 100 - 100;

Plot(resu,"",1,1);






--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> 
wrote:
> ed,
> the x-axis has, by default, integer values, since it is aligned 
> to "time" and the unit of the time, in any EOD function, is equal 
to 
> 1 bar.
> If your x-function has integer values, we could do something 
> [perhaps].
> A x-value=35 may be assigned the the 35th bar.
> A x-value=35.24 has no place in the x-axis.
> So, is your x-variable an integer array ?
> [or it may be rounded to an integer ?]
> Please advise.
> Dimitris Tsokakis
> --- In amibroker@xxxxxxxxxxxxxxx, "ed2000nl" <pablito@xxxx> wrote:
> > hi,
> > 
> > is it possible to plot one measure against another?
> > 
> > e.g. I have 2 arrays of the same length. In the 1-st one (xx) I 
> have 
> > numbers from 0 to 99 and in the second one (yy) I have also 
numbers 
> > from 0 to 99. Plotting xx against yy in one graph is what I want. 
> Is 
> > that possible?
> > 
> > regards, Ed


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/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/