Now comes the laborious task of testing all of the exit criteria and there is one glaring issue. The initial profit target is not being honored. It is not closing out of that part of the trade.
The basic idea is that a series of conditions creates a Signal Candle and from that signal candle the entry, stop, & target prices come - all done with percentages of the signal candle.
I have attached a picture of one of the trades. As you can see, 2 entries were done at 135.83 and exited at a nice profit at 142.06.
The problem is that the blue line is where LongEntryA should have exited. (FYI, this is not actually where is should exit in real trading - it is just the settings that I have in the code for now).
Below is code that I have that I think is pertinent to help someone find where my error is.
Variables:
// Variables dealing with Actual Entries & Exits
private IOrder LongEntryA; // This is the name of the Long Entry A Order
private IOrder LongEntryB; // This is the name of the Long Entry B Order
private IOrder LongStopA; // This is the name of the Long Entry A Stop Order
private IOrder LongStopB; // This is the name of the Long Entry B Stop Order
private IOrder LongLimit;
protected override void OnBarUpdate()
{
/* Conditions for Long Entry */
if (Close[0] > Open[0]
&& Close[0] > MAEnvelopes(MAEPerc, 3, 25).Upper[0]
&& Aroon(14).Up[0] == 100
&& Close[0] > ParabolicSAR(0.02, 0.2, 0.02)[0]
&& Close[0] > Ichimoku(9, 26, 52).KijunSen[0]
&& Close[0] > SMA(SMAPeriod)[0]
&& !barResetUp)
{
signalHigh = High[0];
signalLow = Low[0];
//Order Entries A & B
LongEntryA = EnterLongStop(DefaultQuantity, TrendPilotPricesLong(EntryPerc, StopPerc, TargetPerc).LongEntry[0], "LongEntryA");
LongEntryB = EnterLongStop(DefaultQuantity, TrendPilotPricesLong(EntryPerc, StopPerc, TargetPerc).LongEntry[0], "LongEntryB");
// Initial Stop Losses & Profit Target
LongLimit = ExitLongLimit(TrendPilotPricesLong(EntryPerc, StopPerc, TargetPerc).LongTarget[0],"LongLimit","LongEntryA");
LongStopA = ExitLongStop(TrendPilotPricesLong(EntryPerc, StopPerc, TargetPerc).LongStop[0],"LongStopA","LongEntryA");
LongStopB = ExitLongStop(TrendPilotPricesLong(EntryPerc, StopPerc, TargetPerc).LongStop[0],"LongStopB","LongEntryB");
barResetUp = true;
}

Comment