Load multiple .apx projects simulatanelously

I am trying to build a 'system' where I have several .apx projects open simultaneously, such as this, all doing different things. (1 might be linked to forex, another to stocks, another to crypt, and so on,... tbd. Such as this...
Screen Shot 2022-08-02 at 8.57.50 am

I have not found a way to save this as a 'session' so to speak. What I want to be able to do, is open Amibroker, and then execute some task and have something like above populate. Currently, I need to manually open each one.

I have tried the batch Processor > Load project. I can at least run through multiple projects at once there, but each project loads, runs, and then is replaced by the next project, all in the 1 tab, and no new tab is loaded.

I tried using layouts, but that is only effective if the project is already open, which, upon opening amibroker in the first place, they are not, until I open them manually.

I tried saving as both the original database, and a new database, just in case that might work. Unfortunately it did not.

Is there a tool I am unaware of? If not, does anyone have a useful workflow they use?

I am thinking the best approach might be to create a folder for each desired 'instance layout' and in that folder, save all of the projects that I would like to open, name them so they appear in that folder in an order I like, then just manually open them one by one, then apply a layout that I have previously defined.

PS, I just want to say, I am delighted with Amibroker. It's a steep learning curve and I'm realy enjoying it. I'm aware that I am currently asking more questions that I am answering,.... but that is because I don't yet have the knowledge of the program. I'll certainly contribute where I can as my experience and skill improves. What a wonderful program though!

@SpandexMan you can take a look at this past thread where we discussed about some 3rd party solutions to "automate" complex layouts.

1 Like

Hello SpandexMan,

in my opinion there is one possibility to implement this requirement via ole. However, this could be not recommended. Please study ole and the possibility to address individual analysis windows/items(). In principle, an analysis project with all the necessary information is saved in apx format and can be used in the future as an executable template. apx is an xml format that contains all the parameters of the analysis and could also be modified using xml parse/write so that for different scenarios on the same analysis several actually identical templates of the same "afl" exploration would have to be derived ... By Amibroker everything is possible ! Here is one simple sample, sure you have to enhance ... and you will find tonnes of alf snips in this forum (c) by Tomasz, fxshrat, Ed, beppe, Milosz ... all our "Pros"

Trigger Analysis Execution in your ChartWindow:

_SECTION_BEGIN( "_ole_apx_execute" );

apxexecute = ParamTrigger( "APX Demo", "[ Execute ]" );

if( apxexecute == True )
{
    AB = CreateObject( "Broker.Application" );
    AD = AB.AnalysisDocs();
    apxload = AD.Open( "C:\\APXDEMO\\APX_Demo.apx" ); // you have to create/modify this apx path
    
/// @link https://www.amibroker.com/guide/objects.html    
    apxrun = apxload.Run( 1 );
}

_SECTION_END();

APX_Demo.afl

/*
1. Send APX_Demo.afl to Analysis Window
2. Configure all your necessary "Settings" for this Exploration
3. Test/Check via Execute this Exploration is working correct
4. AB Menu - File - Save As .apx -> C:\APXDEMO\AFL_Demo.apx 
*/

Filter = 1;
AddColumn( C, "Close", 1.2, colorBlack, colorWhite, 150 );

APX_Demo.apx

<AmiBroker-Analysis CompactMode="0">
<General>
<FormatVersion>1</FormatVersion>
<Symbol>DXM#</Symbol>
<FormulaPath>Formulas\\RT_M_0.0.2.0\\OLE\\APX_Demo.afl</FormulaPath>
<FormulaContent>/*\r\n1. Send APX_Demo.afl to Analysis Window\r\n2. Confiure all your necessary "Settings" for this Exploration\r\n2. Test/Check via Execute this Exploration is working correct\r\n3. AB Menu - File - Save As .apy -&gt; C:\\APX\\AFL_Demo.apx \r\n*/\r\n\r\nFilter = 1;\r\nAddColumn( C, "Close", 1.2, colorBlack, colorWhite, 150 );\r\n</FormulaContent>
<ApplyTo>0</ApplyTo>
<RangeType>1</RangeType>
<RangeAmount>1</RangeAmount>
<FromDate>2021-05-02 00:00:00</FromDate>
<ToDate>2021-05-02</ToDate>
<SyncOnSelect>0</SyncOnSelect>
<RunEvery>0</RunEvery>
<RunEveryInterval>5min</RunEveryInterval>
<IncludeFilter>
<ExcludeMode>0</ExcludeMode>
<OrSelection>0</OrSelection>
<Favourite>0</Favourite>
<Index>0</Index>
<Type0>0</Type0>
<Category0>-1</Category0>
<Type1>1</Type1>
<Category1>-1</Category1>
<Type2>2</Type2>
<Category2>-1</Category2>
<Type3>3</Type3>
<Category3>-1</Category3>
<Type4>4</Type4>
<Category4>0</Category4>
<Type5>5</Type5>
<Category5>-1</Category5>
<Type6>6</Type6>
<Category6>-1</Category6>
</IncludeFilter>
<ExcludeFilter>
<ExcludeMode>1</ExcludeMode>
<OrSelection>0</OrSelection>
<Favourite>0</Favourite>
<Index>0</Index>
<Type0>0</Type0>
<Category0>-1</Category0>
<Type1>1</Type1>
<Category1>-1</Category1>
<Type2>2</Type2>
<Category2>-1</Category2>
<Type3>3</Type3>
<Category3>-1</Category3>
<Type4>4</Type4>
<Category4>-1</Category4>
<Type5>5</Type5>
<Category5>-1</Category5>
<Type6>6</Type6>
<Category6>-1</Category6>
</ExcludeFilter>
</General>
<BacktestSettings>
<InitialEquity>10000</InitialEquity>
<TradeFlags>1</TradeFlags>
<MaxLossStopMode>0</MaxLossStopMode>
<MaxLossStopValue>0</MaxLossStopValue>
<MaxLossStopAtStop>0</MaxLossStopAtStop>
<ProfitStopMode>0</ProfitStopMode>
<ProfitStopValue>0</ProfitStopValue>
<ProfitStopAtStop>0</ProfitStopAtStop>
<TrailingStopMode>0</TrailingStopMode>
<TrailingStopPeriods>0</TrailingStopPeriods>
<TrailingStopValue>0</TrailingStopValue>
<TrailingStopAtStop>0</TrailingStopAtStop>
<CommissionMode>0</CommissionMode>
<CommissionValue>0</CommissionValue>
<BuyPriceField>0</BuyPriceField>
<BuyDelay>0</BuyDelay>
<SellPriceField>0</SellPriceField>
<SellDelay>0</SellDelay>
<ShortPriceField>0</ShortPriceField>
<ShortDelay>0</ShortDelay>
<CoverPriceField>0</CoverPriceField>
<CoverDelay>0</CoverDelay>
<ReportSystemFormula>0</ReportSystemFormula>
<ReportSystemSettings>0</ReportSystemSettings>
<ReportOverallSummary>1</ReportOverallSummary>
<ReportSummary>1</ReportSummary>
<ReportTradeList>1</ReportTradeList>
<LoadRemainingQuotes>1</LoadRemainingQuotes>
<Periodicity>7</Periodicity>
<InterestRate>0</InterestRate>
<ReportOutPositions>1</ReportOutPositions>
<UseConstantPriceArrays>0</UseConstantPriceArrays>
<PointsOnlyTest>0</PointsOnlyTest>
<AllowShrinkingPosition>0</AllowShrinkingPosition>
<RangeType>1</RangeType>
<RangeLength>0</RangeLength>
<RangeFromDate>2021-05-02 00:00:00</RangeFromDate>
<RangeToDate>2021-05-02</RangeToDate>
<ApplyTo>0</ApplyTo>
<FilterQty>2</FilterQty>
<IncludeFilter>
<ExcludeMode>0</ExcludeMode>
<OrSelection>0</OrSelection>
<Favourite>0</Favourite>
<Index>0</Index>
<Type0>0</Type0>
<Category0>-1</Category0>
<Type1>1</Type1>
<Category1>-1</Category1>
<Type2>2</Type2>
<Category2>-1</Category2>
<Type3>3</Type3>
<Category3>-1</Category3>
<Type4>4</Type4>
<Category4>0</Category4>
<Type5>5</Type5>
<Category5>-1</Category5>
<Type6>6</Type6>
<Category6>-1</Category6>
</IncludeFilter>
<ExcludeFilter>
<ExcludeMode>1</ExcludeMode>
<OrSelection>0</OrSelection>
<Favourite>0</Favourite>
<Index>0</Index>
<Type0>0</Type0>
<Category0>-1</Category0>
<Type1>1</Type1>
<Category1>-1</Category1>
<Type2>2</Type2>
<Category2>-1</Category2>
<Type3>3</Type3>
<Category3>-1</Category3>
<Type4>4</Type4>
<Category4>-1</Category4>
<Type5>5</Type5>
<Category5>-1</Category5>
<Type6>6</Type6>
<Category6>-1</Category6>
</ExcludeFilter>
<UseOptimizedEvaluation>0</UseOptimizedEvaluation>
<BacktestRangeType>0</BacktestRangeType>
<BacktestRangeLength>1</BacktestRangeLength>
<BacktestRangeFromDate>Invalid DateTime</BacktestRangeFromDate>
<BacktestRangeToDate>Invalid DateTime</BacktestRangeToDate>
<MarginRequirement>100</MarginRequirement>
<SameDayStops>0</SameDayStops>
<RoundLotSize>0</RoundLotSize>
<TickSize>0</TickSize>
<DrawdownPriceField>0</DrawdownPriceField>
<ReverseSignalForcesExit>1</ReverseSignalForcesExit>
<NoDefaultColumns>0</NoDefaultColumns>
<AllowSameBarExit>1</AllowSameBarExit>
<ExtensiveOptimizationWarning>1</ExtensiveOptimizationWarning>
<WaitForBackfill>0</WaitForBackfill>
<MaxRanked>4</MaxRanked>
<MaxTraded>4</MaxTraded>
<MaxTracked>100</MaxTracked>
<PortfolioReportMode>0</PortfolioReportMode>
<MinShares>0.1</MinShares>
<SharpeRiskFreeReturn>5</SharpeRiskFreeReturn>
<PortfolioMode>0</PortfolioMode>
<PriceBoundCheck>1</PriceBoundCheck>
<AlignToReferenceSymbol>0</AlignToReferenceSymbol>
<ReferenceSymbol>^DJI</ReferenceSymbol>
<UPIRiskFreeReturn>5.4</UPIRiskFreeReturn>
<NBarStopMode>0</NBarStopMode>
<NBarStopValue>0</NBarStopValue>
<NBarStopReentryDelay>0</NBarStopReentryDelay>
<MaxLossStopReentryDelay>0</MaxLossStopReentryDelay>
<ProfitStopReentryDelay>0</ProfitStopReentryDelay>
<TrailingStopReentryDelay>0</TrailingStopReentryDelay>
<AddFutureBars>0</AddFutureBars>
<DistChartSpacing>5</DistChartSpacing>
<ProfitDistribution>1</ProfitDistribution>
<MAFEDistribution>1</MAFEDistribution>
<IndividualDetailedReports>0</IndividualDetailedReports>
<PortfolioReportTradeList>1</PortfolioReportTradeList>
<LimitTradeSizeAsPctVol>10</LimitTradeSizeAsPctVol>
<DisableSizeLimitWhenVolumeIsZero>1</DisableSizeLimitWhenVolumeIsZero>
<UsePrevBarEquityForPosSizing>0</UsePrevBarEquityForPosSizing>
<NBarStopHasPriority>0</NBarStopHasPriority>
<UseCustomBacktestProc>0</UseCustomBacktestProc>
<CustomBacktestProcFormulaPath/>
<MinPosValue>0</MinPosValue>
<MaxPosValue>0</MaxPosValue>
<ChartInterval>5</ChartInterval>
<DisableRuinStop>0</DisableRuinStop>
<OptTarget>CAR/MDD</OptTarget>
<WFMode>0</WFMode>
<GenerateReport>1</GenerateReport>
<MaxLongPos>0</MaxLongPos>
<MaxShortPos>0</MaxShortPos>
<SeparateLongShortRank>0</SeparateLongShortRank>
<TotalSymbolQty>2</TotalSymbolQty>
<EnableUserReportCharts>1</EnableUserReportCharts>
<ChartWidth>800</ChartWidth>
<ChartHeight>480</ChartHeight>
<SettlementDelay>0</SettlementDelay>
<PortfolioReportSystemFormula>1</PortfolioReportSystemFormula>
<InterestRateSymbol/>
<MarginRate>0</MarginRate>
<IncludeBHStats>1</IncludeBHStats>
<BHSymbol>^DJI</BHSymbol>
<MCEnable>1</MCEnable>
<MCRuns>1000</MCRuns>
<MCPosSizeMethod>0</MCPosSizeMethod>
<MCPosSizeShares>100</MCPosSizeShares>
<MCPosSizeValue>1000</MCPosSizeValue>
<MCPosSizePctEquity>5</MCPosSizePctEquity>
<MCChartEquityCurves>1</MCChartEquityCurves>
<MCStrawBroomLines>0</MCStrawBroomLines>
<Scenario>0</Scenario>
<MCChartEquityScale>0</MCChartEquityScale>
<MCUseEquityChanges>0</MCUseEquityChanges>
<MCLogScaleFinalEquity>0</MCLogScaleFinalEquity>
<MCLogScaleDrawdown>0</MCLogScaleDrawdown>
<MCNegativeDrawdown>1</MCNegativeDrawdown>
<ISEnabled>1</ISEnabled>
<ISStartDate>2000-01-01</ISStartDate>
<ISEndDate>2004-01-01</ISEndDate>
<ISLastDate>2020-01-01</ISLastDate>
<ISStep>1</ISStep>
<ISStepUnit>3</ISStepUnit>
<ISAnchored>0</ISAnchored>
<ISLastUsesToday>1</ISLastUsesToday>
<OSEnabled>1</OSEnabled>
<OSStartDate>2004-01-01</OSStartDate>
<OSEndDate>2005-01-01</OSEndDate>
<OSLastDate>2020-01-01</OSLastDate>
<OSStep>1</OSStep>
<OSStepUnit>3</OSStepUnit>
<OSAnchored>0</OSAnchored>
<OSLastUsesToday>1</OSLastUsesToday>
</BacktestSettings>
</AmiBroker-Analysis>

20220803_apx_execute

Best regards,
Peter

1 Like

@beppe Thanks for that. Some interesting ides to explore in that thread. Huge gratitude to pointing me to that. I'm trying to reduce my dependency on 3rd party stuff as the machine I am using is a bit temperamental.
@Pietro Yeah, thanks, that's really useful. I haven's come to that part of my learning yet, but will certainly come back to this when I am more advanced. Thanks so much. :pray:

1 Like
<AmiBroker-Analysis CompactMode="0">
<General>
<FormatVersion>1</FormatVersion>
<Symbol>DXM#</Symbol>
<FormulaPath>Formulas\\RT_M_0.0.2.0\\OLE\\APX_Demo.afl</FormulaPath>
<FormulaContent>/*\r\n1. Send APX_Demo.afl to Analysis Window\r\n2. Confiure all your necessary "Settings" for this Exploration\r\n2. Test/Check via Execute this Exploration is working correct\r\n3. AB Menu - File - Save As .apy -&gt; C:\\APX\\AFL_Demo.apx \r\n*/\r\n\r\nFilter = 1;\r\nAddColumn( C, "Close", 1.2, colorBlack, colorWhite, 150 );\r\n</FormulaContent>
<ApplyTo>0</ApplyTo>
<RangeType>1</RangeType>
<RangeAmount>1</RangeAmount>
<FromDate>2021-05-02 00:00:00</FromDate>
<ToDate>2021-05-02</ToDate>
<SyncOnSelect>0</SyncOnSelect>
<RunEvery>0</RunEvery>
<RunEveryInterval>5min</RunEveryInterval>
<IncludeFilter>
<ExcludeMode>0</ExcludeMode>
<OrSelection>0</OrSelection>
<Favourite>0</Favourite>
<Index>0</Index>
<Type0>0</Type0>
<Category0>-1</Category0>
<Type1>1</Type1>
<Category1>-1</Category1>
<Type2>2</Type2>
<Category2>-1</Category2>
<Type3>3</Type3>
<Category3>-1</Category3>
<Type4>4</Type4>
<Category4>0</Category4>
<Type5>5</Type5>
<Category5>-1</Category5>
<Type6>6</Type6>
<Category6>-1</Category6>
</IncludeFilter>
<ExcludeFilter>
<ExcludeMode>1</ExcludeMode>
<OrSelection>0</OrSelection>
<Favourite>0</Favourite>
<Index>0</Index>
<Type0>0</Type0>
<Category0>-1</Category0>
<Type1>1</Type1>
<Category1>-1</Category1>
<Type2>2</Type2>
<Category2>-1</Category2>
<Type3>3</Type3>
<Category3>-1</Category3>
<Type4>4</Type4>
<Category4>-1</Category4>
<Type5>5</Type5>
<Category5>-1</Category5>
<Type6>6</Type6>
<Category6>-1</Category6>
</ExcludeFilter>
</General>
<BacktestSettings>
<InitialEquity>10000</InitialEquity>
<TradeFlags>1</TradeFlags>
<MaxLossStopMode>0</MaxLossStopMode>
<MaxLossStopValue>0</MaxLossStopValue>
<MaxLossStopAtStop>0</MaxLossStopAtStop>
<ProfitStopMode>0</ProfitStopMode>
<ProfitStopValue>0</ProfitStopValue>
<ProfitStopAtStop>0</ProfitStopAtStop>
<TrailingStopMode>0</TrailingStopMode>
<TrailingStopPeriods>0</TrailingStopPeriods>
<TrailingStopValue>0</TrailingStopValue>
<TrailingStopAtStop>0</TrailingStopAtStop>
<CommissionMode>0</CommissionMode>
<CommissionValue>0</CommissionValue>
<BuyPriceField>0</BuyPriceField>
<BuyDelay>0</BuyDelay>
<SellPriceField>0</SellPriceField>
<SellDelay>0</SellDelay>
<ShortPriceField>0</ShortPriceField>
<ShortDelay>0</ShortDelay>
<CoverPriceField>0</CoverPriceField>
<CoverDelay>0</CoverDelay>
<ReportSystemFormula>0</ReportSystemFormula>
<ReportSystemSettings>0</ReportSystemSettings>
<ReportOverallSummary>1</ReportOverallSummary>
<ReportSummary>1</ReportSummary>
<ReportTradeList>1</ReportTradeList>
<LoadRemainingQuotes>1</LoadRemainingQuotes>
<Periodicity>7</Periodicity>
<InterestRate>0</InterestRate>
<ReportOutPositions>1</ReportOutPositions>
<UseConstantPriceArrays>0</UseConstantPriceArrays>
<PointsOnlyTest>0</PointsOnlyTest>
<AllowShrinkingPosition>0</AllowShrinkingPosition>
<RangeType>1</RangeType>
<RangeLength>0</RangeLength>
<RangeFromDate>2021-05-02 00:00:00</RangeFromDate>
<RangeToDate>2021-05-02</RangeToDate>
<ApplyTo>0</ApplyTo>
<FilterQty>2</FilterQty>
<IncludeFilter>
<ExcludeMode>0</ExcludeMode>
<OrSelection>0</OrSelection>
<Favourite>0</Favourite>
<Index>0</Index>
<Type0>0</Type0>
<Category0>-1</Category0>
<Type1>1</Type1>
<Category1>-1</Category1>
<Type2>2</Type2>
<Category2>-1</Category2>
<Type3>3</Type3>
<Category3>-1</Category3>
<Type4>4</Type4>
<Category4>0</Category4>
<Type5>5</Type5>
<Category5>-1</Category5>
<Type6>6</Type6>
<Category6>-1</Category6>
</IncludeFilter>
<ExcludeFilter>
<ExcludeMode>1</ExcludeMode>
<OrSelection>0</OrSelection>
<Favourite>0</Favourite>
<Index>0</Index>
<Type0>0</Type0>
<Category0>-1</Category0>
<Type1>1</Type1>
<Category1>-1</Category1>
<Type2>2</Type2>
<Category2>-1</Category2>
<Type3>3</Type3>
<Category3>-1</Category3>
<Type4>4</Type4>
<Category4>-1</Category4>
<Type5>5</Type5>
<Category5>-1</Category5>
<Type6>6</Type6>
<Category6>-1</Category6>
</ExcludeFilter>
<UseOptimizedEvaluation>0</UseOptimizedEvaluation>
<BacktestRangeType>0</BacktestRangeType>
<BacktestRangeLength>1</BacktestRangeLength>
<BacktestRangeFromDate>Invalid DateTime</BacktestRangeFromDate>
<BacktestRangeToDate>Invalid DateTime</BacktestRangeToDate>
<MarginRequirement>100</MarginRequirement>
<SameDayStops>0</SameDayStops>
<RoundLotSize>0</RoundLotSize>
<TickSize>0</TickSize>
<DrawdownPriceField>0</DrawdownPriceField>
<ReverseSignalForcesExit>1</ReverseSignalForcesExit>
<NoDefaultColumns>0</NoDefaultColumns>
<AllowSameBarExit>1</AllowSameBarExit>
<ExtensiveOptimizationWarning>1</ExtensiveOptimizationWarning>
<WaitForBackfill>0</WaitForBackfill>
<MaxRanked>4</MaxRanked>
<MaxTraded>4</MaxTraded>
<MaxTracked>100</MaxTracked>
<PortfolioReportMode>0</PortfolioReportMode>
<MinShares>0.1</MinShares>
<SharpeRiskFreeReturn>5</SharpeRiskFreeReturn>
<PortfolioMode>0</PortfolioMode>
<PriceBoundCheck>1</PriceBoundCheck>
<AlignToReferenceSymbol>0</AlignToReferenceSymbol>
<ReferenceSymbol>^DJI</ReferenceSymbol>
<UPIRiskFreeReturn>5.4</UPIRiskFreeReturn>
<NBarStopMode>0</NBarStopMode>
<NBarStopValue>0</NBarStopValue>
<NBarStopReentryDelay>0</NBarStopReentryDelay>
<MaxLossStopReentryDelay>0</MaxLossStopReentryDelay>
<ProfitStopReentryDelay>0</ProfitStopReentryDelay>
<TrailingStopReentryDelay>0</TrailingStopReentryDelay>
<AddFutureBars>0</AddFutureBars>
<DistChartSpacing>5</DistChartSpacing>
<ProfitDistribution>1</ProfitDistribution>
<MAFEDistribution>1</MAFEDistribution>
<IndividualDetailedReports>0</IndividualDetailedReports>
<PortfolioReportTradeList>1</PortfolioReportTradeList>
<LimitTradeSizeAsPctVol>10</LimitTradeSizeAsPctVol>
<DisableSizeLimitWhenVolumeIsZero>1</DisableSizeLimitWhenVolumeIsZero>
<UsePrevBarEquityForPosSizing>0</UsePrevBarEquityForPosSizing>
<NBarStopHasPriority>0</NBarStopHasPriority>
<UseCustomBacktestProc>0</UseCustomBacktestProc>
<CustomBacktestProcFormulaPath/>
<MinPosValue>0</MinPosValue>
<MaxPosValue>0</MaxPosValue>
<ChartInterval>5</ChartInterval>
<DisableRuinStop>0</DisableRuinStop>
<OptTarget>CAR/MDD</OptTarget>
<WFMode>0</WFMode>
<GenerateReport>1</GenerateReport>
<MaxLongPos>0</MaxLongPos>
<MaxShortPos>0</MaxShortPos>
<SeparateLongShortRank>0</SeparateLongShortRank>
<TotalSymbolQty>2</TotalSymbolQty>
<EnableUserReportCharts>1</EnableUserReportCharts>
<ChartWidth>800</ChartWidth>
<ChartHeight>480</ChartHeight>
<SettlementDelay>0</SettlementDelay>
<PortfolioReportSystemFormula>1</PortfolioReportSystemFormula>
<InterestRateSymbol/>
<MarginRate>0</MarginRate>
<IncludeBHStats>1</IncludeBHStats>
<BHSymbol>^DJI</BHSymbol>
<MCEnable>1</MCEnable>
<MCRuns>1000</MCRuns>
<MCPosSizeMethod>0</MCPosSizeMethod>
<MCPosSizeShares>100</MCPosSizeShares>
<MCPosSizeValue>1000</MCPosSizeValue>
<MCPosSizePctEquity>5</MCPosSizePctEquity>
<MCChartEquityCurves>1</MCChartEquityCurves>
<MCStrawBroomLines>0</MCStrawBroomLines>
<Scenario>0</Scenario>
<MCChartEquityScale>0</MCChartEquityScale>
<MCUseEquityChanges>0</MCUseEquityChanges>
<MCLogScaleFinalEquity>0</MCLogScaleFinalEquity>
<MCLogScaleDrawdown>0</MCLogScaleDrawdown>
<MCNegativeDrawdown>1</MCNegativeDrawdown>
<ISEnabled>1</ISEnabled>
<ISStartDate>2000-01-01</ISStartDate>
<ISEndDate>2004-01-01</ISEndDate>
<ISLastDate>2020-01-01</ISLastDate>
<ISStep>1</ISStep>
<ISStepUnit>3</ISStepUnit>
<ISAnchored>0</ISAnchored>
<ISLastUsesToday>1</ISLastUsesToday>
<OSEnabled>1</OSEnabled>
<OSStartDate>2004-01-01</OSStartDate>
<OSEndDate>2005-01-01</OSEndDate>
<OSLastDate>2020-01-01</OSLastDate>
<OSStep>1</OSStep>
<OSStepUnit>3</OSStepUnit>
<OSAnchored>0</OSAnchored>
<OSLastUsesToday>1</OSLastUsesToday>
</BacktestSettings>
</AmiBroker-Analysis>

I saw the post of the above code and thought... "I wonder what happens if I open that file in notepad 2.....
clarity

This opens up so many possibilities!!!

It works!!!!!

You guys are awesome!!

@Pietro I modified your code as specified and got this.

_SECTION_BEGIN( "Binance Klines Execute" );

bkload = ParamTrigger( "Binance Kline Layout", "Load Binance Klines" );

if( bkload == True )
{
    AB = CreateObject( "Broker.Application" );
    AD = AB.AnalysisDocs();
    binklin5min = AD.Open( "C:\\Program Files\\AmiBroker\\Formulas\\Project\\Binance\\5 min kline.apx");
    binklin15min = AD.Open( "C:\\Program Files\\AmiBroker\\Formulas\\Project\\Binance\\15m in kline.apx");
    binklin1h = AD.Open( "C:\\Program Files\\AmiBroker\\Formulas\\Project\\Binance\\1hr kline.apx");
    binklin1d = AD.Open( "C:\\Program Files\\AmiBroker\\Formulas\\Project\\Binance\\1d kline.apx");
    binklin1w = AD.Open( "C:\\Program Files\\AmiBroker\\Formulas\\Project\\Binance\\1w kline.apx");

    bk5mrun = binklin5min.Run( 1 );
    bk15mrun = binklin15min.Run( 1 );
    bk1hrun = binklin1h.Run( 1 );
    bk1drun = binklin1d.Run( 1 );
    bk1wrun = binklin1w.Run( 1 );
}

_SECTION_END();

and I ended up with
klines
This is absolutely awesome. And I can use layouts here. So it looks like Amibroker could literally be used to create an interface for any broker!! Just, wow. Mind blown today.

I came to Amibroker expecting that it would be able to do a lot of the things I wanted but ultimately would not not be able to do all of the things I want it to be able to do. I have learned that it can do everything I want it to, and more, and stretch and develop my skills in the process. Well done!!

@Tomasz this is a truly wonderful product.

3 Likes

Please notice this correction:

4. AB Menu - File - Save As .apx -> C:\APXDEMO\APX_Demo.apx 
1 Like

@SpandexMan, i think this afl snip could be additional useful for you, to "run once" your layout after starting Amibroker.

https://www.amibroker.com/kb/2015/10/06/how-to-run-certain-piece-of-code-only-once/

_SECTION_BEGIN( "_ole_apx_execute_run_once" );

if( Nz( StaticVarGet( "InitializationDone" ) ) == 0 )
{
    StaticVarSet( "InitializationDone", 1 );
    
    AB = CreateObject( "Broker.Application" );
    AD = AB.AnalysisDocs();
    apxload = AD.Open( "C:\\APXDEMO\\APX_Demo.apx" ); 
    apxrun = apxload.Run( 1 );
}

_SECTION_END();
1 Like

Thanks for that. There’s certainly a lot to unpack here. I’ve learnt a lot from this thread.

I’m not clear on one thing though. I can see the flow of code and definitions and see how they chain to one another, and creating objects certainly looks like something fun to explore, but
the function

AnalysisDocs();

is not in the afl library found here, so I’m not 100% understood on how it can be used.

I’m simultaneously learning Python at the moment and am learning (I don’t know what the practice is called, I’m just copying it) that if you ‘import’ another .py file (e.g. config.py) into your script, you can reference values from that config.py in your new script. Are we doing something similar to that with AnalysisDocs(); (I.e did it come from somewhere else?

Thanks again so much🙏

It is part of OLE interface documented here
Https://www.amibroker.com/guide/objects.html

1 Like

You always have to differentiate the communication path. Do I call Amibroker from outside, i.e. from an external application, or do I control Amibroker by itself ? OLE is a Microsoft technology ( Object Linking & Embedding ) and Amibroker provides an OLE interface. Therefore it could be problematic to run Amibroker OLE on itself. Also OLE in Microsoft design works by default on the first loaded program instance only.

Amibroker provides a python plugin

https://forum.amibroker.com/t/amipy-plug-in-python-integration/20337

Also you can use OLE python via standalone external programs to "control" Amibroker in Microsoft Windows.

Sample in Visual Studio:

import win32com.client as wcl

AB = wcl.Dispatch( 'Broker.Application' )

print ("AmiBroker Version", AB.Version)

AB.ActiveDocument.Name = "SAP.DE"
AB.ActiveDocument.Name = "ADS.DE"
AB.ActiveDocument.Name = "KO"
AB.ActiveDocument.Name = "TSLA"
1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.