if(Position.MarketPosition == MarketPosition.Long)
{
if (CrossBelow(Close,DayOpen, 1))
ExitLong();
double DStop = Position.AvgPrice-stop;
double DTarget=Position.AvgPrice+target;
PrintWithTimeStamp("Entered Long. DayOpen is:"+DayOpen.ToString()+"EntryPrice :"+Position.AvgPrice+" ProfitTarget :"+DTarget.ToString()+ " Stop :"+DStop.ToString());
//SetStopLoss("LE",CalculationMode.Price,Position.Av gPrice-DStop,false);
//SetProfitTarget("LE",CalculationMode.Price,Positio n.AvgPrice+DTarget);
ExitLongStop(DStop,"LStop");
ExitLongLimit(DTarget,"LTarget");
}
Here is the print log output for the trade in question:
9/29/2014 1:40:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:41:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:42:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:43:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:44:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:45:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:46:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:47:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:48:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:49:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
9/29/2014 1:50:00 PM Entered Long. DayOpen is:1964EntryPrice :1964.75 ProfitTarget :1965.75 Stop :1963.25
The trade exits on the close and the market traded much higher than my entryprice.
Here is a copy from the analyzer :
Trade-# Instrument Account Strategy Market pos. Quantity Entry price Exit price Entry time Exit time Entry name Exit name Profit Cum. profit Commission MAE MFE ETD Bars 214 ES 12-14 Backtest SGHScalper Long 1 1964.75 1968.5 9/29/2014 1:40 PM 9/29/2014 4:15 PM Buy Exit on close 187.5 1987.5 0 50 462.5 275 141
What is wrong with my logic?
Thank you,
David
Comment