I need some help understanding how to reference previous bars within EL. I am working on a strategy that trades based on if the previous bar was an outside bar.
Entry:
Exit:
The problem is when I go to set the price for my limit order it does not reference the high of the previous bar (the outside bar) but rather the high of the current bar (which just ends up being the open). When I attempt to use High[1] to reference the previous bar it references the bar behind the outside bar. I've attached screenshots for more detail.
Obviously there is something I'm not understanding about how bars are referenced. If someone is willing to enlighten me I would appreciate it.
Can you help answer these questions from other members on futures io?
What you are doing here is evaluating the CURRENT bar to see if it is an outside bar. And you want to see if the bar before this one is an outside bar, right?
Couple ways to do it, I'd do it this way (easiest way to read):
var:obBar(False);
obBar=OutsideBar(High,Low) ; //ObBar will be true if this bar is outside bar, false if not
if ObBar[1] and Close > Open then //is previous bar an outside bar?
Buy ( !( "OutBarLE" ) ) next bar at High limit;
The following 2 users say Thank You to kevinkdog for this post: