SessionLastBar & Strategy Engine Calculation - futures io
futures io futures trading



SessionLastBar & Strategy Engine Calculation


Discussion in EasyLanguage Programming

Updated by andby
      Top Posters
    1. looks_one ABCTG with 4 posts (1 thanks)
    2. looks_two juveman11 with 3 posts (0 thanks)
    3. looks_3 andby with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 1,442 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 9 replies
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

SessionLastBar & Strategy Engine Calculation

(login for full post details)
  #1 (permalink)
Montreal, QC, Canada
 
Experience: Beginner
Platform: MultiCharts
Trading: Crude CL
 
juveman11's Avatar
 
Posts: 17 since Jun 2016
Thanks: 6 given, 6 received

Hi guys, I have finished reading the EL essentials PDF and I'm trying to understand how the machine calculates a strategy. The PDF mentions that by default, the strategy is calculated once at the CLOSE of the bar.

Here's a simple code on 60 min GBP/USD. I understand what's going on but trying to figure out how the machine processed it.

input: mycounter(0);
vars: mycount(0) ;

if sessionlastbar[1] then mycount = 0;
mycount= mycount +1;

if mycounter = mycount then buy next bar at market;
if marketposition = 1 then sell next bar at market;


When mycounter=1 this code buys at the open of the first bar of the session and sells at the open of the bar after it as shown in the attached screenshot.

At the close of the last bar in the session (the 16:59 bar) ---> sessionlastbar[1] is FALSE so how is it buying at the open of the 18:00 bar? It only becomes true once the 18:00 bar closes.

Please excuse my newbie-ness

Attached Thumbnails
Click image for larger version

Name:	example.png
Views:	22
Size:	26.7 KB
ID:	228027  
Reply With Quote

Can you help answer these questions
from other members on futures io?
Horizontal Line Indicator
Platforms and Indicators
Price Down, Volume Up, Open Interest Down
Traders Hideout
is there an easy way to obtain by code the price variation percentual
MultiCharts
help to convert from thinkscript to ninjascript
NinjaTrader
DLL with webrequest function for MC
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Legal question and need desperate help
183 thanks
Building a high-performance data system
18 thanks
FIO Journal Challenge - June 2020 w/SharkIndicators
15 thanks
VWAP for stock index futures trading?
11 thanks
Is Orderflow An Outdated Concept?
11 thanks
 
(login for full post details)
  #3 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,190 since Apr 2013
Thanks: 385 given, 1,426 received


juveman11,

I would suggest to add print statements to your code, so you know what's going on internally.

Something like this should show you what your code sees:

 
Code
Print( DateTimeToString( DateTime ), "; sessionlastbar = ", sessionlastbar, "; sessionlastbar[1] = ", sessionlastbar[1], "; mycounter = ", mycounter, "; mycount = ", mycount ) ;
Based on that you should gain more insights. I'd also suggest checking your session template, just to make sure that there aren't sessions ending at 1600.

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
 
(login for full post details)
  #4 (permalink)
Montreal, QC, Canada
 
Experience: Beginner
Platform: MultiCharts
Trading: Crude CL
 
juveman11's Avatar
 
Posts: 17 since Jun 2016
Thanks: 6 given, 6 received

ABCTG,

The session ends at the 16:59 bar, it even shows a dotted vertical line on my chart and I checked by plotting the session end time.

Using the print function, it is telling me that BOTH sessionlastbar and sessionlastbar[1] are true at the 16:59 bar every single time....strange

Reply With Quote
 
(login for full post details)
  #5 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,190 since Apr 2013
Thanks: 385 given, 1,426 received

juveman11,

not all reserved words can be back referenced (meaning give you the values they had on previous bars - they could simply return the current bar's value even when you check for [1]), therefore it's usually a good practice to store the reserved word in a variable and reference the variable in your code.

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #6 (permalink)
Montreal, QC, Canada
 
Experience: Beginner
Platform: MultiCharts
Trading: Crude CL
 
juveman11's Avatar
 
Posts: 17 since Jun 2016
Thanks: 6 given, 6 received


ABCTG View Post
juveman11,

not all reserved words can be back referenced (meaning give you the values they had on previous bars - they could simply return the current bar's value even when you check for [1]), therefore it's usually a good practice to store the reserved word in a variable and reference the variable in your code.

Regards,

ABCTG

Just tried it and you're right! Thanks!

Reply With Quote
 
(login for full post details)
  #7 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,190 since Apr 2013
Thanks: 385 given, 1,426 received

juveman11,

great, thanks for letting me know.

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
 
(login for full post details)
  #8 (permalink)
Norwich, UK
 
Experience: Intermediate
Platform: Multiple:research&executi
Broker: Started with Stage5/OEC ... multiple
Trading: Anything found profitable goes ...
 
andby's Avatar
 
Posts: 160 since Jul 2012
Thanks: 87 given, 84 received


ABCTG View Post
juveman11,

not all reserved words can be back referenced (meaning give you the values they had on previous bars - they could simply return the current bar's value even when you check for [1]), therefore it's usually a good practice to store the reserved word in a variable and reference the variable in your code.

Regards,

ABCTG

What's the definition of this function (sessionlastbar) - I don't see it available in Tradestation.

thx

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #9 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,190 since Apr 2013
Thanks: 385 given, 1,426 received

andby,

it's a reserved word that is exclusive to Multicharts.

Regards,

ABCTG


andby View Post
What's the definition of this function (sessionlastbar) - I don't see it available in Tradestation.

thx


Follow me on Twitter Visit my Facebook Reply With Quote
 
(login for full post details)
  #10 (permalink)
Norwich, UK
 
Experience: Intermediate
Platform: Multiple:research&executi
Broker: Started with Stage5/OEC ... multiple
Trading: Anything found profitable goes ...
 
andby's Avatar
 
Posts: 160 since Jul 2012
Thanks: 87 given, 84 received



ABCTG View Post
andby,

it's a reserved word that is exclusive to Multicharts.

Regards,

ABCTG

Alright, so no custom equivalent function written in EL that could be imported?

Understood ...

Visit my futures io Trade Journal Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > SessionLastBar & Strategy Engine Calculation


June 1, 2018


Upcoming Webinars and Events
 

Getting Comfortable with Price Action Patterns w/Earn2Trade

Aug 4
 

Live Video Panel: Ask Me Anything w/Ironbeam Brokerage

Aug 6
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts