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

[amibroker] Re: Excel Spread-sheet to AmiBroker ... Code ?



PureBytes Links

Trading Reference Links

Oops,

You're right.  Was just now going to post a similar result.  Sorry.

a


--- In amibroker@xxxxxxxxxxxxxxx, "ed" <ed2000nl@xxxx> wrote:
> thanks for your efforts, both Hans and aequalsz,
> 
> I checked the version of aequalsz and found that the loop needs to
start at 0 instead of 1. I made a function of it see below. So if all
the other code is accurate this should work. Please correct me if I am
wrong,
> 
> rgds, Ed
> 
> 
> function ProjOsc(n) { 
> 
> // Slope of High {n period regression line of High)} 
> SlopeHigh = ((n * (Sum( Cum(1) * High, n))) - (Sum( Cum(1),n) * ( 
> Sum(High, n)))) / ((n * Sum( Cum(1) ^ 2 , n)) - (Sum(Cum(1),n) ^ 
> 2)); 
> 
> //Slope of Low {n period regression line of Low} 
> SlopeLow = ((n * (Sum( Cum(1) * Low, n))) - (Sum( Cum(1), n) * ( 
> Sum(Low, n)))) / ((n * Sum( Cum(1)^ 2, n)) - ( Sum(Cum(1),n) ^ 
> 2)); 
> 
> //Upper Projection Band 
> UpProjBand = 0; 
> for (i=0; i<n-1; i++) 
> { 
> UpProjBand = 
>
Max(Max(Ref(High,-i)+i*slopehigh,Ref(High,-i-1)+(i+1)*slopehigh),UpProjBand);

> } 
> 
> //Lower Projection Band 
> LoProjBand = 10000; 
> for (i=0; i<n-1; i++) 
> { 
> LoProjBand = 
>
Min(Min(Ref(Low,-i)+i*slopelow,Ref(Low,-i-1)+(i+1)*slopelow),LoProjBand); 
> } 
> 
> //Projection Oscillator 
> ProOsc = 100 * (Close - LoProjBand) / (UpProjBand - LoProjBand); 
> 
> return ProOsc; 
> 
> } 
>   ----- Original Message ----- 
>   From: aequalsz 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Sunday, March 14, 2004 5:18 PM
>   Subject: [amibroker] Re: Projection Oscillator
> 
> 
>   Here's a variable period Projection Oscillator.  Seems to work but
>   it's not been thoroughly checked out.
> 
>   a
> 
>   --------------------------------------------------------------
> 
>   n = Param("Periods",14,5,50,1);
> 
>   // Slope of High {n period regression line of High)}
>   SlopeHigh = ((n * (Sum( Cum(1) * High, n))) - (Sum( Cum(1),n) * (
>   Sum(High, n)))) / ((n * Sum( Cum(1) ^ 2 , n)) - (Sum(Cum(1),n) ^
>   2));
> 
>   //Slope of Low {n period regression line of Low}
>   SlopeLow = ((n * (Sum( Cum(1) * Low, n))) - (Sum( Cum(1), n) * (
>   Sum(Low, n)))) / ((n * Sum( Cum(1)^ 2, n)) - ( Sum(Cum(1),n) ^
>   2));
> 
>   //Upper Projection Band
>   UpProjBand = 0;
>   for (i=1; i<n-1; i++)
>   {
>   UpProjBand =
>  
Max(Max(Ref(High,-i)+i*slopehigh,Ref(High,-i-1)+(i+1)*slopehigh),UpProjBand);
>   }
> 
>   //Lower Projection Band
>   LoProjBand = 10000;
>   for (i=1; i<n-1; i++)
>   {
>   LoProjBand =
>  
Min(Min(Ref(Low,-i)+i*slopelow,Ref(Low,-i-1)+(i+1)*slopelow),LoProjBand);
>   }
> 
> 
>   //Plot(Close,"",colorBlack,styleCandle);
>   //Plot(LoProjBand,"LPB",colorRed,styleLine);
>   //Plot(UpProjBand,"UPB",colorRed,styleLine);
>   //Projection Oscillator
>   ProOsc = 100 * (Close - LoProjBand) / (UpProjBand - LoProjBand);
> 
>   Graph0 = ProOsc;
>   Graph1 = EMA(ProOsc,9);  
> 
> 
>   ---------------------------------------------------------------
> 
> 
> 
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Hans" <hansib@xxxx> wrote:
>   > Thanks for the information I think now the code is OK for Ami.
>   > 
>   > Here follows code:
>   > 
>   > // Slope of High {14 period regression line of High)}
>   > SlopeHigh = ((14 * (Sum( Cum(1) * High, 14))) - (Sum( Cum(1),14)
* ( 
>   > Sum(High, 14)))) / ((14 * Sum( Cum(1) ^ 2 , 14)) -
(Sum(Cum(1),14) ^ 
>   > 2));
>   > 
>   > 
>   > //Slope of Low {14 period regression line of Low}
>   > SlopeLow = ((14 * (Sum( Cum(1) * Low, 14))) - (Sum( Cum(1), 14) * ( 
>   > Sum(Low, 14)))) / ((14 * Sum( Cum(1)^ 2, 14)) - ( Sum(Cum(1),14) ^ 
>   > 2));
>   >    
>   >   
>   > //Upper Projection Band
>   > 
>   > UpProjBand= Max(High, 
>   > Max( Ref(High,-1) + 1 * SlopeHigh, 
>   > Max( Ref(High,-2) + 2 * SlopeHigh, 
>   > Max( Ref(High,-3) + 3 * SlopeHigh, 
>   > Max( Ref(High,-4) + 4 * SlopeHigh, 
>   > Max( Ref(High,-5) + 5 * SlopeHigh, 
>   > Max( Ref(High,-6) + 6 * SlopeHigh, 
>   > Max( Ref(High,-7) + 7 * SlopeHigh, 
>   > Max( Ref(High,-8) + 8 * SlopeHigh, 
>   > Max( Ref(High,-9) + 9 * SlopeHigh, 
>   > Max( Ref(High,-10) + 10 * SlopeHigh,
>   > Max( Ref(High,-11) + 11 * SlopeHigh,
>   > Max( Ref(High,-12) + 12 * SlopeHigh,
>   > Ref(High,-13) + 13 * SlopeHigh)))))))))))));
>   > 
>   >   
>   > //Lower Projection Band
>   > 
>   > LoProjBand=Min(Low,
>   > Min( Ref(Low,-1) + 1 * SlopeLow,
>   > Min( Ref(Low,-2) + 2 * SlopeLow,
>   > Min( Ref(Low,-3) + 3 * SlopeLow,
>   > Min( Ref(Low,-4) + 4 * SlopeLow,
>   > Min( Ref(Low,-5) + 5 * SlopeLow,
>   > Min( Ref(Low,-6) + 6 * SlopeLow,
>   > Min( Ref(Low,-7) + 7 * SlopeLow,
>   > Min( Ref(Low,-8) + 8 * SlopeLow,
>   > Min( Ref(Low,-9) + 9 * SlopeLow,
>   > Min( Ref(Low,-10) + 10 * SlopeLow,
>   > Min( Ref(Low,-11) + 11 * SlopeLow,
>   > Min( Ref(Low,-12) + 12 * SlopeLow,
>   > Ref(Low,-13) + 13 * SlopeLow)))))))))))));
>   >    
>   >   
>   > //Projection Oscillator
>   > ProOsc = 100 * (Close - LoProjBand) / (UpProjBand - LoProjBand);
>   > 
>   > Graph0 = ProOsc;
>   > Graph1 = EMA(ProOsc,9);
>   > 
>   > /***************
>   > regards,
>   > Hans
>   > 
>   > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
<amibroker@xxxx> 
>   > wrote:
>   > > Power function in AB is not necessary because AB has ^ operator:
>   > > 
>   > > MS Power( X, Y ) call translates simply to  X ^ Y
>   > > 
>   > > Best regards,
>   > > Tomasz Janeczko
>   > > amibroker.com
>   > > ----- Original Message ----- 
>   > > From: "Hans" <hansib@xxxx>
>   > > To: <amibroker@xxxxxxxxxxxxxxx>
>   > > Sent: Sunday, March 14, 2004 10:40 AM
>   > > Subject: [amibroker] Projection Oscillator
>   > > 
>   > > 
>   > > > I would like to develop the "Projection Oscillator" for IB in 
>   > AFL.
>   > > > Some people indicate this oscillator as a very good one.
>   > > > 
>   > > > On Internet I have only found formula in Metastock at 
>   > > > http://trader.online.pl/MSZ/e-w-Projection_Oscillator.html
>   > > > 
>   > > > I tried to use similar code by modifying it for Amibroker,
but I 
>   > > > have problems to do it while translating function "PWR" of 
>   > metastock 
>   > > > and alse because I do not know Metastock at all.
>   > > > 
>   > > > Is anybody of this group so kind to help me building this 
>   > oscillator?
>   > > > 
>   > > > many thanks
>   > > > 
>   > > > Hans
>   > > > 
>   > > > 
>   > > > 
>   > > > 
>   > > > 
>   > > > 
>   > > > Send BUG REPORTS to bugs@xxxx
>   > > > Send SUGGESTIONS to suggest@xxxx
>   > > > -----------------------------------------
>   > > > 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 
>   > > > Yahoo! Groups Links
>   > > > 
>   > > > 
>   > > > 
>   > > >  
>   > > > 
>   > > >
> 
> 
> 
>   Send BUG REPORTS to bugs@xxxx
>   Send SUGGESTIONS to suggest@xxxx
>   -----------------------------------------
>   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 
> 
> 
>         Yahoo! Groups Sponsor 
>               ADVERTISEMENT
>              
>        
>        
> 
> 
>
------------------------------------------------------------------------------
>   Yahoo! Groups Links
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
>       
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>       
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.



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