Defining different margin % per symbol?

Hello, I am wondering if it is possible to define a per-symbol margin for the backtest? For example I have tried:

if (name() == "DIA") { SetOption("AccountMargin", 9 ); }

if (name() == "TQQQ") { SetOption("AccountMargin", 30 ); }

if (name() == "TLT") { SetOption("AccountMargin", 6 ); }

// Bet sizing / Money Management
maxpos = 50; // maximum number of open positions
SetOption("InitialEquity", 100000 ); // set initial equity = 100K
SetOption( "MaxOpenPositions", maxpos );
SetPositionSize(  10, spsPercentOfEquity );

But it doesn't seem to be doing anything. Is there a way to accomplish this simply? Or would I have to go into the custom backtester?

Back-testing systems for futures contracts

See Symbol Information -> Margin Deposit
This is per symbol setting.

1 Like

"AccountMargin", as its name says, is ACCOUNT setting.

Per-symbol margin is definable via MarginDepost variable

MarginDeposit = ...what ever per-symbol margin you want....

or in the Symbol Information as @nsm51 wrote you.

Always the best way to learn is actually READING the Tutorial

This is absolute best way to learn AmiBroker.