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

Re: [amibroker] Help with PREVIOUS function



PureBytes Links

Trading Reference Links

AFL equivalent:

SetBarsRequired( 100000, 0 );
ATRMulti = 2.8;
ATRPeriod = 22;

AvPrc = (High + Low + Close) / 3;
calc = AvPrc - ATR(ATRPeriod ) * ATRMulti;

result = calc;

previous = Null;

for( i = 1; i < BarCount; i++ )
{
  if( Close[ i - 1 ] >= previous AND calc[ i ] <= previous )
    result[ i ] = previous;

  previous = result[ i ];
}

Plot( result, "result", colorRed );

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Amit Ehrenreich" <amite@xxxxxxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, March 24, 2008 7:41 PM
Subject: RE: [amibroker] Help with PREVIOUS function


> Hi Dawsonsg,
>
> Can you explain what you're trying to achieve? Does the PREVIOUS function refers to the previous value in the array? I would be 
> happy to help.
>
>
> Regards,
>
> Amit Ehrenreich
> Market Testing Wizards
> www.markettestingwizards.com
>
> ________________________________
>
> From: amibroker@xxxxxxxxxxxxxxx on behalf of dawsonsg
> Sent: Fri 3/21/2008 5:14 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Help with PREVIOUS function
>
>
>
> Hi Guys,
>
> Can someone please give me a hand with converting a metastock formula
> using PREVIOUS to Metastock. I believe I am supposed to be using a
> FOR loop to do it but am not sure where to start. I have been pointed
> to http://www.amibroker.com/guide/afl/afl_view.php?ama <http://www.amibroker.com/guide/afl/afl_view.php?ama>
>
> and have also found a mentioned at the link below
>
> http://www.mail-archive.com/amibroker@xxxxxxxxxxxxxxx/msg11900.html 
> <http://www.mail-archive.com/amibroker@xxxxxxxxxxxxxxx/msg11900.html>
>
> but still am not sure where to start. The formula is below. I dont
> want someone to do this for me but if they could give me a start I'd
> appreciate it.
>
> //ATRMulti := Input("ATR multiplier:", 0, 99999, 2.8);
> //ATRPeriod := Input("Number of bars in ATR:", 1, 99999, 22);
>
> ATRMulti = 2.8;
> ATRPeriod = 22;
>
> AvPrc = (HIGH + LOW + CLOSE) / 3;
> calc = AvPrc - ATR(ATRPeriod ) * ATRMulti;
>
> If(Ref(CLOSE, -1) < PREVIOUS, calc,
> If(calc > PREVIOUS, calc,
> PREVIOUS))
>
> Regards
> Steve
>
>
>
>
>
> ------------------------------------
>
> 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
>
>
>
> 


------------------------------------

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/