Adding text to a string in array processing

Hi!

I am using a system that consists of 15 strategies. I want to know which strategies that signals when I trade live. The structure is like this:

strat1_buy = eval_strat1_cond();
strat_num = IIF(strat1_buy, strat_num+10, strat_num);

strat2_buy = eval_strat2_cond();
strat_num = IIF(strat2_buy, strat_num+20, strat_num);

and then lastly, I loop through the bars and send a Telegram message and include ticker and the "strat_num" variable on the last bar.

It works ok when just 1 strat signals buy, but if two or more does, the number may be 10+20 = 30, and that could either be strat1 and strat2, or strat3. Also, a string would be much easier to read.

So I tried this instead:

strat_str = IIf(strat1_buy, strat_str+=" strat1", strat_str);

but strings doesn't work that way in arrays, as I´ve understood it.

Does anyone have a better solution for this? Simply how to know which strategies that signals (probably by building a string), using array processing?

Any suggestions are greatly appreciated!

Cheers

See WriteIf Function.

Amazing I didn't find that when searching around. Thanks alot!

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.