本人觉得用大智慧中的江恩正方实在是太烦了,因为它没有将阻力位(支撑位)的价码明显标识出来,而是要用鼠标一个个点击小方格。出于分析的考虑,就开始尝试用Python实现它,代码部分不用我多说了,大家细细体会便可,或者干脆直接在Python中运行也行。
#Gann_Matrix.py

defGetKeyPositions():
Ret=[]
Ret.append(1)

#left-topcornerline
forixinrange(1,9):
ifix%2==0:
val=ix*ix+1
Ret.append(val-ix/2)
Ret.append(val)

#rith-bottomcornerline
forixinrange(3,10):
ifix%2<>0:
val=ix*ix
Ret.append(val-ix/2)
Ret.append(ix*ix)

#right-topcornerline
forixinrange(1,8):
ifix%2<>0:
val=(ix+1)*(ix+1)-ix
Ret.append(val-(ix+1)/2)
Ret.append(val)

#left-bottomcornerline
forixinrange(1,9):
ifix%2==0:
val=(ix+1)*(ix+1)-ix
Ret.append(val-ix/2)
Ret.append(val)

Ret.sort()
returnRet


defDisputablePrices(InitVal,Step,Format):
if(InitVal<0)or(Step<0):
return

Prices=[]
forixinrange(1,82):
Prices.append(InitVal+(ix-1)*Step)

KeyPos=GetKeyPositions()

ifFormat:
PriceStr=''
forixinKeyPos:
PriceStr+='%.2f'%(Prices[ix-1])
if(KeyPos.index(ix)+1)%8==0:
PriceStr+=' '

print'%s %s'%('[Prices]',PriceStr)
else:
forixinKeyPos:printPrices[ix-1]

print'%s InitValue=%f;Step=%f;RecordCount=%d'%
('[Params]',InitVal,Step,len(KeyPos))

#下面主代码体中提供了两种方式显示数据,一种是按每行8个价格排列,另一种是按竖列一次性排列出,参数Format的值可为True/False;

#使用时,要先设置初始价格(InitPrice)和单位步长(Step);

#对于寻找阻力位而言,通常选择历史最低点作为初始价格,相反,对于寻找支撑位而言,通常选择历史最高点作为初始价格;

#单位步长的设置,通常有两种方式。一种是按波动率(一定时长内的波动点数),另一种是按1,0.1,0.01,0.001,0.0001方式设置(遵循宇宙中所有物质的自然规律,总是由量变到质变的过程)

if__name__=="__main__":
InitPrice=4.74
Step=0.1
Format=True
DisputablePrices(InitPrice,Step,Format)


#enfoffile
输出执行结果如下:
[Prices]
4.74 4.84 4.94 5.04 5.14 5.24 5.34 5.44
5.54 5.74 5.94 6.14 6.34 6.54 6.74 6.94
7.14 7.44 7.74 8.04 8.34 8.64 8.94 9.24
9.54 9.94 10.34 10.74 11.14 11.54 11.94 12.34
12.74
[Params]
InitValue = 4.740000; Step = 0.100000; RecordCount = 33