Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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;
Can you help answer these questions from other members on NexusFi?
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;
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."
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."
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.