Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Cross Prediction for Amibroker (AFL)
mauro24
almost 14 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 3)
Tags:
oscillator, amibroker, exploration

Cross Prediction System. Good for short time trading.

I tested this formula but it gave me an almost flat line with arrows so i assume that’s how it should be

Similar Indicators / Formulas

Jasons Indicator Convergence Divergence (JICD)
Submitted by kaiji over 14 years ago
rsi<30 and sort
Submitted by ali32b about 10 years ago
EMA,MACD,RSI EXPLORATION INDICATOR
Submitted by viralmehta about 10 years ago
CumRSI
Submitted by Xswingtrader almost 14 years ago
Awesome Oscillator (AO)
Submitted by zaroldo almost 14 years ago
MACD Divergences 2
Submitted by filinta over 13 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Cross Prediction");
//Ct is the necessary tomorrows Close for a Ti3a, Ti3b touch.
//One of the most important side effects is the crosses of this Ct with the actual Close : They usually anticipate by 1 Day the Cross(Ti3a,Ti3b).

// Cross(Ti3a,Ti3b) predictions, by D. Tsokakis, April 2004
pa=10;pb=20;//pb should be higher than pa
Plot(C,"C",1,8);
 // Ti3a
sa=0.8;fa=2/(pa+1);
e1a=EMA(C,pa);
e2a=EMA(e1a,pa);
e3a=EMA(e2a,pa);
e4a=EMA(e3a,pa);
e5a=EMA(e4a,pa);
e6a=EMA(e5a,pa);
c1a=-sa*sa*sa;
c2a=3*sa*sa+3*sa*sa*sa;
c3a=-6*sa*sa-3*sa-3*sa*sa*sa;
c4a=1+3*sa+sa*sa*sa+3*sa*sa;
Ti3a=c1a*e6a+c2a*e5a+c3a*e4a+c4a*e3a;
Plot(Ti3a,"Ti3("+WriteVal(pa,1.0)+")",colorBlue,1);
Ga=
(1-fa)*(C1a*fa^5+C2a*fa^4+C3a*fa^3+C4a*fa^2)*e1a+
(1-fa)*(C1a*fa^4+C2a*fa^3+C3a*fa^2+C4a*fa)*e2a+
(1-fa)*(C1a*fa^3+C2a*fa^2+C3a*fa+C4a)*e3a+
(1-fa)*(C1a*fa^2+C2a*fa+C3a)*e4a+
(1-fa)*(C1a*fa+C2a)*e5a+
(1-fa)*(C1a)*e6a;
GGa=C1a*fa^6+C2a*fa^5+C3a*fa^4+C4a*fa^3;
// Ti3b
sb=0.7;fb=2/(pb+1); 
e1b=EMA(C,pb);
e2b=EMA(e1b,pb);
e3b=EMA(e2b,pb);
e4b=EMA(e3b,pb);
e5b=EMA(e4b,pb);
e6b=EMA(e5b,pb);
c1b=-sb*sb*sb;
c2b=3*sb*sb+3*sb*sb*sb;
c3b=-6*sb*sb-3*sb-3*sb*sb*sb;
c4b=1+3*sb+sb*sb*sb+3*sb*sb;
Ti3b=c1b*e6b+c2b*e5b+c3b*e4b+c4b*e3b;
Plot(Ti3b,"Ti3("+WriteVal(pb,1.0)+")",colorRed,1);
Gb=
(1-fb)*(C1b*fb^5+C2b*fb^4+C3b*fb^3+C4b*fb^2)*e1b+
(1-fb)*(C1b*fb^4+C2b*fb^3+C3b*fb^2+C4b*fb)*e2b+
(1-fb)*(C1b*fb^3+C2b*fb^2+C3b*fb+C4b)*e3b+
(1-fb)*(C1b*fb^2+C2b*fb+C3b)*e4b+
(1-fb)*(C1b*fb+C2b)*e5b+
(1-fb)*(C1b)*e6b;
GGb=C1b*fb^6+C2b*fb^5+C3b*fb^4+C4b*fb^3;
Ct=(Gb-Ga)/(GGa-GGb);
Plot(Ct,"Ct",2,1);
// Actual Cross signals
PlotShapes(shapeDownTriangle*Cross(tI3b,tI3a),colorPink);
PlotShapes(shapeUpTriangle*Cross(tI3a,tI3b),colorBlue);
// Prediction signals
PlotShapes(shapeDownArrow*Cross(Ct,C),colorRed);
PlotShapes(shapeUpArrow*Cross(C,Ct),colorBrightGreen);

//The statistics were better than expected:
//for Cross(Ti3(10),Ti3(20)) there was no False Signal for 3815 crosses of the N100 database from Jan2000 till Now.
//for Cross(Ti3(5),Ti3(10)) we have had 8323 crosses without any False Signal !!
//Explore for all quotations with

