back start next


[start] [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] [133] [134] [135] [136] [137] [138] [139] [140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151] [152] [153] [154] [155] [156] [157] [158] [159] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170] [171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182] [183] [184] [185] [186] [187] [188] [189] [190] [191] [192] [193] [194] [195] [196] [197] [198] [199] [200] [201] [202] [203] [204] [205]


116

In many cases, if you are trading the reversal pattern and it does not occur on the first day, it is best to hold that position at least one more day. This study may be taken fiirther by looking at whether the open of the next day is a better point to enter a reversal trade than the previous close. Therefore, if Monday and Tuesday were both lower, a long entered on the open Wednesday may prove more profitable and less riskj.

Programming the Weekday Study

The following program will produce results for the weekday study in the Printer Log window of TradeStation. There are a number of different methods that could be used to find these pattems; this approach is shown because it is transparent without using an excessive amoimt of programming code.

JUpdate weeKOcj ituOj " :e!s a-: "z "

vars: dowtOi. Girr . . j..:v: e-- . zi a:v3 : . :5.-

{create fi catte- f--- vjeek bef:re e-e-ec; .cjes ::se

f :)jrr.i;tfir = tiP ?>zr

"b.p5. i! = 10; Tes.. - .J.:

FIGURE 15-7 (Continued)



IHedriesdayl

Weddl = 101; Hedt?] - 100; ] - 111; Wed[«] - 110: ThursLU = 1011; ThursCZ} - 1010; Tu s[3] = 1001: Thurs[«] = 1000; Ihurs[5J - llll; Thurs[6] = 1110; Iliurs[71 - 1101: Thi,rs[S] - 1100; Fri[l] 10111; Fr1[£) - 10110: Fri[3] = 10101; Fri [4] - 10100; FrU5] - 10011; Fri[6] = 10010: Fri[71 = 10001. Fri [6] - 10000; Fri[9] = mil, FriClO] - 11110; Fri[ll] - 11101, Fri[l?] - 11100; Fri[13] - llOU; Fri[M] = 11010; Fri[lb] - 11001, Fr1[l6] - 11000: end;

- 1 ther begin

for IX - 1 to 5 begin

patterr[iK] - 0; end;

if close > closed] ther pattern[i] = 1 else patlernri] - -J: end;

- then begin

If close > close[l] then patterrC?] - 1 else patterr[Z] - 1;

- 3 then begin

if close > closeCl] then pflttern[3] = 1 endr

(Thursday I

if dow - fl then begin

FIGURE 15-7 (Continued)



if close > closeCl] then pattern[4] - 1 else patterr[flj - -1; erd;

I Friday!

if dow = 5 then begin

if close > closeCl] ther pettern[5] - 1 else pattern[5] = 1; error - 0;

Iprocess pattern for ertirs week, corvert to pattern beginning with 1 for ix = 2 to begin

if peltern[iK] - 0 then error - 1, If error - 0 then begin

if pattern[ix] petternCl] > 0 then patternlud -

patterntix] - 0;

end;

erdj

patternEl] - 1; if error = 0 then begin (create a value for each dayl

Hon = Hon + 1;

day? = 10 + patterned];

day3 = 100 + pattern[?]*10 + pattern[3];

d«y4 = IGOO + patternteilOO + pattcm[3]*10 * pattern[4];

" lOOOC + patterntgJlOOO + pattern[3]400 * pattern

paltern[5];

Imetch eacn pattern aro add tc number ot cases)

if = TuesEl] then n2[]l - nZ[l] + 1 else r2[2] - r2[2] + for ix - i to 4 begin

HGURE 15-7 (Conliinied)



[start] [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] [133] [134] [135] [136] [137] [138] [139] [140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151] [152] [153] [154] [155] [156] [157] [158] [159] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170] [171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182] [183] [184] [185] [186] [187] [188] [189] [190] [191] [192] [193] [194] [195] [196] [197] [198] [199] [200] [201] [202] [203] [204] [205]