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

Re: [amibroker] Re: MAcross, EMAcross Prediction [some recent examples]



PureBytes Links

Trading Reference Links

Thanks Dimitris.
This works really good in my trading system.
But the only drawback I found is that you might get more signals in a choppy
market compared to the normal crossing..(.rarely though)
Have you found this also? Or I might missunderstanding something?
thanks for sharing your work

juan

----- Original Message ----- 
From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, July 25, 2003 4:24 PM
Subject: [amibroker] Re: MAcross, EMAcross Prediction [some recent examples]


Juan,
Read first the abstract at
http://groups.yahoo.com/group/amibroker/files/Cross%20Predictions.txt
Your example is an EMA-EMA cross and needs the EMAcrossClose.
Here is the analytic code

k=150;p=13;EMAk=EMA(C,k);EMAp=EMA(C,p);
// The regular cross conditions
Buy1= Cross(EMAp, EMAk);
Sell1=Cross( EMAk, EMAp);
// The virtual Close for EMAcross
EMAcrossClose=((p+1)*(k-1)*EMAk-(k+1)*(p-1)*EMAp)/(2*(k-p));
// the prediction cross conditions
Buy2=Cross(C,EMAcrossClose);
Sell2=Cross(EMAcrossClose,C);
Plot(Buy2,"",5,2);Plot(Sell2,"",4,2);
Plot(2*Buy1,"",1,2);Plot(2*Sell1,"",2,2);
// Optimize to Select the best buy/sell condition
t1=Optimize("t1",2,1,2,1);
t2=Optimize("t2",2,1,2,1);
Buy=IIf(t1==1,buy1,buy2);
Sell=IIf(t2==1,sell1,sell2);

