- UID
- 2
- 积分
- 2893097
- 威望
- 1396580 布
- 龙e币
- 1496517 刀
- 在线时间
- 13326 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-26
|
[TS源码] Predicting an Event [EasyLanguage Code]
EasyLanguage Code To TesT The Predictability Of An Event
本帖隐藏的内容需要回复才可以浏览 - Vars:
- Event(false),
- FuturePrice(0),
- I(0),
- CG(0),
- Denom(0);
- Arrays:
- PredictBin[100](0);
- {>>>>>>>>> Code for Event Goes Here <<<<<<<<<<}
- If Event Then Begin
- FuturePrice = 100*(Close - Close[9]) / Close[9]; //Future is referenced to 10 bars back
- If FuturePrice < -10 Then FuturePrice = -10; //Limits lower price to -10%
- If FuturePrice > 10 Then FuturePrice = 10; //Limits higher price to +10%
- FuturePrice = 5*(FuturePrice + 10); //scale -10% to +10% to be 0 - 100
- End;
- //Place the FuturePrices into one of 100 bins
- If FuturePrice <> FuturePrice[1] Then Begin
- For I = 1 to 100 Begin
- If FuturePrice > I - 1 and FuturePrice <= I Then PredictBin[I] = PredictBin[I] + 1;
- End;
- End;
- //Measure center of gravity as a quick estimate
- CG = 0;
- Denom = 0;
- For I = 1 to 100 Begin
- CG = CG + I*PredictBin[I];
- Denom = Denom + PredictBin[I];
- End;
- CG = (CG/Denom-50)/5;
- Plot1(CG);
- If LastBarOnChart Then Begin
- For I = 0 to 100 Begin
- Print(File("C:\PDFTest\PDF.CSV"), .2*I - 10, ",", PredictBin[I]);
- End;
- End;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|