ATR到底怎么用?每次都又问题?!
为什么大于1000的ATR还能实现?简直离谱,,但是在图表打印出来的又是不成立的数值全代码如下ParamsNumeric x(5);Numeric BH(5);Numeric dh(40); Numeric lot(0); Numeric FastLen(60); // 分钟线 Numeric SlowLen(60); //分钟 Numeric NomLen(20); //日线 Numeric NomL(10); //10日高低点 Numeric Ch(5); //前多少根日线 Numeric Length(10); //多少根分钟线 Numeric N(5); Numeric M(20); Numeric ReBar(200); Vars Numeric MinPoint(0); // 声明变量MinPoint,一个最小变动单位,也就是一跳。Numeric MyEntryPrice(0); // 声明变量MyEntryPrice,英文好的,看英文意思都知道的,开仓价格,本例是开仓均价,也可根据需要设置为某次入场的价格。 Series<Numeric> FastMA; // 快速均线 Series<Numeric> SlowMA; // 慢速均线 Numeric NomMA; Series<Numeric> BB;Series<Numeric> SS; Numeric hd; Numeric lld; Numeric h2d; Numeric l2d; Numeric sig; Series<Numeric> CCC; Series<Numeric> ReEntryCount; // 跟踪止损后记录BAR序号 Numeric MyExitPrice; // 声明变量MyExitPrice,平仓价格。 Series<Numeric> ATR; Series<Numeric> StopPri; //跟踪止损价 Series<Numeric> StopLPri; Series<Numeric> stopwin; Series<Numeric> HighValue; //多头进场之后的盈利峰值价 Series<Numeric> AF; //跟踪Acceleration Series<Numeric> HighestAfterEntry; //声明序列变量HighestAfterEntry,开仓后出现的最高价。Series<Numeric> LowestAfterEntry; //声明序列变量LowestAfterEntry,开仓后出现的最低价。 Numeric StopPrice(0); Series<Bool> Condition1(False);series<Bool> Yun(False); Numeric StopATR; Numeric J ; Numeric H; // 最近N根BAR的高点 Numeric LL; Numeric PP; // 最近N根BAR的低 Numeric DDH; Numeric Bigbar; Series<Numeric> PPP; Series<Numeric> LD; Series<Numeric> HD; Series<Bool> Yang; //锤子线阳 Series<Bool> yin;// 吊头线阴 Series<Bool> upying; Series<Bool> downying; Series<Bool> DDATR;// Series<Bool> Condition1; // 条件1// Series<Bool> Condition2; // 条件2 Numeric MyRange; //K线幅度EventsOnInit(){ Array<Numeric> timepoint; timepoint[0] = 0.145950; SetTriggerBarClose(timepoint);}OnBar(ArrayRef<Integer> indexs) { downying=(Min(Open, Close) - Low >= 0.4*(High - Low) ) ;//下影线upying=(High - Max(Open, Close) >= 0.4*(High - Low) ) ;//上影线 If(MarketPosition ==0 AND TIME >0.0900 and time <0.145) // 开仓/ { If(close[1]-low[1]>1000*ATR and low<low[1]) { Buy(0,close); BB=high[1]; } If(high[1]-close[1]>1000*ATR and high >high[1]) { SellShort(0,Close); SS=low[1]; } } } OnBarClose(ArrayRef<Integer> indexs) { /* If(BarsSinceEntry>0 and MarketPosition==1 AND High >=BB ) // 有多仓的情况下。 {Sell(0,Close); } If(BarsSinceEntry>0 and MarketPosition==-1 and Low <=SS ) {BuyToCover(0,Close);}*/ If(BarsSinceEntry>N And MarketPosition==1 ) // 有多仓的情况下。 {Sell(0,Close); } If(BarsSinceEntry>N and MarketPosition==-1 ) {BuyToCover(0,Close);} }