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

RE: [amibroker] Re: What am I doing wrong here?



PureBytes Links

Trading Reference Links

Sorry for a silly suggestion, but have you used Foreign to get the MACD etc
for the S&P500 and ASX500. I assume this is where the signals are required
to come from?

Another suggestion, in case the above is a wrong assumption, use plotshapes
to demonstrate the crossing points of the MACD/Signal and the MA's on a
chart. It may just be that the MACD etc used in the calculation may be
different to that displayed on the chart

Cheers,
Graham
http://groups.msn.com/asxsharetrading
http://groups.msn.com/fmsaustralia 

-----Original Message-----
From: gerard_carey [mailto:gcfinance@xxxxxxxxxxx] 
Sent: Wednesday, 3 December 2003 11:22 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: What am I doing wrong here?


Thanks indeed for your efforts Andrew,
Also thanks to Graham,Mr Valley,Corey and Anthony.

To explain my requirements more fully;
One of my portfolios 'Position Trades' the ASX (Australian Stock 
Exchange).
The overiding condition of entering any trade is that both the S&P500 
and the ASX500 are displaying an uptrend. 
My definition, in this instance, of an uptrend is; 
MA(C,5) > MA(MA(C,5),7).
After some investigation I figured that adding; 
MACD > an 18pd SIGNAL LINE,
to my definition would improve the results. The use of an 18pd signal 
line will reduce whipsaws to an acceptable level.
I require that a color change be plotted if either condition is met.

So,my final formula (inserted in the built-in 'PRICE' indicator) is 
as follows;

//MACD & MA Ribbon
down = MACD()<EMA(MACD(),18) AND MA(C,5)<MA(MA(C,5),7);
up = MACD()>EMA(MACD(),18) AND MA(C,5)>MA(MA(C,5),7);
Color = IIf(down,colorRed,IIf(Up,colorGreen, IIf(BarsSince(up)
>BarsSince(down),colorGreen,colorRed)));
Plot(10,"ribbon",Color, styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
/*xxxx end xxxx*/

IN ADDITION.
The use of this ribbon method of displaying indicators has several 
benefits for a laptop user such as myself;
It is visually clear, unobtrusive and compact,
It does not 'clutter' the pane,
It allows the use of other MA lines thru 'Preferences'.

Andrews other contributions detailed below (Post 53458) lead me to 
envisage several clear,compact indicators IN ONE PANE.
When I have more than three panes open on my monitor I lose 
perspective.
The ability to have several visually clear indicators open in one 
pane on my laptop?
I'M EXCITED!   

Thanks again to all,

Regds Gerard

   

--- In amibroker@xxxxxxxxxxxxxxx, "Andrew" <a.perrin@xxxx> wrote:
> Gerard
> I'm not totally clear as to what you want, but if this describes
> what you are after then the following AFL will do this.
> Description - If we treat your 2 conditions as Cond1 and Cond2, is 
> what you want this? If cond1 and cond2 are up - colorgreen, if 
cond1 
> and cond2 are down - colorred, if previous bar was colorgreen and
> either cond turns down - colorred, if previous bar was colorred and 
> either condition turns up - colorgreen.  If this is what you want 
> then try
> 
> down = MACD()<Signal() AND MA(C,5)<MA(MA(C,5),7);
> up = MACD()>Signal() AND MA(C,5)>MA(MA(C,5),7);
> Color = IIf(down,colorRed,IIf(Up,colorGreen, IIf(BarsSince(up)
> >BarsSince(down),colorGreen,colorRed)));
> Plot(10,"ribbon",Color, styleOwnScale|styleArea|styleNoLabel, -0.5,
> 100 );
> 
> This type of code will give you increased whipsaws as either
> condition changing changes color of ribbon.  More informative is to 
> perhaps introduce a third intermediate state where the 2 conditions 
> don't agree.  This would enable you to enter positions when both 
> conditions are in agreement, but exit if either condition changes.
> 
> down = MACD()<Signal() AND MA(C,5)<MA(MA(C,5),7);
> up = MACD()>Signal() AND MA(C,5)>MA(MA(C,5),7);
> Color = IIf(down,colorRed,IIf(Up,colorGreen, colorYellow));
> Plot(10,"ribbon",Color, styleOwnScale|styleArea|styleNoLabel, -0.5, 
> 100 );
> 
> Even more informative is to "stack the ribbons".  By plotting
> successive ribbons at increased widths, we can stack the ribbons so 
> as to see the state of each Cond separately and then the overall 
> state. The 3 ribbons are separated by a black "separator" line 
> (cosmetic only).
> 
> // cond1 ribbon
> Plot(5,"Cond1", IIf( MACD()<Signal(), colorRed, colorGreen 
> ),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 ); 
> Plot(6,"",1,styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
> 
> // Cond2 ribbon
> Plot(11,"Cond2", IIf( MA(C,5)<MA(MA(C,5),7),
> colorRed, colorGreen), styleOwnScale|styleArea|styleNoLabel, -0.5,
> 100 );
> Plot(12,"",1,styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
> 
> // overall ribbon
> down = MACD()<Signal() AND MA(C,5)<MA(MA(C,5),7);
> up = MACD()>Signal() AND MA(C,5)>MA(MA(C,5),7);
> Color = IIf(down,colorRed,IIf(Up,colorGreen, colorYellow));
> Plot(20,"Overall Ribbon",Color, 
> styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
> 
> Hope this helps
> Andrew


------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy
Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer
at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/ 


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/