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

Re: [amibroker] Help re converting metastock code



PureBytes Links

Trading Reference Links

Great reply David. Did you ever get the details on this indicator? GRANT

dbw451 wrote:
> Hi Russ,
> 
>  
> 
> The MetaStock PREV function is a strange function that represents the 
> previous value of the function which contains it.  I chose to write a 
> loop to calculate the indicator values.  Your indicator looks 
> interesting; what is it called and how do you use it? 
> 
>  
> 
> The following code was written for readability to help explain the PREV 
> function, not minimal code optimization (although the code is fast as 
> written):
> 
>  
> 
> // MetaStock Code
> 
> // if(LinearReg(C,13)>PREV,if(LinearReg(C,13)-(ATR(13)*2.5)>PREV,
> 
> // LinearReg(C,13)-(ATR(13)*2.5),PREV),LinearReg(C,13));
> 
>  
> 
> periods = Param("periods", 13,2,100,1);
> 
> LR = LinearReg(*C*,periods);
> 
> LR_ATR = LR - (ATR(periods)*2.5);
> 
>  
> 
> MyInd = 0;  // Indicator to calculate, MyInd[i-1] = MetaStock PREV
> 
> PREV = 0;
> 
>  
> 
> *for* (i=periods; i<*BarCount*; i++) {
> 
>        PREV[i] = MyInd[i-1];
> 
>        *if*(LR[i] > PREV[i]) {
> 
>               *if*(LR_ATR[i] > PREV[i])
> 
>                      MyInd[i] = LR_ATR[i];
> 
>               *else*
> 
>                      MyInd[i] = PREV[i];
> 
>        }
> 
>        *else*
> 
>               MyInd[i] = LR[i];
> 
> }
> 
>  
> 
> Plot( MyInd, "My Indicator", ParamColor("My Ind color", *colorRed* ), 
> ParamStyle("My Ind style") );
> 
>  
> 
>  
> 
> Regards,
> 
>  
> 
> David
> 
>  
> 
> ------------------------------------------------------------------------
> 
> *From:* amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] *On 
> Behalf Of *russ_shor
> *Sent:* 02/28/2007 7:40 AM
> *To:* amibroker@xxxxxxxxxxxxxxx
> *Subject:* [amibroker] Help re converting metastock code
> 
>  
> 
> Hi re a lower deviation metastock can someone help convert to
> Amibroker. I use version 4.6
> 
> Metastock code:
> If(LinearReg(c,13)>PREV,If(LinearReg(C,13)-(ATR(13)*2.5)>PREV,LinearReg(C,13)-(ATR(13)*2.5),PREV,LinearReg(C,13));
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.5/706 - Release Date: 28/02/2007 4:09 PM


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/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 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/