Variable assignment changes output? - EasyLanguage Programming | futures io social day trading
futures io futures trading

Variable assignment changes output?
Updated: Views / Replies:497 / 2
Created: by TahuPhoenix Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Thread Tools Search this Thread

Variable assignment changes output?

  #1 (permalink)
Trading Apprentice
Lund Sweden
Futures Experience: Intermediate
Platform: MultiCharts
Favorite Futures: Stocks
Posts: 4 since Feb 2015
Thanks: 1 given, 0 received

Variable assignment changes output?

Dear Forums,

I recently wrote a bit of code which purpose is to calculate Intraday-Turnover no matter what resolution you're looking at. The results:

	Intrabarpersist Turnover(0),

Turnover = Turnover + (Close * Ticks);
countDays = countDays + 1;
if(Date <> Date[countDays]) then
	Turnover = Close * Ticks;
	countDays = 0;

Plot1(Turnover, "Turnover");
The code calculates the intraday value of all contracts which was sold and resets until the next day, and it seems to work fine.

Out of curiosity and learning, I wanted to make an array which stored the Close of the last bar of each day, no matter the resolution. I figured that since I've got some code that already figures out when the next day comes, this shouldn't be a problem.

New Code:

	Intrabarpersist Turnover(0),

	daysArray[] (0);

Turnover = Turnover + (Close * Ticks);
countDays = countDays + 1;
if(Date <> Date[countDays]) then
	Turnover = Close * Ticks;
	countDays = 0;
	daysArray[count] = Close[currentbar];
        count = count + 1;
Plot1(Turnover, "Turnover");

And now the results are completely different. As soon as I try to assign any variable to "Close[currentbar]", the rest of my code stop working properly. How come this is? It's driving me nuts. I know I can use different data series, but for this experiment I'm trying to fit it into the same.

All the best,

Reply With Quote
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

  #3 (permalink)
Hamburg Germany
Futures Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
Posts: 1,839 since Apr 2013
Thanks: 298 given, 1,123 received
Forum Reputation: Legendary


when you index a reserved word or variable to get the value from X bars back the values start from the current bar and go up. Currentbar = 0, 1 = the bar on the left from the currentbar etc.

With Close[CurrentBar] you are likely trying to look at a bar that is not even accessible. Assume you are at CurrentBar = 100, with Close[100] you try to access the 100th bar left from the current bar. Which means you'd need 101 bars on the chart, but only have 100 at current bar 100.
Long story short you have to use Close[0] to get the current close at the moment of the code calculation.


Reply With Quote
The following user says Thank You to ABCTG for this post:


futures io > > > > > Variable assignment changes output?

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

Journal Challenge w/Earn2Trade and $599 in Prizes


Anthony Drager: TBA

Nov 29

Linda Raschke: TBA

Elite only

Peter Davies: TBA

Dec 6

Brannigan Barrett: TBA

Elite only

Cannon Trading: Ask Me Anything

Dec 13

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Output of Indicator for Input to another mrlucky1x MultiCharts 1 January 17th, 2015 06:39 AM
Output Window Excel question patbateman NinjaTrader Programming 8 April 23rd, 2013 09:13 PM
Assignment to sell something kbit Jokes 0 May 17th, 2012 09:27 PM
Grade 3 Math Assignment Quick Summary News and Current Events 0 October 28th, 2011 12:10 PM
Normalizing output from Indicators Trader.Jon NinjaTrader Programming 2 November 27th, 2010 01:01 PM

code, data series, easylanguage, information, intraday, multicharts, neoticker, tradestation, values, variable

All times are GMT -4. The time now is 09:34 AM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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
Page generated 2018-11-20 in 0.09 seconds with 14 queries on phoenix