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

[amibroker] Re: Intraday Intensity Indicator



PureBytes Links

Trading Reference Links

Hello graham
when I use the following code the indicator is displaed correct,
but when backtesting there are stange results it looks like that
the array is to short and the p&l is not correct

 /*Fisher Transform*/

price=(H+L)/2;
Length=Optimize("length",10,1,21,1);
MaxH=HHV(price,Length);
MinL=LLV(price,Length);
Value=C;
fish=C;


for (i=1;i<BarCount;i++) {
Value1[0]=0;
Fish[0]=0;

Value1[i]=0.33*2*((price[i]-MinL[i])/(MaxH[i]-MinL[i])-0.5)
+0.67*Value1[i-1];

if (Value1[i]>0.99) {
Value1[i]=0.999;
}

if (Value1[i]<-0.99) {
Value1[i]=-0.99;
}
Fish[i]=0.5*log((1+Value1[i])/(1-Value1[i]))+0.5*Fish[i-1];
}

Trigger=Ref(Fish,-1);

Buy=Cross(Fish,Trigger);
Sell=Cross(Trigger,Fish);
Cover=Buy;
Short=Sell;

Plot(Fish,"Fisher Transform",3,1);
Plot(Ref(Fish,-1),"Trigger",5,1);

cheers
Michael

--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> Not certain what you mean
> Barcount is the count of the number of bars in your chart. It is 
same as
> saying Lastvalue(cum(1)) or Lastvalue(Barindex()+1)
> So the line
> for (i=1;i<BarCount;i++)
> looks at the 2nd bar (1st bar is zero) to the last bar of the data.
> 
> I would suggest your strange results could most likely be in the 
formulae
> you are using within the code. Can you post the full code?
> 
> Just looking at the line I can see I may be wrong above and if you 
have put
> this as a full line in the code
> 
> statement (for (i=1;i<BarCount;i++))
> 
> Then you do not use the statement part.
> There are examples in the help files for using the if for etc 
statements 
> Amibroker Formula Language - AFL Reference Manual
> 
> You do not need to define a variable or array before using it, 
except to
> define the first value
> 
> Here is one example from the help file as above
> myema[ 0 ] = Close[ 0 ]; 
> for( i = 1; i < BarCount; i++ ) 
> { 
>     myema[ i ] = 0.1 * Close[ i ] + 0.9 * myema[ i - 1 ]; 
> }
> 
> Hope this helps
> 
> 
> Cheers,
> Graham
> http://e-wire.net.au/~eb_kavan/
> 
> -----Original Message-----
> From: mhtrading2003 [mailto:hennigmichael@x...] 
> Sent: Friday, July 09, 2004 2:46 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: number of bar limit for using for 
statement
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "mhtrading2003" 
> <hennigmichael@xxxx> wrote:
> > Hello,
> > 
> > does anybody know if there is a number of bar limit for 
> using "for" 
> > statement (for (i=1;i<BarCount;i++))
> > because I get strange results when backtesting with a formula 
> using 
> > this for statement.or is there a function lile dim in basic?
> > 
> > regards 
> > Michael
> 
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

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