# Traders' Tips from TASC Magazine

Massimiliano Scorpio’s article, “Targeting Your Pattern,” describes a Easy Language Show Me study to analyze price patterns. Below is the formula to create a MetaStock Expert Advisor version of this study. Most of the Expert Advisor is contained in the Commentary and will produce a display similar to the example shown here. This is a mix of formatted text and formulas. You do not have to format your display to exactly match the sample output. Bolded and underlined text and bullets were used for esthetics but are not required. To create the Expert Advisor in MetaStock:

2. Click New to open the Expert Editor for a new expert.
4. Type a name for the expert, like "Pattern Analysis"
5. Click the Commentary tab.
6. Enter the following text:
7. Analysis of <Name>
(<Symbol>)as of <date>
The current bar has the Open/High/Low/Close pattern Writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5))))),5.0) Writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5))))),0.0) Writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5))))),0.0) Writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5))))),0.0)
This means:

• The Open is writeif(O<=Ref(L,-1)-ATR(10),"less than the previous bar's Low minus a 10-period Average True Range","writeif((O>Ref(L,-1)-ATR(10)) AND O<=Ref(L,-1),"less than the previous bar's Low but greater than the previous Low minus a 10-period Average True Range","writeif(O>Ref(L,-1) AND O<=Ref((H+L)/2,-1),"less than the previous bar's midpoint but greater than the previous Low","writeif(O>Ref((H+L)/2,-1) AND O<=Ref(H,-1),"greater than the previous bar's midpoint but less than the previous bar's High","writeif(O>Ref(H,-1) AND (O<=Ref(H,-1)+ATR(10)),"greater than the previous bar's High but less than the previous High plus a 10-period Average True Range","writeif(O>Ref(H,-1)+ATR(10),"greater than the previous bar's High plus a 10-period Average True Range.")")")")")")

• The High is writeif(H<=Ref(L,-1)-ATR(10),"less than the previous bar's Low minus a 10-period Average True Range","writeif((H>Ref(L,-1)-ATR(10)) AND H<=Ref(L,-1),"less than the previous bar's Low but greater than the previous Low minus a 10-period Average True Range","writeif(H>Ref(L,-1) AND H<=Ref((H+L)/2,-1),"less than the previous bar's midpoint but greater than the previous Low","writeif(H>Ref((H+L)/2,-1) AND H<=Ref(H,-1),"greater than the previous bar's midpoint but less than the previous bar's High","writeif(H>Ref(H,-1) AND (H<=Ref(H,-1)+ATR(10)),"greater than the previous bar's High but less than the previous High plus a 10-period Average True Range","writeif(H>Ref(H,-1)+ATR(10),"greater than the previous bar's High plus a 10-period Average True Range.")")")")")")

• The Low is writeif(L<=Ref(L,-1)-ATR(10),"less than the previous bar's Low minus a 10-period Average True Range","writeif((L>Ref(L,-1)-ATR(10)) AND L<=Ref(L,-1),"less than the previous bar's Low but greater than the previous Low minus a 10-period Average True Range","writeif(L>Ref(L,-1) AND L<=Ref((H+L)/2,-1),"less than the previous bar's midpoint but greater than the previous Low","writeif(L>Ref((H+L)/2,-1) AND L<=Ref(H,-1),"greater than the previous bar's midpoint but less than the previous bar's High","writeif(L>Ref(H,-1) AND (L<=Ref(H,-1)+ATR(10)),"greater than the previous bar's High but less than the previous High plus a 10-period Average True Range","writeif(L>Ref(H,-1)+ATR(10),"greater than the previous bar's High plus a 10-period Average True Range.")")")")")")

• The Close is writeif(C<=Ref(L,-1)-ATR(10),"less than the previous bar's Low minus a 10-period Average True Range","writeif((C>Ref(L,-1)-ATR(10)) AND C<=Ref(L,-1),"less than the previous bar's Low but greater than the previous Low minus a 10-period Average True Range","writeif(C>Ref(L,-1) AND C<=Ref((H+L)/2,-1),"less than the previous bar's midpoint but greater than the previous Low","writeif(C>Ref((H+L)/2,-1) AND C<=Ref(H,-1),"greater than the previous bar's midpoint but less than the previous bar's High","writeif(C>Ref(H,-1) AND (C<=Ref(H,-1)+ATR(10)),"greater than the previous bar's High but less than the previous High plus a 10-period Average True Range","writeif(C>Ref(H,-1)+ATR(10),"greater than the previous bar's High plus a 10-period Average True Range.")")")")")")

Out of the writeval(cum(1),0.0) prior bars, this pattern was repeated writeval( p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);patpos:= If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
cum(patpos=lastvalue(patpos+prev-prev)),0.0)
times.
For this data the pattern has occured writeval( p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);patpos:= If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
(cum(patpos=lastvalue(patpos+prev-prev))/cum(1))*100,5.1)
percent of the time.
On the writeval( p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);patpos:= If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
cum(patpos=lastvalue(patpos+prev-prev))-1,0.0)
previous occurrences of this pattern:
The next days close was greater than its open writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);

