Registered User Joined: 3/6/2005 Posts: 16
|
I would like assistance in coding a moving avg crossover for a 13 week and 50 week MA..At the bar when the fast ma (13) crosses above he slow ma(50) the trade is not directly initiated. Take the high of the crossover bar and keep it as the enrty stop point as long as the fast ma stays above the slow ma.
If fast crosses above slow then entryLEVEL = HIGH;
If fast > slow the buy, go long, next bar at buy stop
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could try using something similar to the following Indicator Formula as the Formula in a Custom PCF Indicator to plot the entryLEVEL on the chart. You might want to set the Plot Style of the Custom PCF Indicator to Dots. The formula looks back up to 90 bars to check for the crossup and plots 0 if the most recent crossup was more than 90 bars ago or if the 13 period simple moving average is currently at or below the 50 period simple moving average.
Days Since Last Peak (or other day-counting needs)
ABS(AVGC13 > AVGC50) * (ABS(AVGC13.1 <= AVGC50.1) * H + ABS(AVGC13.1 > AVGC50.1) * (ABS(AVGC13.2 <= AVGC50.2) * H1 + ABS(AVGC13.2 > AVGC50.2) * (ABS(AVGC13.3 <= AVGC50.3) * H2 + ABS(AVGC13.3 > AVGC50.3) * (ABS(AVGC13.4 <= AVGC50.4) * H3 + ABS(AVGC13.4 > AVGC50.4) * (ABS(AVGC13.5 <= AVGC50.5) * H4 + ABS(AVGC13.5 > AVGC50.5) * (ABS(AVGC13.6 <= AVGC50.6) * H5 + ABS(AVGC13.6 > AVGC50.6) * (ABS(AVGC13.7 <= AVGC50.7) * H6 + ABS(AVGC13.7 > AVGC50.7) * (ABS(AVGC13.8 <= AVGC50.8) * H7 + ABS(AVGC13.8 > AVGC50.8) * (ABS(AVGC13.9 <= AVGC50.9) * H8 + ABS(AVGC13.9 > AVGC50.9) * (ABS(AVGC13.10 <= AVGC50.10) * H9 + ABS(AVGC13.10 > AVGC50.10) * (ABS(AVGC13.11 <= AVGC50.11) * H10 + ABS(AVGC13.11 > AVGC50.11) * (ABS(AVGC13.12 <= AVGC50.12) * H11 + ABS(AVGC13.12 > AVGC50.12) * (ABS(AVGC13.13 <= AVGC50.13) * H12 + ABS(AVGC13.13 > AVGC50.13) * (ABS(AVGC13.14 <= AVGC50.14) * H13 + ABS(AVGC13.14 > AVGC50.14) * (ABS(AVGC13.15 <= AVGC50.15) * H14 + ABS(AVGC13.15 > AVGC50.15) * (ABS(AVGC13.16 <= AVGC50.16) * H15 + ABS(AVGC13.16 > AVGC50.16) * (ABS(AVGC13.17 <= AVGC50.17) * H16 + ABS(AVGC13.17 > AVGC50.17) * (ABS(AVGC13.18 <= AVGC50.18) * H17 + ABS(AVGC13.18 > AVGC50.18) * (ABS(AVGC13.19 <= AVGC50.19) * H18 + ABS(AVGC13.19 > AVGC50.19) * (ABS(AVGC13.20 <= AVGC50.20) * H19 + ABS(AVGC13.20 > AVGC50.20) * (ABS(AVGC13.21 <= AVGC50.21) * H20 + ABS(AVGC13.21 > AVGC50.21) * (ABS(AVGC13.22 <= AVGC50.22) * H21 + ABS(AVGC13.22 > AVGC50.22) * (ABS(AVGC13.23 <= AVGC50.23) * H22 + ABS(AVGC13.23 > AVGC50.23) * (ABS(AVGC13.24 <= AVGC50.24) * H23 + ABS(AVGC13.24 > AVGC50.24) * (ABS(AVGC13.25 <= AVGC50.25) * H24 + ABS(AVGC13.25 > AVGC50.25) * (ABS(AVGC13.26 <= AVGC50.26) * H25 + ABS(AVGC13.26 > AVGC50.26) * (ABS(AVGC13.27 <= AVGC50.27) * H26 + ABS(AVGC13.27 > AVGC50.27) * (ABS(AVGC13.28 <= AVGC50.28) * H27 + ABS(AVGC13.28 > AVGC50.28) * (ABS(AVGC13.29 <= AVGC50.29) * H28 + ABS(AVGC13.29 > AVGC50.29) * (ABS(AVGC13.30 <= AVGC50.30) * H29 + ABS(AVGC13.30 > AVGC50.30) * (ABS(AVGC13.31 <= AVGC50.31) * H30 + ABS(AVGC13.31 > AVGC50.31) * (ABS(AVGC13.32 <= AVGC50.32) * H31 + ABS(AVGC13.32 > AVGC50.32) * (ABS(AVGC13.33 <= AVGC50.33) * H32 + ABS(AVGC13.33 > AVGC50.33) * (ABS(AVGC13.34 <= AVGC50.34) * H33 + ABS(AVGC13.34 > AVGC50.34) * (ABS(AVGC13.35 <= AVGC50.35) * H34 + ABS(AVGC13.35 > AVGC50.35) * (ABS(AVGC13.36 <= AVGC50.36) * H35 + ABS(AVGC13.36 > AVGC50.36) * (ABS(AVGC13.37 <= AVGC50.37) * H36 + ABS(AVGC13.37 > AVGC50.37) * (ABS(AVGC13.38 <= AVGC50.38) * H37 + ABS(AVGC13.38 > AVGC50.38) * (ABS(AVGC13.39 <= AVGC50.39) * H38 + ABS(AVGC13.39 > AVGC50.39) * (ABS(AVGC13.40 <= AVGC50.40) * H39 + ABS(AVGC13.40 > AVGC50.40) * (ABS(AVGC13.41 <= AVGC50.41) * H40 + ABS(AVGC13.41 > AVGC50.41) * (ABS(AVGC13.42 <= AVGC50.42) * H41 + ABS(AVGC13.42 > AVGC50.42) * (ABS(AVGC13.43 <= AVGC50.43) * H42 + ABS(AVGC13.43 > AVGC50.43) * (ABS(AVGC13.44 <= AVGC50.44) * H43 + ABS(AVGC13.44 > AVGC50.44) * (ABS(AVGC13.45 <= AVGC50.45) * H44 + ABS(AVGC13.45 > AVGC50.45) * (ABS(AVGC13.46 <= AVGC50.46) * H45 + ABS(AVGC13.46 > AVGC50.46) * (ABS(AVGC13.47 <= AVGC50.47) * H46 + ABS(AVGC13.47 > AVGC50.47) * (ABS(AVGC13.48 <= AVGC50.48) * H47 + ABS(AVGC13.48 > AVGC50.48) * (ABS(AVGC13.49 <= AVGC50.49) * H48 + ABS(AVGC13.49 > AVGC50.49) * (ABS(AVGC13.50 <= AVGC50.50) * H49 + ABS(AVGC13.50 > AVGC50.50) * (ABS(AVGC13.51 <= AVGC50.51) * H50 + ABS(AVGC13.51 > AVGC50.51) * (ABS(AVGC13.52 <= AVGC50.52) * H51 + ABS(AVGC13.52 > AVGC50.52) * (ABS(AVGC13.53 <= AVGC50.53) * H52 + ABS(AVGC13.53 > AVGC50.53) * (ABS(AVGC13.54 <= AVGC50.54) * H53 + ABS(AVGC13.54 > AVGC50.54) * (ABS(AVGC13.55 <= AVGC50.55) * H54 + ABS(AVGC13.55 > AVGC50.55) * (ABS(AVGC13.56 <= AVGC50.56) * H55 + ABS(AVGC13.56 > AVGC50.56) * (ABS(AVGC13.57 <= AVGC50.57) * H56 + ABS(AVGC13.57 > AVGC50.57) * (ABS(AVGC13.58 <= AVGC50.58) * H57 + ABS(AVGC13.58 > AVGC50.58) * (ABS(AVGC13.59 <= AVGC50.59) * H58 + ABS(AVGC13.59 > AVGC50.59) * (ABS(AVGC13.60 <= AVGC50.60) * H59 + ABS(AVGC13.60 > AVGC50.60) * (ABS(AVGC13.61 <= AVGC50.61) * H60 + ABS(AVGC13.61 > AVGC50.61) * (ABS(AVGC13.62 <= AVGC50.62) * H61 + ABS(AVGC13.62 > AVGC50.62) * (ABS(AVGC13.63 <= AVGC50.63) * H62 + ABS(AVGC13.63 > AVGC50.63) * (ABS(AVGC13.64 <= AVGC50.64) * H63 + ABS(AVGC13.64 > AVGC50.64) * (ABS(AVGC13.65 <= AVGC50.65) * H64 + ABS(AVGC13.65 > AVGC50.65) * (ABS(AVGC13.66 <= AVGC50.66) * H65 + ABS(AVGC13.66 > AVGC50.66) * (ABS(AVGC13.67 <= AVGC50.67) * H66 + ABS(AVGC13.67 > AVGC50.67) * (ABS(AVGC13.68 <= AVGC50.68) * H67 + ABS(AVGC13.68 > AVGC50.68) * (ABS(AVGC13.69 <= AVGC50.69) * H68 + ABS(AVGC13.69 > AVGC50.69) * (ABS(AVGC13.70 <= AVGC50.70) * H69 + ABS(AVGC13.70 > AVGC50.70) * (ABS(AVGC13.71 <= AVGC50.71) * H70 + ABS(AVGC13.71 > AVGC50.71) * (ABS(AVGC13.72 <= AVGC50.72) * H71 + ABS(AVGC13.72 > AVGC50.72) * (ABS(AVGC13.73 <= AVGC50.73) * H72 + ABS(AVGC13.73 > AVGC50.73) * (ABS(AVGC13.74 <= AVGC50.74) * H73 + ABS(AVGC13.74 > AVGC50.74) * (ABS(AVGC13.75 <= AVGC50.75) * H74 + ABS(AVGC13.75 > AVGC50.75) * (ABS(AVGC13.76 <= AVGC50.76) * H75 + ABS(AVGC13.76 > AVGC50.76) * (ABS(AVGC13.77 <= AVGC50.77) * H76 + ABS(AVGC13.77 > AVGC50.77) * (ABS(AVGC13.78 <= AVGC50.78) * H77 + ABS(AVGC13.78 > AVGC50.78) * (ABS(AVGC13.79 <= AVGC50.79) * H78 + ABS(AVGC13.79 > AVGC50.79) * (ABS(AVGC13.80 <= AVGC50.80) * H79 + ABS(AVGC13.80 > AVGC50.80) * (ABS(AVGC13.81 <= AVGC50.81) * H80 + ABS(AVGC13.81 > AVGC50.81) * (ABS(AVGC13.82 <= AVGC50.82) * H81 + ABS(AVGC13.82 > AVGC50.82) * (ABS(AVGC13.83 <= AVGC50.83) * H82 + ABS(AVGC13.83 > AVGC50.83) * (ABS(AVGC13.84 <= AVGC50.84) * H83 + ABS(AVGC13.84 > AVGC50.84) * (ABS(AVGC13.85 <= AVGC50.85) * H84 + ABS(AVGC13.85 > AVGC50.85) * (ABS(AVGC13.86 <= AVGC50.86) * H85 + ABS(AVGC13.86 > AVGC50.86) * (ABS(AVGC13.87 <= AVGC50.87) * H86 + ABS(AVGC13.87 > AVGC50.87) * (ABS(AVGC13.88 <= AVGC50.88) * H87 + ABS(AVGC13.88 > AVGC50.88) * (ABS(AVGC13.89 <= AVGC50.89) * H88 + ABS(AVGC13.89 > AVGC50.89) * (ABS(AVGC13.90 <= AVGC50.90) * H89))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-Bruce Personal Criteria Formulas TC2000 Support Articles
|