NexusFi: Find Your Edge


Home Menu

 





Help with understanding EL bar references


Discussion in EasyLanguage Programming

Updated
    1. trending_up 4,208 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
oldhickory
Honolulu, HI
 
Posts: 1 since Jan 2022
Thanks Given: 1
Thanks Received: 0

Hello,

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:
 
Code
[IntrabarOrderGeneration = false]

if OutsideBar( High, Low ) and Close > Open then
	Buy ( !( "OutBarLE" ) ) next bar at High limit;
Exit:
 
Code
[IntrabarOrderGeneration = true]

if MarketPosition <> 0 then
	Sell ( "Exit Name" ) next bar at EntryPrice + 0.10 limit ;
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.


Attached Thumbnails
Click image for larger version

Name:	OBLEHigh.png
Views:	149
Size:	56.4 KB
ID:	321802   Click image for larger version

Name:	OBLEHigh1.png
Views:	141
Size:	58.4 KB
ID:	321803  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
ATFX Suspends Prop Trading Unit ATFunded -- Full Review …
Funded Trading Evaluation Firms
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,737 since Jul 2012
Thanks Given: 1,917
Thanks Received: 7,476


oldhickory View Post
Hello,

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:
 
Code
[IntrabarOrderGeneration = false]

if OutsideBar( High, Low ) and Close > Open then
	Buy ( !( "OutBarLE" ) ) next bar at High limit;

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):

 
Code
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;


Follow me on X Reply With Quote
Thanked by:




Last Updated on January 30, 2022


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts