> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface TradeStudyPlugIn::ITradeStudyPlugIn2

![][IDL]
![][public]

**Definition**: `ModelCenter/src/InterfaceDLL\_TradeStudyPlugIn/TradeStudyPlugIn.odl` (line 41)

COM Instance.

**Inherits from**:

* [TradeStudyPlugIn::ITradeStudyPlugIn](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn.md)

**Inherited by**:

* [TradeStudyPlugIn::ITradeStudyPlugIn3](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn3.md)

## Members

* [addAnalyzerVariable](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1a614a39c2d8dd38f47d840aa6d5bb34f2)
* [clearAnalyzerVariables](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1ae184db6af8802c77918103c4bf0f0564)
* [construct](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1ad233e5489d31c81b6b1fe09d9a3a886e)
* [fromString](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1a3dd50d2ce70b8e0534dd9be60e9bec5c)
* [onEnd](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1a955659c71fd798c3d2be2d98a277e28d)
* [saveAllAnalyzerVariables](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1afeb8dd96abface7ec4a37de262c88c85)
* [show](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1a81aebef74679c6364f184219c22da93a)
* [toString](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1aaff0d58b0b3d2d90566fae1277ea4a45)
* [TradeStudyCallback](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1ad9db0e1ec3dee4b67da4fd2bd197f497)

## Properties

### Property TradeStudyCallback

![][public]

**Definition**: `ModelCenter/src/InterfaceDLL\_TradeStudyPlugIn/TradeStudyPlugIn.odl` (line 1)

```text theme={null}
LPDISPATCH TradeStudyPlugIn::ITradeStudyPlugIn2::TradeStudyCallback
```

Gets or sets the trade study callback object.

**Return type**: LPDISPATCH

### Property saveAllAnalyzerVariables

![][public]

**Definition**: `ModelCenter/src/InterfaceDLL\_TradeStudyPlugIn/TradeStudyPlugIn.odl` (line 1)

```text theme={null}
boolean TradeStudyPlugIn::ITradeStudyPlugIn2::saveAllAnalyzerVariables
```

Gets or sets whether all analyzer variables are saved in the data history when the trade study is run. Only affects variables added using [addAnalyzerVariable()](#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn2_1a614a39c2d8dd38f47d840aa6d5bb34f2), otherwise the global [ModelCenter](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/namespaceModelCenter) setting is used (as per usual). The default is false.

NOTE: not fully supported in MC 10.2 - you can (and should) set this value as appropriate but setting to true may not have an effect until all of the requisite functionality is added.

**Return type**: boolean

## Public functions

### Function construct

![][public]

```text theme={null}
void TradeStudyPlugIn::ITradeStudyPlugIn2::construct(IDispatch *modelCenter, IDispatch *addToModel, [defaultvalue(NULL)]IDispatch *dataCollector)
```

Called when the plug-in is launched from [ModelCenter](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/namespaceModelCenter)

**Parameters**:

* **modelCenter**: the [ModelCenter](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/namespaceModelCenter) object
* **addToModel**: the AddToModel API object

**Parameters**:

* IDispatch \* **modelCenter**
* IDispatch \* **addToModel**
* *\[defaultvalue(NULL)]* IDispatch \* **dataCollector**

**Return type**: void

**Reimplements**: [construct](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn.md#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn_1a2b883bd3725cefb35daf8b629124a57f)

### Function show

![][public]

```text theme={null}
boolean TradeStudyPlugIn::ITradeStudyPlugIn2::show()
```

Called to display the trade study.

**Returns**:

false always

**Return type**: boolean

**Reimplements**: [show](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn.md#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn_1a7238385b054e9afddbe65c65644826e4)

### Function toString

![][public]

```text theme={null}
BSTR TradeStudyPlugIn::ITradeStudyPlugIn2::toString()
```

Called to save the state of the plug-in.

**Returns**:

a string containing state information

**Return type**: BSTR

**Reimplements**: [toString](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn.md#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn_1a58cdb46e4e8dca27761d7bd976c8fcf2)

### Function fromString

![][public]

```text theme={null}
void TradeStudyPlugIn::ITradeStudyPlugIn2::fromString(BSTR setupString)
```

Called to restore the state of a plug-in

**Parameters**:

* **setupString**: the state string

**Parameters**:

* BSTR **setupString**

**Return type**: void

**Reimplements**: [fromString](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn.md#interfaceTradeStudyPlugIn_1_1ITradeStudyPlugIn_1a8c4352f776b3919a9a56aa61ff78c5d0)

### Function onEnd

![][public]

```text theme={null}
void TradeStudyPlugIn::ITradeStudyPlugIn2::onEnd()
```

Called when the plug-in is about to be deleted. Informs the plug-in to do any necessary clean up.

**Return type**: void

### Function addAnalyzerVariable

![][public]

```text theme={null}
void TradeStudyPlugIn::ITradeStudyPlugIn2::addAnalyzerVariable(BSTR formula, [optional]VARIANT analyzerName)
```

Call to add a variable from an analyzer product. If there are any analyzer variables, the plugin should only accept analyzer variables as trade study parameters.

**Parameters**:

* **formula**: the formula of the variable or expression in the [ModelCenter](https://developer.synopsys.com/docs/modelcenter/modelcenter-apis/2025-r2/modelcenter-api-md/namespaceModelCenter) model
* **analyzerName**: the name of the variable used by the analyzer product; if not specified, the formula is used instead. The plugin should only display and accept aliases.

**Parameters**:

* BSTR **formula**
* *\[optional]* VARIANT **analyzerName**

**Return type**: void

### Function clearAnalyzerVariables

![][public]

```text theme={null}
void TradeStudyPlugIn::ITradeStudyPlugIn2::clearAnalyzerVariables()
```

Remove all analyzer variables.

**Return type**: void

[public]: https://img.shields.io/badge/-public-brightgreen "public"

[private]: https://img.shields.io/badge/-private-red "private"

[IDL]: https://img.shields.io/badge/language-IDL-blue "IDL"
