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

RE: [amibroker] Atc Loop Demo



PureBytes Links

Trading Reference Links










Just thought I would throw in this loop for plotting <font
 size=3 face=Arial>support<font
size=3 face=Arial> resistance
lines on price chart

<font size=2 color=green
face="Courier New">//Support and resistance levels.

<font size=2 color=green
face="Courier New">//using RSI

<font size=2 color=green
face="Courier New">//Load into Indicator Builder

<font size=2 color=green
face="Courier New">//Sensitivity of the levels can be changed with the variables

<font size=2 color=green
face="Courier New">//Can test different numbers live with the Param function ctrl-R
with open pane

<font size=2 color=black
face="Courier New">RSIperiod = <span
lang=EN-AU >Param<font
color=black face="Courier New">(<span
lang=EN-AU >"RSI p"<font
color=black face="Courier New">,<span
lang=EN-AU >14<font
color=black face="Courier New">,<span
lang=EN-AU >3<font
color=black face="Courier New">,<span
lang=EN-AU >30<font
color=black face="Courier New">,<span
lang=EN-AU >1<font
color=black face="Courier New">);

<font size=2 color=black
face="Courier New">EMAperiod = <span
lang=EN-AU >Param<font
color=black face="Courier New">(<span
lang=EN-AU >"EMA p"<font
color=black face="Courier New">,<span
lang=EN-AU >5<font
color=black face="Courier New">,<span
lang=EN-AU >3<font
color=black face="Courier New">,<span
lang=EN-AU >10<font
color=black face="Courier New">,<span
lang=EN-AU >1<font
color=black face="Courier New">);

<font size=2 color=black
face="Courier New">Percent = <span
lang=EN-AU >Param<font
color=black face="Courier New">(<span
lang=EN-AU >"ZIG %"<font
color=black face="Courier New">,<span
lang=EN-AU >9<font
color=black face="Courier New">,<span
lang=EN-AU >5<font
color=black face="Courier New">,<span
lang=EN-AU >15<font
color=black face="Courier New">,<span
lang=EN-AU >1<font
color=black face="Courier New">);

<font size=2 color=black
face="Courier New">HHVperiod = <span
lang=EN-AU >Param<font
color=black face="Courier New">(<span
lang=EN-AU >"HHV p"<font
color=black face="Courier New">,<span
lang=EN-AU >6<font
color=black face="Courier New">,<span
lang=EN-AU >3<font
color=black face="Courier New">,<span
lang=EN-AU >10<font
color=black face="Courier New">,<span
lang=EN-AU >1<font
color=black face="Courier New">);

<font size=2 color=black
face="Courier New">NumLine = <span
lang=EN-AU >Param<font
color=black face="Courier New">(<span
lang=EN-AU >"Num
Lines"<span lang=EN-AU
>,<font
color=fuchsia face="Courier New">8<span
lang=EN-AU >,<font
color=fuchsia face="Courier New">1<span
lang=EN-AU >,<font
color=fuchsia face="Courier New">20<span
lang=EN-AU >,<font
color=fuchsia face="Courier New">1<span
lang=EN-AU >);

<font size=2 color=black
face="Courier New"> 

<font size=2 color=green
face="Courier New">//Base = RSI(RSIperiod);

<font size=2 color=black
face="Courier New">Base = <span
lang=EN-AU >EMA<font
color=black face="Courier New">(<span
lang=EN-AU >RSI<font
color=black face="Courier New">(RSIperiod),EMAperiod);

<font size=2 color=black
face="Courier New"> 

<font size=2 color=red
face="Courier New">GraphXSpace<span
lang=EN-AU >=<font
color=fuchsia face="Courier New">0.5<span
lang=EN-AU >;

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-AU >(<font
color=red face="Courier New">C<span
lang=EN-AU >,<font
color="#cc4466" face="Courier New">""<span
lang=EN-AU >,<font
color=red face="Courier New">colorBlack<span
lang=EN-AU >,<font
color=red face="Courier New">styleCandle<span
lang=EN-AU >);

<font size=2 color=black
face="Courier New"> 

<font size=2 color=red
face="Courier New">for<span
lang=EN-AU >( i = <font
color=fuchsia face="Courier New">1<span
lang=EN-AU >; i <= numline; i++
)