patpos:= If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
cum(ref(patpos,-1)=lastvalue(patpos+prev-prev) AND C>O),0.0) time(s) or writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);patpos:= If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
(cum(ref(patpos,-1)=lastvalue(patpos+prev-prev) and c>O))/cum(ref(patpos,-1)=lastvalue(patpos+prev-prev))*100,5.1)
percent.

The next days close was less than its open writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);patpos:= If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
cum(ref(patpos,-1)=lastvalue(patpos+prev-prev) AND C < O),0.0) time(s) or writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);patpos:= If(O <=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
(cum(ref(patpos,-1)=lastvalue(patpos+prev-prev) and c < O))/cum(ref(patpos,-1)=lastvalue(patpos+prev-prev))*100,5.1)
percent.

The next days close was equal to its open writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);patpos:= If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
cum(ref(patpos,-1)=lastvalue(patpos+prev-prev) AND C=O),0.0) time(s) or writeval(p1:=Ref(L,-1)-ATR(10);
p2:=Ref(L,-1);
p3:=Ref((H+L)/2,-1);
p4:=Ref(H,-1);
p5:=Ref(H,-1)+ATR(10);patpos:= If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));
(cum(ref(patpos,-1)=lastvalue(patpos+prev-prev) and c=O))/cum(ref(patpos,-1)=lastvalue(patpos+prev-prev))*100,5.1)
percent.

As a reminder, here are the definitions of the six numbers:0:below the previous bar's low minus the value of the 10-bar ATR 1:between the previous bar's low and its low minus the value of the 10-bar ATR 2:between the previous bar's low and the middle of its range 3:between the previous bar's high and the middle of its range 4:between the previous bar's high and the high plus the value of the 10-bar ATR 5:above the previous bar's high plus the value of the 10-bar ATR

After entering the above text, you may click OK to close the Expert Editor, or you may create symbols to show where specific patterns are occurring. For the latter:

1. Select the Symbols tab
2. Click New to make a new symbol.
3. Type the name of the symbol. (for example:"3535 pattern")
4. Click in the condition window and type in the following formula:

target:=3535;p1:=Ref(L,-1)-ATR(10);p2:=Ref(L,-1);p3:=Ref((H+L)/2,-1);p4:=Ref(H,-1);p5:=Ref(H,-1)+ATR(10);patpos:=If(O<=p1,0, If(O>p1 AND O<=p2,1, If(O>p2 AND O<=p3,2, If(O>p3 AND O<=p4,3, If(O>p4 AND O<=p5,4, 5)))))*1000 + If(H<=p1,0, If(H>p1 AND H<=p2,1, If(H>p2 AND H<=p3,2, If(H>p3 AND H<=p4,3, If(H>p4 AND H<=p5,4, 5)))))* 100 + If(L<=p1,0, If(L>p1 AND L<=p2,1, If(L>p2 AND L<=p3,2, If(L>p3 AND L<=p4,3, If(L>p4 AND L<=p5,4, 5)))))* 10 + If(C<=p1,0, If(C>p1 AND C<=p2,1, If(C>p2 AND C<=p3,2, If(C>p3 AND C<=p4,3, If(C>p4 AND C<=p5,4, 5)))));patpos=target

5. Select the Graphics tab
6. Choose a symbol (like diamond).
7. Select a color for the symbol
8. Choose whether to display the symbol above or below the price bar
9. Click OK
10. Additional symbols can be created by repeating steps 7-14. To find different patterns, change the number on the first line to the desired pattern. Make sure this line ends with a semi-colon.
11. Click OK to close the Expert Editor.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7668721,"math_prob":0.9997577,"size":14961,"snap":"2020-45-2020-50","text_gpt3_token_len":5962,"char_repetition_ratio":0.21448152,"word_repetition_ratio":0.46683672,"special_character_ratio":0.42109483,"punctuation_ratio":0.2,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9999218,"pos_list":[0,1,2],"im_url_duplicate_count":[null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-12-02T06:15:29Z\",\"WARC-Record-ID\":\"<urn:uuid:edc72a07-a0b4-43f7-8bcb-ae9d771883f7>\",\"Content-Length\":\"235107\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f60f4d09-d01c-4983-a199-8632b12f2d40>\",\"WARC-Concurrent-To\":\"<urn:uuid:3e2420c6-9c13-4247-8fec-53f7f90f5ceb>\",\"WARC-IP-Address\":\"13.93.233.214\",\"WARC-Target-URI\":\"https://www.metastock.com/customer/resources/tasc/?id=71\",\"WARC-Payload-Digest\":\"sha1:IAY2IYORLERGQUOWWXZPSVBJHFJ7BED4\",\"WARC-Block-Digest\":\"sha1:45NEIG6GKFKWWYANDDZ4CK7XXLVSTLHP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141692985.63_warc_CC-MAIN-20201202052413-20201202082413-00662.warc.gz\"}"}