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

[amibroker] Re: The last [dangerous but profitable] days of a trend



PureBytes Links

Trading Reference Links

Ron,

You should add a :

Plot(C,"close",colorblack,stylecandle);

Anthony
----- Original Message ----- 
From: "Ron Krebs" <rkrebs@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, February 06, 2004 6:13 PM
Subject: [amibroker] Trying to solve this puzzle...


> Have been studying AFL and ran across the following code puzzle.
> Comments should explain the mystery I have encountered.
>
>
>
> /*
> Simple Buy / Sell Indicator based on a % Increase / Decrease
> */
>
> LookBack = Param("Lookback Periods", 12, 5, 40); // No adjustment
> required if code functions properly - Just set it at 25 or so.
> SetPoint = Param("Buy/Sell %",8,4,10);
> Color = IIf(C >=Ref(C,-1),colorGreen,colorRed);
> Yscale = 50;
>
> Title = " " + Name() + " - " + EncodeColor(colorRed) +Setpoint + "%"
> + EncodeColor(colorGreen) + "  Buy " + EncodeColor(colorBlack)
> + " / " + EncodeColor(colorRed) + " Sell  (" + LookBack + ") ";
>
> // Search backwards to find the first occurence of HHV or LLV that
> exceeds % setpoint
> N = 1;
> do
> {
>    Change = ((C - LLV(C,N)) / LLV(C,N)) * 100;   // Percent change
>    Buy = Cross(Change,Setpoint);
>
>    Change = ((C - HHV(C,N)) / HHV(C,N)) * 100;   // Percent change
>    Sell = Cross(-Setpoint,Change);
>
>    // Catch the first HHV or LLV exceeding the setpoint, exit the
> search loop and display it.
>    // Can't figure out why the next line NEVER finds a Buy or Sell !!
>    // In fact, can't find any other test that will !!
>    N = IIf(LastValue(Buy OR Sell), LookBack + 1, N + 1);
> } while(N <= LookBack);
>
> Buy = ExRem(Buy, Sell);   Sell = ExRem(Sell, Buy);
>
> GraphXSpace = 1000;
> PlotShapes(shapeSmallCircle,Color,0,Yscale, Offset = 0);  // Display
> a base line
> PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,Yscale - 1);
> PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,Yscale + 1);
>
>
>
>
> 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
>
>
>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004



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/