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

Re: [amibroker] Wrong signal with MACD



PureBytes Links

Trading Reference Links

Don't know if "in45minute" is a valid argument.
 
Try something like this:
 
TimeFrameSet(3/4*inhourly);  //45min
MA_H=MA(H,Mm);
MA_B=MA(L,Mm);
MACDind= MACD(12,26);
MACDsign= Signal(12,26,9);
Div = MACDind - MACDsign;
TimeFrameRestore();

MACDind1= TimeFrameExpand(MACD(12,26),3/4*inhourly,expandfirst);
 
use same logic for rest of the code.
 
Cheers,Padhu
 

 
 
----- Original Message -----
From: tradeuk59
Sent: Wednesday, October 24, 2007 5:25 PM
Subject: [amibroker] Wrong signal with MACD

Hi,

Can someone able to help me with this system. I try to reduce
all "timeframeexpand" and also don't understand why this code don't
respect the cond2 and cond4 (MACD>0 and MACD<0).

Hope you understand what i try to explain. :)

MY CODE :

Temp = in45minute;
Mm = 20;

TimeFrameSet(Temp);
MA_H=MA(H,Mm);
MA_B=MA(L,Mm);
MACDind= MACD(12,26);
MACDsign= Signal(12,26,9);
Div = MACDind - MACDsign;
TimeFrameRestore();

MACDind1= TimeFrameExpand(MACD(12,26),Temp);
MACDsign1= TimeFrameExpand(Signal(12,26,9),Temp);
Div1 = MACDind1 - MACDsign1;
MACD_1 = TimeFrameExpand(Ref(div1,-5),Temp);
MACD_2 = TimeFrameExpand(Ref(div1,-4),Temp);

BuyPrice = TimeFrameExpand(MA_B,Temp);
SellPrice = TimeFrameExpand(MA_H,Temp);
ShortPrice = TimeFrameExpand(MA_H,Temp);
CoverPrice= TimeFrameExpand(MA_B,Temp);

Cond1 = Cross(High,TimeFrameExpand(MA_B,Temp)) OR Cross
Low,TimeFrameExpand(MA_B,Temp));

Cond2 = MACD_1>=0 AND MACD_2>=0;

Cond3 = Cross(TimeFrameExpand(MA_H,Temp),High) OR Cross
(TimeFrameExpand(MA_H,Temp),Low);

Cond4 = MACD_1<=0 AND MACD_2<=0;

Buy = Cond1 AND Cond2;
Sell = Cond3 OR TimeNum() > 151000;
Short = Cond3 AND Cond4;
Cover = Cond1 OR TimeNum() > 151000;

_SECTION_BEGIN("SIGNAUX");
Sign_Buy = ExRem(Buy,Sell);
Sign_Sell = ExRem(Sell,Buy);
Sign_Short = ExRem(Short,Cover);
Sign_Cover= ExRem(Cover,Short);

__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___