// False predictions
period1=5;period2=10;// period2 should be higher than period1
Plot(C,"C",1,8);
 // Ti3_10 
pa=period1;sa=0.8;fa=2/(pa+1);
e1a=EMA(C,pa);
e2a=EMA(e1a,pa);
e3a=EMA(e2a,pa);
e4a=EMA(e3a,pa);
e5a=EMA(e4a,pa);
e6a=EMA(e5a,pa);
c1a=-sa*sa*sa;
c2a=3*sa*sa+3*sa*sa*sa;
c3a=-6*sa*sa-3*sa-3*sa*sa*sa;
c4a=1+3*sa+sa*sa*sa+3*sa*sa;
Ti3a=c1a*e6a+c2a*e5a+c3a*e4a+c4a*e3a;
Plot(Ti3a,"Ti3a",colorBlue,1);
Ga=
(1-fa)*(C1a*fa^5+C2a*fa^4+C3a*fa^3+C4a*fa^2)*e1a+
(1-fa)*(C1a*fa^4+C2a*fa^3+C3a*fa^2+C4a*fa)*e2a+
(1-fa)*(C1a*fa^3+C2a*fa^2+C3a*fa+C4a)*e3a+
(1-fa)*(C1a*fa^2+C2a*fa+C3a)*e4a+
(1-fa)*(C1a*fa+C2a)*e5a+
(1-fa)*(C1a)*e6a;
GGa=C1a*fa^6+C2a*fa^5+C3a*fa^4+C4a*fa^3;
// Ti3_20
pb=period2;sb=0.7;fb=2/(pb+1);//pb should be higher than pa
e1b=EMA(C,pb);
e2b=EMA(e1b,pb);
e3b=EMA(e2b,pb);
e4b=EMA(e3b,pb);
e5b=EMA(e4b,pb);
e6b=EMA(e5b,pb);
c1b=-sb*sb*sb;
c2b=3*sb*sb+3*sb*sb*sb;
c3b=-6*sb*sb-3*sb-3*sb*sb*sb;
c4b=1+3*sb+sb*sb*sb+3*sb*sb;
Ti3b=c1b*e6b+c2b*e5b+c3b*e4b+c4b*e3b;
Plot(Ti3b,"Ti3b",colorRed,1);
Gb=
(1-fb)*(C1b*fb^5+C2b*fb^4+C3b*fb^3+C4b*fb^2)*e1b+
(1-fb)*(C1b*fb^4+C2b*fb^3+C3b*fb^2+C4b*fb)*e2b+
(1-fb)*(C1b*fb^3+C2b*fb^2+C3b*fb+C4b)*e3b+
(1-fb)*(C1b*fb^2+C2b*fb+C3b)*e4b+
(1-fb)*(C1b*fb+C2b)*e5b+
(1-fb)*(C1b)*e6b;
GGb=C1b*fb^6+C2b*fb^5+C3b*fb^4+C4b*fb^3;
Ct=(Gb-Ga)/(GGa-GGb);
Plot(Ct,"Ct",2,1);
PlotShapes(shapeDownTriangle*Cross(tI3b,tI3a),colorPink);
PlotShapes(shapeDownArrow*Cross(Ct,C),colorRed);
PlotShapes(shapeUpTriangle*Cross(tI3a,tI3b),colorBlue);
PlotShapes(shapeUpArrow*Cross(C,Ct),colorBrightGreen);
PredictionDN=Cross(Ct,C);PredictionUP=Cross(C,Ct);
CrossDN=Cross(Ti3b,Ti3a);CrossUP=Cross(Ti3a,Ti3b);
Filter=CrossDN OR CrossUP;
AddColumn(PredictionDN,"0barsDN",1.0);
AddColumn(Ref(PredictionDN,-1),"1barDN",1.0);
AddColumn(Ref(PredictionDN,-2),"2barsDN",1.0);
AddColumn(CrossDN AND NOT(predictionDN OR Ref(predictionDN,-1) OR Ref(predictionDN,-2)),"FalseUP",1.0);
AddColumn(PredictionUP,"0barsUP",1.0);
AddColumn(Ref(PredictionUP,-1),"1barUP",1.0);
AddColumn(Ref(PredictionUP,-2),"2barsUP",1.0);
AddColumn(CrossUP AND NOT(predictionUP OR Ref(predictionUP,-1) OR Ref(predictionUP,-2)),"FalseDN",1.0);


_SECTION_END();

1 comments

1. soumya

it seems a good code .
i tested the code and it has generated view plots
i am not able to understand the logic of the code and cannot able to understand it . please explain the condition and how the crossover are predicted

Leave Comment

Please login here to leave a comment.

Back