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

Re: [amibroker] Cross or > ??



PureBytes Links

Trading Reference Links


Al,
 
As usual you are right on.  There are many instances where you'd want both flavors of state and impulse together as in your example:
 
Buy = Cross(ma1,ma2) AND ATR(10)/C>0.03
 
points out.
 
I think the moral of the story is know if you are putting your conditions in state or impulse form by visualizing the sequence of ones or zeros as you go through time.
 
To your last point, cross can't be two "1" in a row.  Walking through the sequence of Cross(MA1,MA2), it's true when MA1 crosses above MA2.  The next day it crosses back below and is false.  The following day crosses back above and is true again.  Numerically, it would look like this:
 
101
 
If it were Cross(MA2,MA1) with the scenario above then numerically it would look like this:
 
010
 
Kind Regards,
GaryAl Venosa <advenosa@xxxxxxxxxxxx> wrote:




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 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.