//basic definitions
conversion=(highest[9](high)+lowest[9](low))/2
base=(highest[26](high)+lowest[26](low))/2
//conditions for conversion/base positioning
c10=conversion > base
c11=conversion crosses over base
c12=conversion < base
c13=conversion crosses under base
//spanA and spanB future value
spanA=(conversion+base)/2
spanB=(highest[52](high)+lowest[52](low))/2
//spanA and spanB present value
maxspan=max(spanA[26],spanB[26])
minspan=min(spanA[26],spanB[26])
//conditions for future span A and B positioning
c20=spanA > spanB
c21=spanA crosses over spanB
c22=spanA < spanB
c23=spanA crosses under spanB
//conditions for present span A and B positioning
c30=close>maxspan
c31=close crosses over maxspan
c32=close<minspan
c33=close crosses under minspan
//conditions for lag line positioning
maxspanlag=max(spanA[52],spanB[52])
minspanlag=min(spanA[52],spanB[52])
c40=close>maxspanlag
c41=close crosses over maxspanlag
c42=close<minspanlag
c43=close crosses under minspanlag
clong1=c11 and c20 and c30 and c40
clong2=c10 and c21 and c30 and c40
clong3=c10 and c20 and c31 and c40
clong4=c10 and c20 and c30 and c41
cshort1=c13 and c22 and c32 and c42
cshort2=c12 and c23 and c32 and c42
cshort3=c12 and c22 and c33 and c42
cshort4=c12 and c22 and c32 and c43
long=clong1 or clong2 or clong3 or clong4
short=cshort1 or cshort2 or cshort3 or cshort4
GRAPH long
GRAPH short
buy at -close limit