using System;
using System.Drawing;
using System.Collections.Generic;
using RightEdge.Common;
using RightEdge.Indicators;
public class SystemMain : SystemBase
{
public override void Startup()
{
// Perform initialization or set system wide options here
PositionManager.PositionTimeOut = 7;
PositionManager.ProfitTarget = 0.03;
}
public override void NewSymbolBar(Symbol symbol, BarData bar)
{
// This line of code runs the actions you have set up in in the Project Form
IListbars = Bars[symbol];
int t = bars.Count-1;
// Should not be necessary but apparently LeadBars Property is ignored
if (bars.Count > 12)
{
if (bars[t-1].High < bars[t-2].High && bars[t-2].High < bars[t-3].High)
{
if(bars[t].High > bars[t-1].High)
{
if (DownBar(bars[t-1]) && DownBar(bars[t-2]) && DownBar(bars[t-3]))
OpenPosition(symbol, PositionType.Long, OrderType.MarketOnOpen);
}
}
}
Actions.RunActions(symbol);
}
private bool DownBar(BarData bar)
{
return (bar.Close < bar.Open);
}
}
... and if someone could tell me how to force blogger to indent code properly, I'd be most grateful.
No comments:
Post a Comment