An algorithm predicts price movement by some certainty and it invests proportional to the confidence level. Predictions range from -1 to +1, -1 meaning sell for a value of $1 +1 meaning buy for a value of $1. Then the profit is calculated by multiplying the prediction with the relative price movement of the security traded.

Now assume a transaction cost of 0.6%. How does that change the profit the algorithm makes? For now, we only calculate the transaction cost for one cycle, i.e buy or sell once and the next time step sell or buy again in order to realize the profit.

So to clarify. I have two variables pred which is a prediction ranging from -1 and +1. I also have d_price which is the relative price movement of the security. This can be 0.0003 or -0.002 or something similar. You calculate this by d_price = (price_t1 - price_t0) / price_t0

I have this eqution now:

profit = pred * d_price

The algorithm makes two trades. It makes a trade when it makes the prediction at time step t0, then it makes another trade at time step t1 in order to realize a profit. So if it predicts +0.5 and then the relative price movement is +0.01 then the profit it makes is 0.005.

What I'm asking about is how this changes when there is a transaction cost of trans=0.006. The transaction cost if percentage based, meaning if I buy 1 amount, I will receive 0.994 only. Likewise, if I sell 1 amount I will receive price * 0.994

profit = f(pred,d_price,trans)

What is f ?

  • 1
    $\begingroup$ What exactly is your question? Obviously, positive transactions costs will reduce your profit. $\endgroup$ May 16, 2013 at 12:07
  • $\begingroup$ @LouisMarascio the question is by how much $\endgroup$
    – siamii
    May 16, 2013 at 13:08
  • 3
    $\begingroup$ @siamii, you are asking a question that is impossible to answer without a host of other information which you did not provide. $\endgroup$
    – Matt Wolf
    May 16, 2013 at 13:17
  • $\begingroup$ @Freddy I've made some amendments. See if it is clearer now? $\endgroup$
    – siamii
    May 16, 2013 at 16:20
  • $\begingroup$ You need to take an optimal action in some sense. Typically that is somethink like the expected log return where you plug in the model for the expectation probabilities. Transaction costs affect the pay off naturally in that way. Be careful about stop loss limits etc if you are taking large enough positions to bail i.e. model your exit events excplicitly. $\endgroup$
    – safetyduck
    Apr 1, 2020 at 13:55

1 Answer 1


I'm not really sure what your question is, you appear to answer it yourself...

If I'm understanding you correctly you are making 2 transactions at 0.6% cost, so then your profit = pred * d_price - pred*(trans) - pred/(1+d_price)*trans

That is just your raw profit minus your transaction costs at your opening and closing prices

  • $\begingroup$ So what I'm confused about is does the first transaction cost affect how much I pay for the second transaction cost? Because the second time I'm not going to trade pred amount but rather pred*(1-trans) so do I need to take the transaction cost of that? I may be wrong. $\endgroup$
    – siamii
    May 16, 2013 at 19:05
  • $\begingroup$ in addition, if pred is negative and d_price is positive, then - pred/(1+d_price)*trans will be positive thus you get additional profit from transaction cost? This doesn't seem right. $\endgroup$
    – siamii
    May 16, 2013 at 19:21
  • $\begingroup$ Yea should be abs(pred)*trans and abs(pred/(1+d_price)*trans. Otherwise your opening transaction cost won't affect your second, at least with any broker that I've ever heard of... $\endgroup$ May 16, 2013 at 20:09
  • $\begingroup$ Yes, but if you were to trade the second time only with what you have left from the first trade, that's pred*(1-trans) amount. $\endgroup$
    – siamii
    May 16, 2013 at 21:30
  • $\begingroup$ also, wouldn't the initial potential profit be something like pred*d_price*(1-trans)^2 and then you add the rest of the terms? That's because you not only just pay transaction costs, but the potential profit you can make is also reduced. $\endgroup$
    – siamii
    May 16, 2013 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.