Right, thank you.

In this case, there is no way to pass an integer or string to TMF, just var. Because the TMF function runs once immediately after the enter, before we have a chance to set up TradeInt or TradeStr. So in the first iteration of TMF, you have only var inputs.

It would be nice in the future if we could use any type of input in the trade management function. Not just int, but string or even any custom stuff. Now the workaround is to make a global variable of an unordered map or something, use the pointer of the trade as an ID, and store the trade data in a custom-defined struct.
Code
trade_function_data[CUSTOM_GENERATED_TRADE_ID].startBar = 8;
...
enterLong(tmf, CUSTOM_GENERATED_TRADE_ID);


...and of course we need to cleanup aftert the closed trades.

Last edited by NorbertSz; 10/22/24 07:30.