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

[amibroker] Re: Do Loop can not work if Initial value begin from middle of the data range



PureBytes Links

Trading Reference Links

No, it won't. That statement doesn't turn an array back into a single
number.

I think what you want is to take a single price value from the
ValueWhen array and pass that to the function. In fact, it looks to me
like all you need is:

Price = Low[start];

GP


--- In amibroker@xxxxxxxxxxxxxxx, "wongloktim" <wlt@xxx> wrote:
>
> Even I define Hlow=0, Do Loop also can'nt work
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@> 
> wrote:
> >
> > The problem is that the Price parameter passed to the function is 
> an
> > array, since ValueWhen returns an array, and that makes HLow an 
> array
> > and you can't test arrays in an "if" statement.
> > 
> > GP
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "wongloktim" <wlt@> wrote:
> > >
> > > Please Help
> > > 
> > > I found this cause Do Loop problem:{for(i=bars+1; 
> i<BarCount;i++)}
> > > 
> > 
> > ///////////////////////////////////////////////////////////////////
> /
> > > SetChartOptions(0,chartShowArrows|chartShowDates);
> > > _N(Title = FullName()+StrFormat("  {{NAME}} - {{INTERVAL}} 
> {{DATE}} 
> > > Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, 
> C, 
> > > SelectedValue( ROC( C, 1 ) ) ));
> > > Plot( C,"Price",colorBlack,64 );
> > > 
> > > function HigherLow(Bars,Price)
> > > {
> > > HLow=Price;
> > > HLowArr=Null;
> > > if(Bars>0)
> > > 	{  
> > > 		for(i=bars+1; i<BarCount;i++)
> > > 		{
> > > 		if(Low[i] >= HLow)
> > > 			{
> > > 			HLow=Low[i];
> > > 			HLowArr[i]=HLow;
> > > 			}
> > > 		else
> > > 			HlowArr[i]=HLow;		
> > > 		}
> > > 	}
> > > return HlowArr;
> > > }
> > > Start = SelectedValue(BarIndex());
> > > Price=ValueWhen(BarIndex()==start,L,1);
> > > Test=HigherLow(Start,Price);
> > > Plot(IIf(start,Test,Null),"StopLoss",colorRed,4);
> > > 
> > > ///////////////////////////////////////////////////////////
> > >
> >
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
 
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/