Marcell Erasmus
Marcell Erasmus

Reputation: 914

Is there a way to incorporate dynamic commission fees in the TradingView Strategy Tester?

I am trying to incorporate a dynamic commission fee in the strategy tester. I am aware the PineScript strategy function provides some functionality to specify commission fees, for example

strategy(..., commission_type=strategy.commission.cash_per_contract, commission_value=0.005)

This however is a bit restrictive in terms of setting a min commission fee.

The outcome I am looking for is being able to set a min commission value, for example:

If flat fee * quantity is less than $1, use $1.

I have tried calculating the fee and setting it after strategy initialization, this however does not work since it does not seem the strategy instance provides an attribute for such a case:

if (strategy.position_size < 0)  // Short position
    ....
    ....
    ....
    if (....)
        // Perhaps set fee here in some way
        strategy.close("Short")

Is the outcome I am trying to achieve possible in the trading view strategy tester?

Upvotes: 0

Views: 48

Answers (0)

Related Questions