I start by trying to make (or lose) $100.00 on every trade (call this entry longOne).
My setup allows me to buy a certain number of shares and then make or lose the $100.00 by setting a stop loss which is priced the same number of cents away from my entry as is my profit target.
If I win cleanly, I enter once and close out my $100.00 profit.
If I reach -$50.00, however, I want to add 50% more shares (call this long2). If this happens, my target prices do not change, so if I win, it is $175.00, or if I lose, it costs me $125.00.
Things currently look like this:
protected override void Initialize()
{
TimeInForce = Cbi.TimeInForce.Day;
ForceMaximumBarsLookBack256 = false;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.UniqueEntries;
}
protected override void OnBarUpdate()
{
// Long Entry 1
if ((Position.MarketPosition == MarketPosition.Flat)
&& ((Closes[2][0] < pointA)
&& (Closes[2][0] >= pointB))
{
EnterLongLimit(2, true, shares1, entryPrice1, "longOne");
SetProfitTarget("longOne", CalculationMode.Price, (entryPrice1 + increment);
SetStopLoss("longOne", CalculationMode.Price, (entryPrice1 - increment), false);
}
// Long Entry 2
else if ((Position.MarketPosition == MarketPosition.Long)
&& ((Closes[2][0] < pointA - (increment/2))
&& (Closes[2][0] >= pointB - (increment/2))
{
EnterLongLimit(2, true, shares1 * 0.5, entryPrice1 - (increment/2), "longTwo");
SetProfitTarget("longTwo", CalculationMode.Price, (entryPrice1 + increment);
SetStopLoss("longTwo", CalculationMode.Price, (entryPrice1 - increment), false);
}
The first Trade fires and is perfectly accurate. The second trade then never fires.
By the way the Bar Indexed as 2 is a tick bar, not that this really matters, but just for ease of interpretation.
Any ideas or help?
Thanks in advance,
Andrew
Comment