[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: need some ideas to (dis)prove an assumption



PureBytes Links

Trading Reference Links

here ya go.....

{
*******************************************************
 Indicator: dhNumberOfStrikes
 DH, 2001

 Counts the number of strikes the price moves from one expiration
 to the next and records the information to a text file.

 Filename: path and name of the output file.
 Newfile: deletes the old file when true. Appends when false.
 Interval: strike interval for the symbol.

 Commas used in the fileappend statements for clarity but they can
 be replaced with tabs. In power editor, highlight any comma inside
 quotes and hit the tab key.
********************************************************
}

input: filename("d:\temp.txt"), newfile(false), interval(5);

var: ntf(9999999), init(false), strike(0), diff(0), count(0);

array: moves[20](0);

ntf = next3rdfriday(1);

if ntf > ntf[1] then begin
  strike = intportion(close/interval);
  if init = true then begin
    diff = strike - strike[1] + 10;
    if diff > 19 then moves[20] = moves[20] + 1
      else if diff < 1 then moves[0] = moves[0] + 1
      else moves[diff] = moves[diff] + 1;
  end;
  init = true;
end;

if lastbaronchart then begin
  if newfile then filedelete(filename);
  fileappend(filename,
    getsymbolname + newline +
    "Strike Size = " + numtostr(interval,0) + newline +
    "Strikes,Count" + newline +
    ">9," + numtostr(moves[20],0) + newline);
  for count = 19 downto 1 begin
    fileappend(filename,
      numtostr(count-10,0) + "," + numtostr(moves[count],0) + newline);
  end;
  fileappend(filename,
    "<-9," + numtostr(moves[0],0) + newline + newline);
end;

plot1(ntf,"");


--------------------------------------
SPX
Strike Size = 5
Strikes	Count
>9	15
9	0
8	0
7	3
6	4
5	7
4	14
3	18
2	40
1	113
0	252
-1	79
-2	22
-3	10
-4	2
-5	3
-6	3
-7	2
-8	2
-9	0
<-9	8

-- 
  Dennis