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

Re: EL help needed.



PureBytes Links

Trading Reference Links

> Greetings gentles all.
> 
> I'm trying to code something in EL and was wondering whether I'm going
> about it the hard way.  Your assistance would be greatly appreciated.
> 
> I enter long on a particular bar at some particular price and I want to
> make the stop the previous bar's close minus some step value.
> 
> How does one refer to the bar that is one back from the Entrybar?
> 
> At the moment I am waiting until the bar after entry and using something
> like:
> 
>    If BarsSinceEntry = 1 and MarketPosition > 0 
>    then ExitLong at Close[2] - step
> 
>    If BarsSinceEntry = 1 and MarketPosition < 0 
>    then ExitShort at Close[2] + step
> 
> Alas, this approach is not proving very reliable.  Usually what happens is
> that 10 or 20 bars later in the day the market will go thru the stop price
> and not exit the position.  Its like the order is not valid any more?  Or
> TS has forgotten about it?

Yes, TS has forgotten AS you told it so,,,,,,, 

"" If BarsSinceEntry = 1"" obviously only works on the VERY next bar - thats 
youre problem - TRY

    If BarsSinceEntry = 1 and MarketPosition <> 0 then begin
	ExitLong at Close[2] - step;
   	ExitShort at Close[2] + step;
   end;

This will:

- begin and NOT forget

- work on ANY position OTHER than FLAT, i.e. <>0 (safes typing)

- can EXITlong and SHORT in one step as TS cant do one or the other without 
being LONG or short before, so cant do any harm (safes typing again)

rgds hans