[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with Code for Exiting on day of Entry



PureBytes Links

Trading Reference Links

Hi Everyone,

I was under the impression that it wasn't possible to exit on the day of
entry via a stop, but an associate gave me some code that said it was
possible. I altered it slightly to fit my situation but it doesn't seem
to be working.  First of all, is my code below actually achievable, and
if so, can someone help please by pointing out my logic or coding error?

I am basically entering during the day or the open, and then wish to
exit either on the close or via a move against my entry price.  The
former is for the day of entry only, while the latter is ongoing.

-----------------

If MarketPosition = -1 then begin
 If date = entrydate then begin   
 If Close > Open then SetExitOnClose;  {exiting on close on day of entry
only}
 End;
 If PositionBasis then
  SetStopPosition
 Else
  SetStopContract;
 SetStopLoss(Maxlist(VolStop*Close,5));   {VolStop being a ratio of
range}
End;

---------------------

Regards,
Adrian