PureBytes Links
Trading Reference Links
|
Graham,
Try
Buy = Cross(MA(c,5),MA(c,34));
and you'll see plenty of cross signals which validate that it is Cross() is true on the bar when the event occurs kind of like a ValueWhen function.
Kind Regards,
GaryGraham <gkavanagh@xxxxxxxxxxxxx> wrote:
While we are talking of cross and > in conditions, I did a quick check on something you would expect to give many signals
Buy=Cross(H,L);
It gave signals only on the day after the bar had zero range. (ie H=L)
So cross only gives the first instance of the occurence.
Cheers,Grahamhttp://groups.msn.com/ASXShareTradinghttp://groups.msn.com/FMSAustralia
-----Original Message-----From: Al Venosa [mailto:advenosa@xxxxxxxxxxxx] Sent: Sunday, 30 November 2003 8:53 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] Cross or > ??
Just as an aside, Graham, when TJ implements pyramiding in AB, it's possible to envision circumstances when you wouldn't want to use ExRem to eliminate additional impulse signals. For example, in the example I gave before, suppose the threshold changes every day, and you WANT to add to your position every time H crosses above that threshold before you get an exit signal. In that case, those additional signals would not be unwanted, and you would refrain from using ExRem (or Equity(1)). But that's for the future.
AV
----- Original Message -----
From: Graham
To: amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, November 29, 2003 7:33 PM
Subject: RE: [amibroker] Cross or > ??
Yes it would be possible to get consecutive signals, and that is why you would use something like Exrem(Buy,Sell) to remove the additional unwanted signals
Cheers,Grahamhttp://groups.msn.com/ASXShareTradinghttp://groups.msn.com/FMSAustralia
-----Original Message-----From: Al Venosa [mailto:advenosa@xxxxxxxxxxxx] Sent: Sunday, 30 November 2003 8:27 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] Cross or > ??
Yes, Graham, you are right. An ma would first have to cross above another ma on one bar, signalling the buy, then cross below on the next bar, then cross above again the bar after that. That would give you 000 101 000. I used the wrong example. An example where an impulse cross could occur on 2 consecutive bars would be when H crossed above a certain numerical threshold, signalling a buy, then on the next bar, the price could open below that threshold and the H could again cross above the threshold again. In that case, you could get 2 buy signals on 2 consecutive bars using an impulse signal. Thanks for pointing out my error.
----- Original Message -----
From: Graham
To: amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, November 29, 2003 7:17 PM
Subject: RE: [amibroker] Cross or > ??
Al you are right that you can have the cross and > for different conditions within a single signal.
But I think you would find it impossible to get 2 crosses in consecutive bars. It would not be possible to get a cross below, then a cross above for the same bar for a simple MA. It would take a bar to cross below, then another to recross above. I say bars, not days, as this would apply to any timeframe.
Cheers,Grahamhttp://groups.msn.com/ASXShareTradinghttp://groups.msn.com/FMSAustralia
-----Original Message-----From: Al Venosa [mailto:advenosa@xxxxxxxxxxxx] Sent: Sunday, 30 November 2003 7:52 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] Cross or > ??
Thanks for the explanation, Gary, about the difference between impulse and state conditions. One question I have is in regard to your statement that, when ANDing two terms, they should both be in state form. I can think of situations where one can be in state form and one can be in impulse form. For example, suppose you want to buy when MA1 crosses above MA2 (impulse) while the ATR(10)/C is greater than, say, 0.03 (state). The cross statement could take place while the ATR/C is > 0.03, and the latter could be true for a rather long time. You certainly wouldn't want to write Buy = cross(ma1,ma2) AND cross(ATR(10)/C, 0.03) because, as you said, that would have to take place on exactly the same day. Rather, you'd want to write: Buy = Cross(ma1,ma2) AND ATR(10)/C>0.03. Right?
By the way, the cross statement could take place 2 days in a row if the MA1 crossed below the MA2 again the day after it crossed above MA2, then rose above MA2 again. In that case, you would have 0000 11 0000.
Al Venosa
----- Original Message -----
From: Gary A. Serkhoshian
To: amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, November 29, 2003 5:12 PM
Subject: Re: [amibroker] Cross or > ??
Hi Joe,
Actually you ask a great question. I was fortunate to have smart people around to explain the difference to me which is quite dramatic.
Cross(MA1, MA2) is only true on the day of the cross. This is called an impulse signal because if you visualize it over time it would look like 0000000 1 000000 where "1"is the day that it is true. Exrem function also creates the impulse signal which is used to give us the buy/sell/short/cover for our systems.
MA1 > MA2 is true as long as MA1 is greater than MA2. This is "state" form. A way of describing this would be "OnBuy" or "ÖnSell". When you use the Flip() function you are creating a state form as well. In other words you are either on a buy state (1) or sell state (0). It would look like this
000 111111111 000000 where the "1" is when the MA1 > MA2.
So, why is this important? If you are going to "AND" two conditions together you need to ensure that the two conditions are in state form because typically you're wanting a situation where MA1 > MA2 and MA2 > MA3. If the conditions are in impulse form (via Cross() ), you are essentially saying that the two conditions must be true on the same bar for the "AND" condition to be true. BTW, "NOT" needs state form as well for the same reasons.
You can OR two impulse conditions together. For example Cross(MA1,MA2) OR Cross(MA2,MA3) you are saying as long as one of the two are true then the OR statement is true.
I could go on, but I think this should be enough to get your going.
Regards,
Garyemg_gang <joeemmett@xxxxxxxxxxx> wrote:
Is it proper to use the "Cross" statement in a BUY statement or the > symbol. I have been using these interchangeable, but it appears I should not!Buy = Cross(MA(C,30),MA(C,50));Buy = MA(C,30) > MA(C,50);I was doing some optimization for MA and found a difference in returns between using the "Cross" or the '>'!I would have thought they would be the same since they both buy when the 30 day is greater than the 50 day!Could someone tell me which one is correct and if you have time WHY!Thanks, JoeSend BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.ya!
hoo.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.
Do you Yahoo!?Free Pop-Up Blocker - Get it now
Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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.
---Outgoing mail is certified Virus Free.Checked by AVG anti-virus system (http://www.grisoft.com).Version: 6.0.543 / Virus Database: 337 - Release Date: 11/21/2003Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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 <A
href="">Yahoo! Terms of Service. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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.
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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.
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
Yahoo! Groups Sponsor
ADVERTISEMENT
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.
|