Trade_pnls for SL and PT

Course Name: Trading Alphas: Mining, Optimisation, and System Design, Section No: 29, Unit No: 4, Unit type: Notebook

For the code:
trade_pnls = ((pnl-entries)*sg)

Do we need to multiply 0.5 at the end, as sg would be 2 for long signal and 0 for no position?
i.e. trade_pnls = ((pnl-entries)sg0.5)

Thanks !

Hi,

we are looking into this and will reply shortly.

Hi,

To clarify your doubt,

Yes, strictly speaking you should multiply by 0.5 to normalize the signal, because sg takes the values 0 (flat) and 2 (long). This is from earlier, when we did :
sg = (ma_cross).apply(np.sign).add(1)
adding 1, makes it, 0, 1, 2.
If you leave out *0.5, you’re effectively doubling the trade PnL. In your current code it might still “work” because later you re-scale the signal, but for clarity and correctness it’s better to include the *0.5 so the meaning of the position size is explicit.