Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Cross Prediction for Amibroker (AFL)
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
Indicator / Formula
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | _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
Leave Comment
Please login here to leave a comment.
Back
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