Max Positions Held

Questions about MultiCharts and user contributed studies.
CharlieChalk
Posts: 7
Joined: 09 Feb 2015

Max Positions Held

Postby CharlieChalk » 22 Jun 2016

Hello guys,

i have some code, very simple! It is to limit the number of positions that PT can open, the first part of the code which is to limit the number of positions works, but the second part which allow PT to begin executing new positions once open positions drops back below the MaxPositions threshold does not:

pmms_strategy_allow_entries(idx);

I realise this function is not correct and is to allow a strategy with an idx to begin trading, yet i can not find the correct reserve word which does the opposite to this:

pmms_strategies_deny_entries_all();

Many thanks.

Code: Select all

inputs: MaxPositions(25);

Variables:

PositionHeld(0),
idx(0);

array: Indexes[](0);


PositionHeld = Portfolio_CurrentEntries;


if PositionHeld > MaxPositions then begin


pmms_strategies_deny_entries_all();

end;

if positionheld < maxpositions then begin

pmms_strategy_allow_entries(idx);

end;
Last edited by CharlieChalk on 23 Jun 2016, edited 2 times in total.

Return to “MultiCharts”