Data2 for automated trading - futures io
futures io futures trading



Data2 for automated trading


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Orjan with 3 posts (0 thanks)
    2. looks_two dtrade88 with 2 posts (1 thanks)
    3. looks_3 RM99 with 2 posts (0 thanks)
    4. looks_4 EladLevi with 1 posts (0 thanks)
    1. trending_up 8,977 views
    2. thumb_up 3 thanks given
    3. group 6 followers
    1. forum 11 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,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
 

Data2 for automated trading

(login for full post details)
  #1 (permalink)
Stockholm Sweden
 
 
Posts: 20 since Apr 2012
Thanks: 12 given, 2 received

I the same Tradestation chart I have 1 minute (Data1) and 120 minute (Data2). I have put the strategy in Data1. One of my conditions is to buy when MACD of Data2 is below 0 and is rising. But when I test the strategy it neglects that condition (Condition1 in the code) and takes entries even when MACD is above 0. Greatful for input how to solve this. The strategy is verified.

My code:

Inputs: Price(Close of Data2),
Length1(12),
Length2(15);

Vars: ExpAv1(0),
ExpAv2(0),
MACD(0);

ExpAv1 = XAverage(Price, Length1) of Data2;
ExpAv2 = XAverage(Price, Length2) of Data2;

MACD = ExpAv1 - ExpAv2;

Condition1 = MACD < 0 AND MACD > MACD[1];
Condition2 = High of Data2 > High[1] of Data2;
Condition3 = High of Data1 > High[1] of Data1;

If Condition1 AND Condition2 AND Condition3 Then Buy This Bar;

Reply With Quote

Can you help answer these questions
from other members on futures io?
Reading A set of Trading Signals
EasyLanguage Programming
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
Which kind of Blockvolume is visible? - order processing
Emini and Emicro Index
Anyone have access to older, intraday data for stocks(AXP)?
Stocks and ETFs
MACD line not plotting after change of plot order
NinjaTrader
 
 
(login for full post details)
  #3 (permalink)
San Francisco, California
 
 
Posts: 28 since Mar 2010
Thanks: 1 given, 10 received


Hi,

I recommend you do the following:

1. Add Condition1(0), Condition2(0), Condition3(0) to Variables
2. Modify the "Conditions" part as follows:

Condition1 =0;
Condition2 =0;
Condition3 =0;

If (MACD < 0 AND MACD > MACD[1]) then Condition1=1;
If (High of Data2 > High[1] of Data2) then Condition2=1;
If (High of Data1 > High[1] of Data1) then Condition3=1;

If (Condition1=1 AND Condition2=1 AND Condition3=1) Then Buy This Bar;

Reply With Quote
The following user says Thank You to dtrade88 for this post:
 
(login for full post details)
  #4 (permalink)
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
 
Posts: 882 since Mar 2011
Thanks: 124 given, 701 received

I don't think you can do this unless you insert a chart into another chart and the only way you can do that is if the charts are the same interval.

This is one of my chief complaints about TS's limitations for multi-time frame trading.

The current options are to use either Global Variables, Global Dictionary, or ADE.

I have a general sender/receiver for the global dictionary, but again, that has limitations as well, it won't backtest and depending on your applications, there are time stamp issues as TS only stamps data down to the 1 minute level.

If you want backtesting capability, then you'll have to go with ADE which makes the exercise beyond most moderate programming capabilities (you'd need a 3rd party code consultant).

If you can figure this out, I'd be very interested, but I've spoken with TS developers actually on the phone and they were supposed to be working on a temporary refinement of the GD sender and receiver to make it simpler to use.

I'm willing to bet that you're getting null values on your data2.

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
 
(login for full post details)
  #5 (permalink)
Stockholm Sweden
 
 
Posts: 20 since Apr 2012
Thanks: 12 given, 2 received

dtrade88,

Thanks, but it did not solve the problem.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
London
 
 
Posts: 118 since Mar 2010
Thanks: 42 given, 58 received

use next bar instead of this bar


 
Code
buy next bar market;

Reply With Quote
 
(login for full post details)
  #7 (permalink)
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
 
Posts: 882 since Mar 2011
Thanks: 124 given, 701 received

Disregard my post.....I was confusing time based charts with "advanced" charts. TS will not allow you to insert another chart for advanced types of different intervals.

For those of us who don't use time based charts, it's just another obstacle and limitation of range, renko, kase, kagi, tick charts, etc.

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
 
(login for full post details)
  #8 (permalink)
San Francisco, California
 
 
Posts: 28 since Mar 2010
Thanks: 1 given, 10 received

Given that your Data1 is 1min and your Data2 is 120min and you want TS to take into account BOTH, you probably need to setup a time condition that would perform Condition1, Condition2, Condition3 calculations only at pre-determined times when BOTH, Data1 and Data2, are available.

Reply With Quote
 
(login for full post details)
  #9 (permalink)
Oslo,Norway
 
Experience: Intermediate
Platform: NinjaTrader
Trading: EUR/USD
 
ValutaTrader's Avatar
 
Posts: 66 since Apr 2011
Thanks: 4 given, 52 received


Orjan View Post
I

ExpAv1 = XAverage(Price, Length1) of Data2;
ExpAv2 = XAverage(Price, Length2) of Data2;

MACD = ExpAv1 - ExpAv2;

rjan,

Put the code above into a separate function MACD_calc and you may get a different result.
MACD=MACD_calc(Price, Length1, Length2) of Data2

Function
MACD_calc

input :
Price(numericseries),
Length1( numericsimple ),
Length1( numericsimple ) ;

variables: ExpAv1(0), ExpAv2(0);

ExpAv1 = XAverage(Price, Length1) ;;
ExpAv2 = XAverage(Price, Length2) ;

MACD_calc = ExpAv1 - ExpAv2;

Follow me on Twitter Reply With Quote
The following 2 users say Thank You to ValutaTrader for this post:
 
(login for full post details)
  #10 (permalink)
Stockholm Sweden
 
 
Posts: 20 since Apr 2012
Thanks: 12 given, 2 received


Thank you ValutaTrader,

I have solved the problem.

Reply With Quote
 
(login for full post details)
  #11 (permalink)
minneapolis MN/USA
 
 
Posts: 2 since Mar 2016
Thanks: 3 given, 0 received

Hello,

Can I automate my trading strategies on Tick or Range charts instead of using Time charts.

Thanks

Reply With Quote
 
(login for full post details)
  #12 (permalink)
Tel Aviv, Israel
 
 
Posts: 1 since Jan 2021
Thanks: 0 given, 0 received


Orjan View Post
Thank you ValutaTrader,

I have solved the problem.

Hi There,
I'm facing the same issue BOTH with a data1 as min bar of ES and data2 as daily bars of ES.D
any ideas what I'm doing wrong?

thanks,
E.

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Data2 for automated trading


Last Updated on January 7, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 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