For t1=1, t2=1  you have the regular cross conditions.
For t1=2, t2=2 you have the prediction cross conditions.
Note that the performance of a system is not always improved with
delay=0.
For some systems delay=1 is better.
[Note also you have for many stocks a Long entry in March[April]2003
still open.
It is quite profitable and disturbs the whole picture, since you have
very few trades.]
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "emarco" <emarco@xxxx> wrote:
> Dimitris,
>
>             Thanks for sharing interesting codes.
> I would like to use the prediction EMA cross in my system.
>
> buy: cross(ema(c,13), ema(c,150));
>
> Sell: cross( ema(c,150), ema(c,13));
>
> what should i include for predicting this ema cross?
> thanks
>
> juan
>   ----- Original Message ----- 
>   From: Dimitris Tsokakis
>   To: amibroker@xxxxxxxxxxxxxxx
>   Sent: Thursday, July 24, 2003 4:30 AM
>   Subject: [amibroker] MAcross, EMAcross Prediction [some recent
examples]
>
>
>   Four consecutive days the Interpretation window reading for ^VLIC
was "Expect a bearish MAcross soon"
>   The "Expect a bearish MAcross tomorrow" did not appear.
>   Some other time, not now.
>   Some "back to the top" attempt was better.
>   The same period, the contrarian ^VIX was warning "Expect a
bullish MAcross soon".
>   But, he didn´t.
>   Better to go lower now and try later.
>   For the indicator builder/interpretation window the code was
>
>   // MA cross Prediction
>   p=20;MAp=MA(C,p);
>   k=30;MAk=MA(C,k);
>   tClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);
>   DescCrossPrediction=Cross(tClose,C);
>   AscCrossPrediction=Cross(C,tClose);
>   ExpectMAcross=DescCrossPrediction OR AscCrossPrediction;
>   Confirmed=Cross(MAk,MAp) OR Cross(MAp,MAk);
>   UR=2*Highest(ROC(C,1));LR=2*Lowest(ROC(C,1));
>   Ucoeff=1+UR/100;Lcoeff=1+LR/100;
>   Filter=tClose<Lcoeff*C OR tClose>Ucoeff*C;
>   AddColumn(MAp,"MAp");
>   AddColumn(MAk,"MAk");
>   Plot(C,"",7*Filter+1,64);
>   Plot(MAp,"",4,1);Plot(MAk,"",5,1);
>   bars=BarsSince(Cross(MAp,MAk) OR Cross(MAk,MAp));
>   expect=NOT(Filter);
>   Title=Name()+" , "+
>   WriteIf(expect AND NOT(expectMAcross) AND NOT(Confirmed) AND
bars>3 AND tClose<C,"EXPECT a bearish MAcross SOON","")+
>   WriteIf(expect AND NOT(expectMAcross) AND NOT(Confirmed) AND
bars>3 AND tClose>C,"EXPECT a bullish MAcross SOON","")+
>   WriteIf(DescCrossPrediction,"EXPECT a bearish MAcross
TOMORROW","")+
>   WriteIf(AscCrossPrediction,"EXPECT a bullish MAcross TOMORROW","")
+
>   WriteIf(Cross(MAp,MAk)," , Bullish MAcross","")+WriteIf(Cross
(MAk,MAp)," , Bearish MAcross","");
>
>   The same story was described by the Prediction curves graph.
>   The [black] MAcrossClose attempted to cross the [green] actual
^VLIC Close line, but the last moment change its direction.
>   The [red] EMAcrossClose was watching from a distance, without any
specific intention to cross the actual Close.
>   For ^VIX the graph was more dramatic. The black line was ready to
cross the green and change direction the last two days.
>   The message was clear from both sides : Let´s go back to the top
for a while and leave the bearish mood for another [better]
opportunity.
>   Dimitris Tsokakis
>
>   ----- Original Message ----- 
>   From: Dimitris Tsokakis
>   To: amibroker@xxxxxxxxxxxxxxx
>   Sent: Wednesday, July 23, 2003 10:38 AM
>   Subject: MAcross, EMAcross Prediction [a qualitative description]
>
>
>   As explained at
>   http://groups.yahoo.com/group/amibroker/message/44790
>   the next bar Close necessary for an MAk, MAp cross is
>
>
>   MAcrossClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);
>   With similar math procedure we may calculate the next bar Close
necessary for an EMAk, EMAp cross
>
>   EMAcrossClose=((p+1)*(k-1)*EMAk-(k+1)*(p-1)*EMAp)/(2*(k-p));
>   Let us see a qualitative comparison:
>   The green line is the actual Close, the red is the EMAcrossClose
and the black is the MAcrossClose.
>   We may see some periods with absurd high [or low] values. The
trend is very strong, a probable cross
>   which would signal the change of the trend is not visible in the
near future.
>   The highest [lowest] prediction curves point gives the turning
point of the market.
>   [H1, L1 for the MAcrossClose and H2, L2 for the EMAcrossClose ]
>   A descending cross confirms the bullish trend.[point X]
>   An ascending cross confirms the bearish trend. [point Y]
>   When both red/black lines are descending, we have a mutual
confirmation of the trend.
>   [covariant lines area]
>   When they have opposite directions, the phase is ambiguous and it
is better to wait for more clear signals.
>   [contravariant lines area]
>
>   For your own further analysis, paste in your indicator builder
the code
>
>   // MAcross, EMAcross Prediction curves, by Dimitris Tsokakis,
July 2003
>   Plot(C,"Close",5,8);
>   K=30;EMAk=EMA(C,k);// Plot(EMAk,"EMAk",1,8);
>   p=20;EMAp=EMA(C,p);// Plot(EMAp,"EMAp",2,8);
>   EMAcrossClose=((p+1)*(k-1)*EMAk-(k+1)*(p-1)*EMAp)/(2*(k-p));
>   Plot(EMAcrossClose,"EMAcrossClose",4,8);
>   MAcrossClose=(p*(k-1)*MA(C,k-1)-k*(p-1)*MA(C,p-1))/(k-p);
>   Plot(MAcrossClose,"MAcrossClose",1,8);
>   GraphXSpace=5;
>
>   For some periods the description of the stock behavior may be
quite reliable.
>   Enjoy !!
>   Dimitris Tsokakis
>
>         Yahoo! Groups Sponsor
>               ADVERTISEMENT
>
>
>
>
>   Send BUG REPORTS to bugs@xxxx
>   Send SUGGESTIONS to suggest@xxxx
>   -----------------------------------------
>   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@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 Toner for Your Printer or Fax at LaserTonerSuperstore.com-Save 55%!
We have your brand: HP, IBM, Canon, Xerox, Apple and many more for less!
http://www.LaserTonerSuperstore.com
http://us.click.yahoo.com/YmQqWC/qicGAA/ySSFAA/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/