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

[amibroker] Faster with One Function File or Many



PureBytes Links

Trading Reference Links

Below is the code for an ATR based stop...kindly supplied by Steve 
Rowe (thanks once again Steve) ....how could this be change to act 
as a stop for short positions?...ie a ATR stop above price action?

// ATR stop based on close
// Steve Rowe 2004
// When the stop is breached it immediately "resets"
// use c<ref(stop,-1) to detect breach of stop line

multiplier = Param("ATR multiplier",3,1,3,0.25);
myATR =multiplier*ATR(21);
initial=C-myATR;
stop[ 0 ] = Close[ 0 ];

for( i = 1 ; i < BarCount; i++)
{
if( Close[ i ] > stop[ i - 1])
{
temp = Close[ i ] - myATR[ i ];
if( temp > stop[ i - 1 ] ) stop[ i ] = temp;
else stop[ i ] = stop[ i - 1 ];
}
else
stop[ i ] = initial[ i ];
}

Plot(C,"",1,styleBar);
Plot(stop,"ATR Stop",colorRed,1);

// steve


Thanks Bruiser



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