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

Re: [amibroker] really stumped...



PureBytes Links

Trading Reference Links

cross results in binary yes/no for each bar. So rather than worry
about when it crossed, unless you need the number of bars since
crossing occured just use
value2>value1 in your buy statement

another thing I see from a quick look through is that you are tyring
to compare values between lineregslope and tema. Tema is a form of
moving average and will have values close to the actual price.
Lineregslope is the slope of th lieareg line, so will have values
nowhere near the tema. Perhaps you mean to use Linearreg and tema as
similar values to compare

On 9/4/05, Joel <shadowzen@xxxxxxxxxxx> wrote:
> Hi;
> 
> I'm trying to go beyond a simple cross over system but find
> that 'remembering' prior values (for instance, when a crossover
> occurs I want to 'store' that value and then keep it active to
> continue to compare to Close to see if in fact it is going to
> continue 'upward'.
> 
> My code (which isn't working to my specs) is this:
> 
> R2PDS=20; /*for automatic adjustments to the r2 critical value line
> use one of
> the periods listed above*/
> xv[0] = 0;
> pxv[0] = xv[0];
> Crit = Optimize("Crit",0.6,0.01,1,0.01);
> R2=Correlation(Cum( 1 ),C,r2pds)*Correlation(Cum( 1 ),C,r2pds);
> slope=LinRegSlope(C,r2pds);
> zsig = TEMA(slope,10);
> zxover = Cross(slope,zsig);
> zxunder = Cross(zsig,slope);
> xv = IIf(zxover == 1,C,pxv[0]);
> printf("\n" + C + " " + xv + " pxv " + pxv + "\n");
> 
> //Crit=IIf(R2PDS==5,.77,IIf(R2PDS==10,.40,IIf(R2PDS==14,.27,IIf
> (R2PDS==20,.20,IIf(R2PDS==25,.16,IIf(R2PDS==30,.13,IIf
> (R2PDS==50,.08,IIf(R2PDS==60,.06,IIf(R2PDS==120,.03,0)))))))));
> 
> zbuy = IIf(zxover AND slope > 0 AND r2 > Crit,1,0);
> zsell = IIf(zxunder AND slope < 0 AND r2 > Crit,1,0);
> 
> Buy = zbuy;
> Sell = zsell;
> Cover = Buy;
> Short = Sell;
> ...
> 
> it could have been a much simpler example, that's just what I
> currently am testing.
> 
> when I run this, the printf shows that when there is a crossover it
> makes xv = C, but the next bar it's zeroed.  I've tryed all sorts of
> combinations (yes, including Ref(xv,-1) ... it simply WON'T 'keep' a
> value so I can continue to compare to it.
> 
> If it takes low level if and for loops then ... ok... but someone
> needs to explain to me how to do that then... this ;can't mix Array
> and loops' really puzzles me.  I've rewritten a test or two where I
> load values from a for / if loop but checking the array afterwards
> shows it is 'zero' almost like after the loop xv as an array is a
> different variable than xv[i] that I made an assignment to in the
> for loop.
> 
> really confused;
> 
> zen
> 
> 
> 
> 
> 
> 
> 
> 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 other support material please check also:
> http://www.amibroker.com/support.html
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 


-- 
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Put more honey in your pocket. (money matters made easy).
http://us.click.yahoo.com/r7D80C/dlQLAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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