I am trying to program a PMM Strategy where the entry of orders by symbol is limited regardless of the number of strategies that there are on that symbol. For example, if there is already a long strategy in gold that another strategy on gold can not enter long.

This is the way that has occurred to me but something is wrong:

variables: inLong(0), inShort(0);

arrays: strategiesLong[](-1), strategiesShort[](-1);

inLong = pmms_strategies_in_long_count(strategiesLong);

inShort = pmms_strategies_in_short_count(strategiesShort);

for idx = 0 to portfoliostrategies - 1

begin

simbolo1=pmms_strategy_symbol(idx);

simbolo[idx]=simbolo1;

end;

for idx = 0 to portfoliostrategies - 1

begin

value1=array_compare(simbolo,idx,simbolo,idx+1,portfoliostrategies);

if value1=0 then

begin

if inlong=0 then

begin

pmms_strategy_allow_long_entries(idx);

pmms_strategy_set_entry_contracts(idx,con[idx]);

end

else

pmms_strategy_deny_long_entries(idx);

end

else

pmms_strategy_allow_entries(idx);

end;

variables: inLong(0), inShort(0);

arrays: strategiesLong[](-1), strategiesShort[](-1);

inLong = pmms_strategies_in_long_count(strategiesLong);

inShort = pmms_strategies_in_short_count(strategiesShort);

for idx = 0 to portfoliostrategies - 1

begin

simbolo1=pmms_strategy_symbol(idx);

simbolo[idx]=simbolo1;

end;

for idx = 0 to portfoliostrategies - 1

begin

value1=array_compare(simbolo,idx,simbolo,idx+1,portfoliostrategies);

if value1=0 then

begin

if inlong=0 then

begin

pmms_strategy_allow_long_entries(idx);

pmms_strategy_set_entry_contracts(idx,con[idx]);

end

else

pmms_strategy_deny_long_entries(idx);

end

else

pmms_strategy_allow_entries(idx);

end;

Can somebody tell me what fails?? Thanks!