calculate past data - EasyLanguage Programming | futures io social day trading
futures io futures trading


calculate past data
Updated: Views / Replies:550 / 9
Created: by loi5139 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 90,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

Reply
 
Thread Tools Search this Thread
 

calculate past data

  #1 (permalink)
Trading Apprentice
NewYork, NY
 
Futures Experience: None
Platform: tradestation
Favorite Futures: na
 
Posts: 7 since May 2016
Thanks: 1 given, 1 received

calculate past data

Hi experts,

I'm totally noob to EL, so sorry if this bothers you a bit, but any help would be greatly appreciated.

I'd like to know how to reference past data and calculate the information at that specific time. I've read the books and understand how to reference past data based on time/date. But, when it comes to caculate series of data FROM a specific time in the past, i'm a bit stuck.

Example:
-I'm at time 1000
-I want to calculate MACD (Close, 8,23,11) NOT at current time but FROM 0959, then FROM 0958, so on and so forth for the past 5 min.

I was able to program the function to calculate the MACD from current time. But, i don't know how to reference and calculate from a specific time in the past without referencing the exact time in my code. i want my code to reference, t-1min, t-2min, t-3min, etc...

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)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 855 received
Forum Reputation: Legendary


loi5139,

I am not exactly sure if I understand you correctly, but wouldn't it work to access the previous values for the MACD directly? If you store the MACD in a variable, you can access its previous values like with any other variable.

Regards,

ABCTG

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
NewYork, NY
 
Futures Experience: None
Platform: tradestation
Favorite Futures: na
 
Posts: 7 since May 2016
Thanks: 1 given, 1 received

If i use the MACD function, it will calculate the current close price of current bar plus the close price of previous bars as i specified.

Doing so, i might not get the correct data if the current bar hasn't closed yet. Say i'm using a 1min chart and i'm 15seconds into the bar.

If i'm at 1000 and calculate the MACD into 15seconds (at time 10:00:15) of the current bar and store it, that data is not accurate because the bar has not closed yet. In the same line of thought, it'd only accurate if i calculate the MACD from 0959 since the data is complete.

I might not fully understand the whole thing, but judging from MACD graph in TS, the MACD histogram of the current bar moves up/down as the market evolves.

If i use MACD[11], it will calculate MACD from the current bar with the previous number of bars as indicated. I'm right or wrong?

Reply With Quote
 
  #5 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 855 received
Forum Reputation: Legendary


loi5139 View Post
If i use MACD[11], it will calculate MACD from the current bar with the previous number of bars as indicated. I'm right or wrong?

Let's assume you have a variable called MACD, then MACD[11] will be the value that variable had at the close 11 bars before the current bar.

I am still unclear of what you are trying to achieve, but you will likely run into issues when you try to access intrabar timestamps. In indicators you can't directly access intrabar information for historical bars and in signals with intrabar order generation I'd say from the top of the head the exact timestamp of the ticks is not available in Tradestation (definitely not via legacy EasyLanguage and I wouldn't suggest using OOEL concepts without having a solid understanding of EasyLanguage first).

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #6 (permalink)
Trading Apprentice
NewYork, NY
 
Futures Experience: None
Platform: tradestation
Favorite Futures: na
 
Posts: 7 since May 2016
Thanks: 1 given, 1 received

Ok, I think i understand now. Please tell me if i'm right.

So i'm at time 1000.
If i use EL MACD function as it, it will calculate the current bar data with previous close as indicated in the function variable.

If i use MACD(Close,9,14)[1], it will calculate the data from bar at 0959. MACD(Close,9,14)[2] from bar at 0958, so on and so forth. Am i correct?

Basically, i'm trying to use the MACDDiff value from each of the previous 5 bars.


Last edited by loi5139; May 23rd, 2016 at 07:41 AM.
Reply With Quote
 
  #7 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 855 received
Forum Reputation: Legendary

When you take a look at the default MACD indicator code, there are three variables that hold the values for the MACD and histogram.

 
Code
MyMACD = MACD( Close, FastLength, SlowLength ) ;
MACDAvg = XAverage( MyMACD, MACDLength ) ;
MACDDiff = MyMACD - MACDAvg ;
If you write MACDDiff[1] in your code the for example, this will give you the value of the histogram on the previous bar.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #8 (permalink)
Trading Apprentice
NewYork, NY
 
Futures Experience: None
Platform: tradestation
Favorite Futures: na
 
Posts: 7 since May 2016
Thanks: 1 given, 1 received

I tried this MACD( Close[1], FastLength, SlowLength ), then Close[2], Close[3], etc...

That does exactly what i wanted, it calculates the MACD from past bar. It's like accessing MACD data in the past.

This doesn't work though: MACD( Close, FastLength, SlowLength )[2]

I tried that and compared the data with TS's chart data, and the function return different data.

Thanks

Reply With Quote
 
  #9 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 855 received
Forum Reputation: Legendary

When using these three versions:

 
Code
MyMACD = MACD( Close, FastLength, SlowLength ) ;

Plot1( MyMACD[1], "MyMACD" ) ;

MyMACD2 = MACD( Close[1], FastLength, SlowLength ) ;

Plot2( MyMACD2, "MyMACD2" ) ;

Plot3( MACD( Close, FastLength, SlowLength )[1], "MyMACD3" ) ;
Plot1 and Plot3 give you the same result as it's basically the same statement.
In the beginning Plot2 will differ as you start with a different price.
On a long enough timeline Plot2 will closely match the other two, too. This is caused by the nature of the exponential average that will contain traces of all data points.

If the method used for Plot2 gives you what you are looking for, then use that.
By the way you can show your appreciation for a post here on Futures.io using the "Thanks" button under it.

Regards,

ABCTG

Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
  #10 (permalink)
Trading Apprentice
NewYork, NY
 
Futures Experience: None
Platform: tradestation
Favorite Futures: na
 
Posts: 7 since May 2016
Thanks: 1 given, 1 received


Thanks for your explaination. Was very helpful.

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

Reply



futures io > > > > > calculate past data

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate price of a contract? jirakst Commodities Futures Trading 6 July 14th, 2015 12:23 PM
Using Historical data of past years to formulate a bias for current day trading Rad4633 Traders Hideout 7 November 12th, 2013 08:09 PM
Calculate Developing Value Area Mauro_60 NinjaTrader Programming 8 September 24th, 2013 03:08 PM
Software to Calculate/Chart correlation from streaming data? maxplanck Platforms and Indicators 6 November 10th, 2011 12:32 PM
Calculate MACD divergence scarr Traders Hideout 9 August 20th, 2011 01:15 PM


All times are GMT -4. The time now is 04:12 PM.

Copyright © 2017 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
Page generated 2017-12-15 in 0.14 seconds with 19 queries on phoenix via your IP 54.90.92.204