以随机进场为基础的趋势系统(wealth-lab)
思路:随机产生0-100的数值。数值大于49多头进场,否则空头进场。进场后,多头10新低退出,空头10新高退出。
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
Random autoRand = new Random( );
for(int bar = 20; bar < Bars.Count; bar++)
{
if (IsLastPositionActive)
{
double level = (LastPosition.PositionType == PositionType.Long) ? Lowest.Series(Low, 10)[bar] : Highest.Series(High, 10)[bar];
ExitAtStop( bar+1, LastPosition,level);
}
else
{
double r=100 * autoRand.NextDouble( );
if(r>49)
BuyAtMarket( bar+1);
else
ShortAtMarket( bar+1);
}
}
}
}
}
楼主写的MyStrategy类继承的WealthScript是什么?
自己顶一下!!
是否还没有随机函数?