这个是股票
- #property indicator_chart_window
- #property indicator_buffers 1
-
-
- extern int p1 = 30000;
-
- double VAR1[];
- double Sell1[];
-
- double MA(double price[], int period)
- {
- double sum = 0;
- for (int i = 0; i < period; i++)
- {
- sum += price[i];
- }
- return sum / period;
- }
-
- int COUNT(double value[], int period)
- {
- int count = 0;
- for (int i = 0; i < period; i++)
- {
- if (value[i] != 0)
- {
- count++;
- }
- }
- return count;
- }
-
- int init()
- {
- // 设置指标的绘图样式
- SetIndexStyle(0, DRAW_LINE);
- SetIndexBuffer(0, VAR1);
-
- return 0;
- }
-
- int start()
- {
- int i, limit;
-
- limit = MathMin(Bars - 1, IndicatorCounted());
-
- // 计算VAR1和Sell1
- for (i = limit; i >= 0; i--)
- {
- double sum = 0;
- for (int j = i; j < i + 4; j++)
- {
- sum += High[j] + Low[j] + Open[j] + Close[j];
- }
- VAR1[i] = sum / 4;
- }
-
- for (i = limit; i >= 0; i--)
- {
- double ma = 0;
-
-
- {
- sum += VAR1[j] * (1 - p1 / 30000);
- }
- ma = sum / 10;
- Sell1[i] = ma * (1 - p1 / 30000) + 0.003 * COUNT(VAR1, 600);
- }
-
- return 0;
- }
复制代码
标改成mt4指标的。 |