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 am struggling to make this seasonality indicator from TradeStation work in MC. The code is a step beyond my average at best coding abilities.
I am getting an error message which is pointing towards the "SData(Null)" in the second line of the code. Any help would be great fully received. The indicator basically looks at the last 5 years of historical data on a weekly basis and plots the expected seasonal trend over the coming weeks and months.
Inputs: YearsToConsider(5);
vars: elsystem.collections.Vector SData(null), int Elements(0), int X(0),
OKToStart(FALSE), int CurYear(0), int CurPeriod(0), int YearCount(0),
double TempVal(0), double TempPerf(0), FirstYear(0), CumPerf(0);
method void AnalysisTechnique_Initialized( elsystem.Object sender, elsystem.InitializedEventArgs args )
begin
SData = New elsystem.collections.Vector ;
If Bartype = 3 then Elements = 52;
If Bartype = 4 then Elements = 12;
For X = 1 to Elements begin
SData.insert(0,0.0);
end;
FirstYear = year(currentdate) - (YearsToConsider);
end;
CurYear = year(date);
If CurYear >= FirstYear AND Bartype >= 3 AND LastBarOnChart = FALSE then begin
If CurYear <> CurYear[1] then begin
OKToStart = True;
CurPeriod = 0;
YearCount += 1;
CumPerf = 0;
end;
If OKToStart = True then begin
If Elements = 52 and CurPeriod > 51 then CurPeriod = 51;
If YearCount = YearsToConsider then begin
CumPerf = CumPerf + SData[CurPeriod] astype double / (YearCount - 1);
Plot1[-Elements](CumPerf, "Seasonal");
end;
end;
If Year(Date) <> Year(date[1]) then begin
Value1 = TL_New(Date, time, High, Date, TIme , Low);
TL_setextleft(Value1, TRUE);
TL_setextright(Value1, TRUE);
end;
CurPeriod += 1;
end;
Can you help answer these questions from other members on NexusFi?
the code uses OOEL parts that are not available in Multicharts. You'd have to replace the vector with an array (or an Easylanguage Collection list if you prefer) and remove the method. The latter can just be replaced with a "once begin... end;" statement. The code for the vector replacement will depend on your decision to use an array or a list.
the code posted in #1 is open and free, it just needs slight modifications (as described in post #2) to make it work in MC.
If you are looking for recommendations, it might help if you describe what you want the study to do exactly.