This is the 1.0 version of a general framework with exits to use with every kind of strategy. The main idea is that the trade exits, in general, are very simililar, so we can divide, modularize and reuse the exits. The same idea is applied to position sizing and signal tracking (is how your strategy reads the indicators). A small manual is inlcuded, and I believe that this framework can evolute to a real reusable piece of software for almost every strategy. The onExit() method is called to reset and manage the signals, LookForTrade() to open positions, and ManagePositions() to build your own custom exit. Below you can see some example methods. The public are invited to upgrade it.
public class MyStrategy : StrategyFramework {....
protected override void MyInitialize() {
base.Add(RSI(rsiPeriod,3));
base.Add(SMA(10));
base.Add(SMA(20));
}
protected override void LookForTrade() {
if (Close[0] > Open[0])
positionManager.Position1.EnterLong();
}
protected override void UpdateSignals() {
if (CrossAbove(RSI(rsiPeriod, 3).Avg, rsiHigh, 1))
rsiSignal = -1;
if (CrossBelow(RSI(rsiPeriod, 3).Avg, rsiLow, 1))
rsiSignal = 1;
}
protected override void OnExit(object sender, int positionID) {
rsiSignal = 0;
}
regards,
Henry
Category The Elite Circle
|
|
|