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

[amibroker] Re: Error 29, variable 'xxx' without having been initialized !!!



PureBytes Links

Trading Reference Links

Thanks for your reply Tomasz ,
I had seen the AMA, but in my case does not go well,
because the calculation is done on the bar above to 5 minutes time frame, not the value of the previous day !!!
	
Then I have a similar problem with 'devst1' variable.

I put the formula in full so that you can possibly correct it ...

Invest = 100000;
SetOption( "InitialEquity",Invest);
SetOption( "MaxOpenPositions",1); 
PositionSize=Invest;   
ApplyStop(0,0,0,0);
ApplyStop(1,0,0,0);
ApplyStop(2,0,0,0);
SetTradeDelays(0,0,0,0);

TimeFrameSet(in5Minute);

Timeopen=TimeNum()==090500 ;
Timeclose=TimeNum()==172500 ;
Time1630=TimeNum()==163000 ;

O_OGGI=ValueWhen(Timeopen,O,1);
C_OGGI=ValueWhen(Timeclose,C,1);
T_1630=ValueWhen(Time1630,C,1);

Yield1=((T_1630/O_OGGI)-1)*100;
alpha=0.02;

avrg1=(1-alpha)*Ref(avrg1,-1)+alpha*yield1; //for the first day of chart avrg1=yield1;

dvst1=sqrt((1-alpha)*Ref(dvst1,-1)*Ref(dvst1,-1)+alpha*(yield1-avrg1)*(yield1-avrg1)); //for the first day of chart dvst1=1;

Input1=IIf((Yield1>2*dvst1),1,IIf((Yield1<-2*dvst1),-1,Yield1/(2*dvst1))));

kappa1=Param("kappa1", 0.3, 0, 1, 0.05);
kappa2=Param("kappa2", -0.3, -1, 0, 0.05 );

Buy=Time1630 AND Input1 >= kappa1;
Sell=Timeopen;
Short=Time1630 AND Input1 <= kappa2;
Cover=Timeclose;

BuyPrice=C;
SellPrice=O;
ShortPrice=C;
CoverPrice=C;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

PlotShapes( shapeUpArrow* Buy , colorBlue ,0,L);
PlotShapes( shapeHollowUpArrow* Cover ,colorBlue ,0,L);
PlotShapes( shapeHollowDownArrow* Sell,colorRed ,0,H);
PlotShapes( shapeDownArrow* Short, colorRed ,0, H); 

Plot(C,"",colorBlack,styleCandle);
_N(Title = StrFormat("{{NAME}} - ANG Last_H System - {{INTERVAL}} {{DATE}} - Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

eq=Param("equity",1,0,1,1);
equi=IIf(eq==0,Null,Equity( ));
Cover1=Flip(Cover,Short);
Short1=Flip(Short,Cover);
Buy1=Flip(Buy,Sell);
Sell1=Flip(Sell,Buy);
Plot( Equi-Invest,"\n\Equity",IIf(Buy1,colorPaleTurquoise,IIf(Short1,colorRose,colorLightGrey)), styleArea+styleLeftAxisScale);
dr = Equi- Highest(Equi);
Plot(dr, "Drawdown", colorDarkRed, styleArea+styleLeftAxisScale );
Maxdr=LLV(dr,100000);
Plot( Maxdr , "Max Drawdown", colorDarkRed, styleLine+styleLeftAxisScale ); 

Sorry for my bad English, I am an Italian boy.


--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> wrote:
>
> Hello,
> 
> There is a DEDICATED function that implements just that called AMA
> 
> xxx = AMA( yyy, alpha );
> 
> http://www.amibroker.com/f?ama
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Angio" <angio1967@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, August 06, 2009 7:08 PM
> Subject: [amibroker] Error 29, variable 'xxx' without having been initialized !!!
> 
> 
> > how can I solve this problem in the AFL code?
> > 
> > xxx=(1-alpha)*Ref(xxx,-1)+alpha*yyy;
> > 
> > the variable xxx must be set to 1 for the first day !!!
> > 
> > 
> > 
> > 
> > 
> > 
> > ------------------------------------
> > 
> > **** 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

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