NexusFi: Find Your Edge


Home Menu

 





Help with understanding EL bar references


Discussion in EasyLanguage Programming

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




 
Search this Thread

Help with understanding EL bar references

  #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:	84
Size:	56.4 KB
ID:	321802   Click image for larger version

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

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,360


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 Twitter Reply With Quote
Thanked by:




Last Updated on January 30, 2022


© 2024 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 - Privacy Policy - Downloads - Top
no new posts