SessionLastBar & Strategy Engine Calculation - futures io

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

# SessionLastBar & Strategy Engine Calculation

 (login for full post details) #1 (permalink) Elite Member Montreal, QC, Canada   Experience: Beginner Platform: MultiCharts Trading: Crude CL     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

Can you help answer these questions
from other members on futures io?
 Horizontal Line IndicatorPlatforms and Indicators Price Down, Volume Up, Open Interest DownTraders Hideout is there an easy way to obtain by code the price variation percentualMultiCharts help to convert from thinkscript to ninjascriptNinjaTrader DLL with webrequest function for MCMultiCharts

in the last 7 days on futures io
 Legal question and need desperate help183 thanks Building a high-performance data system18 thanks FIO Journal Challenge - June 2020 w/SharkIndicators15 thanks VWAP for stock index futures trading?11 thanks Is Orderflow An Outdated Concept?11 thanks

Hamburg Germany

Broker: DTN IQ

Posts: 2,190 since Apr 2013

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

 (login for full post details) #4 (permalink) Elite Member Montreal, QC, Canada   Experience: Beginner Platform: MultiCharts Trading: Crude CL     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

 (login for full post details) #5 (permalink) Vendor: www.abctradinggroup.com  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
 The following user says Thank You to ABCTG for this post:

Experience: Beginner
Platform: MultiCharts

Posts: 17 since Jun 2016

ABCTG
 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!

 (login for full post details) #7 (permalink) Vendor: www.abctradinggroup.com  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

Norwich, UK

Experience: Intermediate
Platform: Multiple:research&executi
Broker: Started with Stage5/OEC ... multiple
Trading: Anything found profitable goes ...

Posts: 160 since Jul 2012

ABCTG
 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

Hamburg Germany

Broker: DTN IQ

Posts: 2,190 since Apr 2013

andby,

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

Regards,

ABCTG

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

Norwich, UK

Experience: Intermediate
Platform: Multiple:research&executi
Broker: Started with Stage5/OEC ... multiple
Trading: Anything found profitable goes ...

Posts: 160 since Jul 2012

ABCTG
 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 ...

 futures io > SessionLastBar & Strategy Engine Calculation

June 1, 2018

Upcoming Webinars and Events

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