Hi All,
I was wondering whether some EL Guru could point me in the direction of a solution to this challenge???
I want to transfer Close data from 23 individual MC price charts to be used in a Portfolio BackTester strategy trading the same 23 symbols.
The code below works perfectly on an MC feeder workspace to MC strategy workspace basis:
Code: Select all
// MultiCharts to MultiCharts
//Sender Code
[LegacyColorValue = true];
Vars: Class("OHLCV"),// class name for our test data
Vol(0);
// Calculate correct total volume regardless of bar type
Vol = IFF(BarType < 2, UpTicks + DownTicks, Volume);
// Store the data for this symbol and bar interval
Value1 = ADE.PutOHLCV(GetSymbolName, ADE.BarInterval, ADE.BarID, Open, High, Low, Close, Vol);
Code: Select all
// MultiCharts to MultiCharts
//Receiver Code
ade1 = ADE.GetOHLCV("SPY",0, ADE.BarID, Value1, Value2, Value3, SPY_Close, Value4);
ade2 = ADE.GetOHLCV("SH", 0, ADE.BarID, Value5, Value6, Value7, SH_Close, Value8);
ade3 = ADE.GetOHLCV("QQQ",0, ADE.BarID, Value9, Value10, Value11, QQQ_Close, Value12);
//ETC...
To transfer the data between applications Tech Support advised I need to save the OHLCV data to a file that then was called from the Strategy. I tried this:
Code: Select all
// MultiCharts to File code
//Sender Code
Inputs:
UseFile(ADE.UseFile);
Vars:
Class("OHLCV"),
Vol(0),
WriteOk(true);
// If UseFile is true, load any previously stored data from the file on the first bar.
if CurrentBar = 1 and UseFile then
Value1 = ADE.OpenMap(Class, GetSymbolName, ADE.BarInterval);
// Calculate correct total volume regardless of bar type
Vol = IFF(BarType < 2, UpTicks + DownTicks, Volume);
// Store the data for this symbol and bar interval
Value1 = ADE.PutOHLCV(GetSymbolName, ADE.BarInterval, ADE.BarID, Open, High, Low, Close, Vol);
// If UseFile is true, save the data to the file on the last bar.
if LastBarOnChart and BarStatus(1) = 2 and UseFile and WriteOk then begin
Value1 = ADE.SaveMap(Class, GetSymbolName, ADE.BarInterval);
WriteOk = false; // prevent repeated writes on new bars
end;
Code: Select all
// File to PortfolioBactester code
//Receiver Code
Inputs:
UseFile(ADE.UseFile),
Interval(0);
Vars:
Class("OHLCV"), // class name for our test data
ade1(0),ade2(0),ade3(0),SPY_Close( 0 ),SH_Close( 0 ),QQQ_Close( 0 );
// If UseFile is true, load any previously stored data from the file on the first bar.
if CurrentBar = 1 and UseFile then begin
Value1 = ADE.OpenMap(Class,"SPY",Interval);
Value1 = ADE.OpenMap(Class,"SH",Interval);
Value1 = ADE.OpenMap(Class,"QQQ",Interval);
//ETC...
end;
// Get Close data from other charts
ade1 = ADE.GetOHLCV("SPY", 0, ADE.BarID, Value1, Value2, Value3, SPY_Close, Value4);
ade2 = ADE.GetOHLCV("SH", 0, ADE.BarID, Value5, Value6, Value7, SH_Close, Value8);
ade3 = ADE.GetOHLCV("QQQ", 0, ADE.BarID, Value9, Value10, Value11, QQQ_Close, Value12);
//ETC...
Anthony