量化軟件下載:赫茲股票期貨量化軟件概念上的飛躍 (II)
計劃
我們需從基礎開始。 以下代碼的行為將符合我們的預期:
#property copyright "Daniel Jose" #property indicator_chart_window #property indicator_plots 0 //+------------------------------------------------------------------+ int OnInit() { ? ? ? ?long id = ChartID(); ? ? ? ?string sz0 = (string)ObjectsTotal(id, -1, -1) + (string)MathRand(); ? ? ? ?ObjectCreate(id, sz0, OBJ_CHART, 0, 0, 0); ? ? ? ?ObjectSetInteger(id, sz0, OBJPROP_XDISTANCE, 10); ? ? ? ?ObjectSetInteger(id, sz0, OBJPROP_YDISTANCE, 10); ? ? ? ?ObjectSetInteger(id, sz0, OBJPROP_XSIZE, 300); ? ? ? ?ObjectSetInteger(id, sz0, OBJPROP_YSIZE, 300); ? ? ? ?ObjectSetInteger(id, sz0, OBJPROP_PRICE_SCALE, false); ? ? ? ?ObjectSetInteger(id, sz0, OBJPROP_DATE_SCALE, false); ? ? ? ? ? ? ? ? ?return INIT_SUCCEEDED; } //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, ? ? ? ? ? ? ? ?const int prev_calculated, ? ? ? ? ? ? ? ?const int begin, ? ? ? ? ? ? ? ?const double &price[]) { ? ? ? ?return rates_total; } //+------------------------------------------------------------------+