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

Re: EL question - static variables - clarification



PureBytes Links

Trading Reference Links

Gary and all others on this subject, thanks for the input.  It is 
greatly appreciated.

I think I now have a handle on what I was calling static (or 
persistent) variables.  It seems like if you don't reference a back 
bar, then the variable contains what it was last changed to and that 
TS just carries that value forward from bar to bar and leaves it the 
same unless you change it.

> You might want to re-consider your "morning" test, though.  I don't 
> know what bar size you run this on -- how many bars are there before 
> 10:00?  If only 1, then you're OK, as long as you run it in the right 
> timezone.  It would be a bit more flexible to use an offset from 
> Sess1StartTime so your system would work fo any market open time. 
> 
I like the Sess1StartTime.  I'll start incorporating that into my 
FirstBarOfDay function.

> Another possibility is to dispense with WentLong/WentShort altogether 
> and use some of the built-in EL functions.  EntryDate(N) returns the 
> date of the entry N positions ago.  0 is the date of entry for the 
> current position (returns 0 if flat), 1 returns the entry date of the 
> most recently closed position.  So "EntryDate(1) <> Date" is true if 
> you haven't closed out any trades today.  "EntryDate(0) <> Date and 
> EntryDate(1) <> Date" is true if you haven't entered ANY trades 
> today, whether you're currently in a trade or not.
> 
Love the EntryDate stuff.  I am now making good use of it.

My big issue is that I'd like to be able to set an exit price and have 
that be the actual price where it exits.  For example, say the 
high/open of a bar is 10 and the low/close of a bar is 8.  When this 
occurs, I want to exit my long position the next time the stock 
price hits 7.  How can I do this?  What statement would I use so 
on the next bar, if the high/open is 8 and the low/close is 5, I get 
an execution of my order at 7? Which would be best:
ExitLong at 7 limit
ExitLong at 7 or lower
ExitLong at 7 stop
something else?

One more thing, if I put in an order such as "buy at 7 limit", that 
order is only good for the next bar, not good till cancelled, correct?  
(Hope so, cause I couldn't find anything about cancelling orders or 
finding out what orders I have open except for tracking center and 
I'm only doing backtesting at this time).

Thanks,

Cash



> Gary
> 



"Buy Low, Sell High"
(If this statment is used for financial gain, I am entitled to 10% of all profits. ;) )