I'm new to MC and have moved all of my TS code over with the exception of one strategy. It uses the Global Dictionary in TS to send data between two strategies. I did my due diligence and installed the elcollections and functions. I still get the same error when I try to compile it in MC.
Each chart uses 2 minute bars.
What this strategy does is it runs two (almost) identical strategies (A) and (B) in two different charts. Strategy A passes the value of it's equity curve to strategy B which then toggles the strategy on or off based on filter criteria. Below is an example of my code.
Put Strategy:
Code: Select all
Using elsystem.collections;
Vars: GlobalDictionary GD(null);
method override void InitializeComponent()
begin
GD = GlobalDictionary.Create(false,"IES");
end;
< standard strategy code - then at the bottom of the code the following builds an array with the equity curve and pitches it to the other strategy >
//------------------Set up Global Dictionary Pitcher------------------------
Inputs:
UniquePitcherName("A100"), //This can be changed to allow different variations of the same test
LRSlopeLen(30);
Array: a_NetPL[](0);
condition1 = Array_setmaxindex(a_NetPL,LRSlopeLen);
Vars: MainGDName(Symbol+"_"+numtostr(bartype,0)+"_"+numtostr(barinterval,0)+ UniquePitcherName+"_"),
FullGDName(""),
Dstr(""),
Tstr(""),
TotTds(0),
oLRSlope( 0 ),
oLRAngle( 0 ),
oLRIntercept( 0 ),
oLRValueRaw( 0 ) ;
Dstr = numtostr(D,0);
Tstr = numtostr(T,0);
FullGDName = MainGDName + Dstr + Tstr;
TotTds = TotalTrades;
If TotTds > TotTds[1] then begin
For value1 = LRSlopeLen downto 2 begin
a_NetPL[value1] = a_NetPL[value1-1];
end;
a_NetPL[1] = netprofit;
If TotTds >= LRSlopeLen then Value1 = LinRegArray( a_NetPL, LRSlopeLen, 0, oLRSlope, oLRAngle, oLRIntercept, oLRValueRaw ) ;
end;
GD.Items[FullGDName] = oLRSlope astype double;