PMM Keywords

From MultiCharts
Jump to: navigation, search

Portfolio Money Management Keywords

Please note that all keywords returning or receiveing money values are using the currency specified in the Portfolio settings (View -> Portfolio Settings -> Base Currency).

pmms_strategies_count() – number of trading strategies (equal to the number of downloaded instruments that are traded).

pmms_strategies_in_positions_count( indexes[] ) – the number of strategies with an open position; this value will be held in an array.

pmms_strategies_pause_all() – pause all strategies in the portfolio from sending orders.

pmms_strategies_deny_entries_all() – deny all strategies to open positions (entry orders will be excluded from the RAW orders collection).

pmms_strategies_set_status_for_all( string ) – set a text (string) status for all the portfolio’s strategies (status is indicated in the “Custom Text” column of Portfolio Real-Time Window).

pmms_get_strategy_named_num( idx, var_name ) – get a numerical value of var_name of the strategy with an idx number.

pmms_get_strategy_named_str( idx,var_name ) – get string value of var_name of the strategy with an idx number.

pmms_set_strategy_named_num( idx, var_name, var_val ) – set a numerical value of var_name of the strategy with an idx number.

pmms_set_strategy_named_str( idx, var_name, str_val ) – set a string value of var_name of the strategy with an idx number.

pmms_strategy_close_position(idx) – close a strategy position with an idx number with market order (orders generated by the strategy will be deleted from Raw Orders collection).

pmms_strategy_close_position_partial(idx, isNextBar, contracts) – partially close position of the specified strategy for the set number of contracts.

pmms_strategy_set_entry_contracts(idx, contracts) – set the number of contracts for the strategy’s entry with an idx number (size calculated by the strategy itself will be ignored). To use the order size calculated by the strategy itself set “contracts” parameter to 0.

pmms_strategy_get_entry_contracts(idx) – get the number of contracts of the entry order of the strategy with an idx number.

pmms_strategy_allow_entries(idx) – allow entry orders for a strategy with an idx number.

pmms_strategy_deny_entries(idx) – deny entry orders for a strategy with an idx number (entry orders will be deleted from Raw Orders collection).

pmms_strategy_is_paused(idx) – returns TRUE if order sending is paused for the strategy with an idx number.

pmms_strategy_pause(idx) – deny order sending for the strategy with an idx number (all strategy’s orders will be deleted from Raw Orders Collection) pmms_strategy_resume(idx) – allow order sending with an idx number.

pmms_strategy_set_status(idx, str_val) – set the text (string) status for the strategy with an idx number (the status will be indicated in the “Custom Text” column of Portfolio Real-Time Window).

pmms_strategy_marketposition(idx) – returns a numerical value representing the strategy’s market position with an idx number.

pmms_Strategy_NetProfit(idx) – returns a numerical value representing the net profit of the strategy with an idx number.

pmms_Strategy_OpenProfit(idx) – returns a numerical value representing the unrealized profit/loss of the strategy with an idx number.

pmms_Strategy_Maxiddrawdown(idx) – returns a numerical value representing the max drawdown of the strategy with an idx number.

pmms_strategy_currentcontracts(idx) – returns a value representing a positions’ number of contracts which was opened by the strategy with an idx number.

pmms_strategy_entryprice(idx) – returns a numerical value representing an average entry price of the position opened by the strategy with an idx number.

pmms_Strategy_RiskCapital(idx) – returns a numerical value representing the amount of money withheld as a risk capital for the open position of the strategy with an idx number.

pmms_strategy_symbol(idx) – returns a string value representing the name of the instrument to which the signal is applied.

pmms_strategies_get_by_symbol_name(symbol) – returns the strategy’s based on an instrument name (-1, if the instrument is not found). If several strategies are applied to the same instrument, then the number of one of these strategies will be returned.

pmm_set_my_status(str_val) – set the text (string) status for the current strategy (visible in the “Custom Text” column of Portfolio Real-time window).

pmm_get_my_named_num(var_name) – get the numerical value of var_name variable.

pmm_get_my_named_str(var_name) – get the string value of var_name variable.

pmm_set_my_named_num(var_name, val) – set the numerical value “val” for var_name variable.

pmm_set_my_named_str(var_name, str_val) – set the string value “str_val” for var_name variable.

pmm_get_global_named_num(var_name) – get the value of global numerical var_name variable (visible by all strategies).

pmm_get_global_named_str(var_name) – get the value of global string var_name variable (visible by all strategies).

pmm_set_global_named_num(var_name, val) – set the value of global numerical var_name variable.

pmm_set_global_named_str(var_name, val) – set the value of global string var_name variable.

pmm_get_my_index - returns a numerical value, indicating zero-based index of the current trading strategy.

convert_currency(datetime, currencyCode1, currencyCode2, moneyValue) – moneyValue is a value conversion from the currency designated currencycode1, into the currency with currencycode2, using the rate at the datetime moment. For example, convert_currency(datetime, codeEUR, codeJPY, 500) will convert 500 EUR value to Japanese Yens using the rate at the moment of calculation at the current bar.

currencyCodeToStr(currencyCode) – string value for the currency with currencyCode code. For example, currencycodetostr(symbolcurrencycode) will return “EUR” value, if the strategy is calculated using the symbol with EUR as a basic currency.

symbolCurrencyCode – returns currency code of the current symbol.

portfolio_CurrencyCode – returns the currency code used for the Portfolio’s strategy calculation.

array_contains(realArr[], value) – allows the user to check if the value of the parameter “value” is contained in the realArr array.

array_contains(stringArr[], stringVal) – allows the user to check if stringVal value is contained in stringArr array.

array_contains(boolArr[], boolVal) – allows the user to check if boolVal value is contained in boolArr array.

PMM Keywords Understanding: “pmm_set” & “pmm_get”

Portfolio has one strategy (Strategy 1) which consists of 2 signals: Custom_1 and Custom_2. Portfolio has 3 instruments: GOOG -1 Day, MSFT – 1 Day, CSCO – 1 Day.

Let’s say the strategy also uses second data stream for its calculation.

In this case we have 3 portfolio strategy objects (for each instrument in portfolio):

  1. Strategy 1 (Custom_1 and Custom_2) calculates on GOOG – 1 Day (+ GOOG – 1 Minute as data2).
  2. Strategy 1 (Custom_1 and Custom_2) calculates on MSFT – 1 Day (+ MSFT – 1 Minute as data2).
  3. Strategy 1 (Custom_1 and Custom_2) calculates on CSCO – 1 Day (+ CSCO – 1 Minute as data2).

PMM Keywords.png

Figure 1 (Portfolio Trader window)


PMM Keywords 2.png

Figure 2 (Sequence diagram for portfolio keywords calculation example)