<font size=2 color=black
face="Courier New">{

<font size=2 color=black
face="Courier New">ResBase = <span
lang=EN-AU >LastValue<font
color=black face="Courier New">(<span
lang=EN-AU >Peak<font
color=black face="Courier New">(Base,Percent,i));

<font size=2 color=black
face="Courier New">SupBase = <span
lang=EN-AU >LastValue<font
color=black face="Courier New">(<span
lang=EN-AU >Trough<font
color=black face="Courier New">(Base,Percent,i));

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-AU >(<font
color=blue face="Courier New">ValueWhen<span
lang=EN-AU >( ResBase==Base, <font
color=blue face="Courier New">HHV<span
lang=EN-AU >(<font
color=red face="Courier New">H<span
lang=EN-AU >,HHVperiod) ), <font
color="#cc4466" face="Courier New">"Resist Level"<font color=black
face="Courier New">, <span
lang=EN-AU >colorRed<font
color=black face="Courier New">, <span
lang=EN-AU >styleLine<font
color=black face="Courier New">);

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-AU >(<font
color=blue face="Courier New">ValueWhen<span
lang=EN-AU >( supbase==Base, <font
color=blue face="Courier New">LLV<span
lang=EN-AU >(<font
color=red face="Courier New">L<span
lang=EN-AU >,HHVperiod) ), <font
color="#cc4466" face="Courier New">"Support Level"<font color=black
face="Courier New">, <span
lang=EN-AU >colorGreen<font
color=black face="Courier New">, <span
lang=EN-AU >styleLine<font
color=black face="Courier New">);

<font size=2 color=black
face="Courier New">}

<span lang=EN-AU
>Title<font
color=black face="Courier New"> = <span
lang=EN-AU >Name<font
color=black face="Courier New">() + <span
lang=EN-AU >"; "<font
color=black face="Courier New"> + <span
lang=EN-AU >Date<font
color=black face="Courier New">() + <span
lang=EN-AU >": Support
& Resistance Levels using RSI: "<font color=black
face="Courier New"> + <span
lang=EN-AU >EncodeColor<font
color=black face="Courier New">(<span
lang=EN-AU >colorGreen<font
color=black face="Courier New">)+ <span
lang=EN-AU >"Support Levels
are Green; "<span
lang=EN-AU >+<font
color=blue face="Courier New">EncodeColor<span
lang=EN-AU >(<font
color=red face="Courier New">colorRed<span
lang=EN-AU >)+ <font
color="#cc4466" face="Courier New">"Resistance Levels are Red: "<font
color=black face="Courier New">+<span
lang=EN-AU >EncodeColor<font
color=black face="Courier New">(<span
lang=EN-AU >colorBlack<font
color=black face="Courier New">)+<span
lang=EN-AU >"Number of
lines of each ="<span
lang=EN-AU >+<font
color=blue face="Courier New">WriteVal<span
lang=EN-AU >(numline,<font
color=fuchsia face="Courier New">1<span
lang=EN-AU >) ;

 



<font size=3 color=teal
face="Times New Roman">Cheers,
Graham

<font size=2
color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/ASXShareTrading

<font size=2
color="#339966" face="Times New Roman"><font
color="#339966">http://groups.msn.com/FMSAustralia



<span
>-----Original Message-----
From: Herman vandenBergen
[mailto:psytek@xxxxxxxx] 
Sent: Saturday, 26 April 2003
12:30 PM
To: Amibroker@xxxxxxxxxxxx Com
Subject: [amibroker] Atc Loop Demo

<font size=2
face="Times New Roman"> 



<span
>DT Challenged me for a loop demo :-)
so here is one, attached.





<font size=2
face="Times New Roman"> 





<span
>This shows how to optimize a system
using loops, substitute your own trading system and vary the parameter's
function and values. This was my first application for testing the new looping
function. Here I use a Loop in an Exploration to optimize the system to
three degrees. As i go along I save the best Equities obtained with the 2nd and
3rd opt parameters in a stock-specific Calibration file - using the
AddToComposite(). I read back the data from the Composite and display the
results in The result table.





<font size=2
face="Times New Roman"> 





<span
>The lower part is repeats the
trading system and shows how you can read back parameters and use them into
your system.





<font size=2
face="Times New Roman"> 





<span
>Throughout you will find some
tricks, such as to display zero-based exploration data at the current date
range in your result table.





<font size=2
face="Times New Roman"> 





<span
>Now you ask: why do all this work?
Some reasons:





<font size=2
face="Times New Roman"> 





<span
>1) You can backtest groups of stocks
and save their individual optimization values (somebody wished for this on the
list)





<span
>2) You don't ever have to type in
optimized values, they are read from your disk.





<span
>3) Opt1 in the Optimization part is,
in this demo, assigned to a period, but it could just as well be the value
of a trend indicator. This would allow you to create calibration values to
perform under various trending conditions. You would optimize a large number of
stocks and create (automatically) a calibration file for each stock. Then when
you are using your trading system you would obtain the Opt1 from your trending
indicator and based on it, you would select the other two parameters. What do
you have: an adaptive trading system.





<font size=2
face="Times New Roman"> 





<span
>Have fun, I hope some others can
explain any questions that may come up. I have to get back to another project
:-)





<font size=2
face="Times New Roman"> 





<span
>best regards,





<span
>Herman.





<font size=2
face="Times New Roman"> 





<span
>Ps. If you click the Check button
you'll get a Look-Ahead error, I believe this is due to the using the Atc. The
trading system is incidental anyway - you should substitute your own!



<font size=2
face="Times New Roman">



Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<span
>
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx 
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Your use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.











Yahoo! Groups Sponsor












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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.