Resistor value calculation for optocoupler input
simulate this circuit &ndash; Schematic created using CircuitLab
Figure 1. Redrawn circuit.

D1 has a Vf of 2.1 V at 20 mA.
D2 has a Vf of 1.4 V at 20 mA.
VR1 = 24 - 2.1 - 1.4 = 20.5 V.
At 20 mA, R1 = V / I = 20.5 / 20m = 1 kΩ.


Also need to understand whether LTV-845 is capable of handling 0.046A, as forward current is 50mA max and collector current is 80mA.

50 mA is the infrared LED's absolute max. You don't want to be operating near that value. Since your LEDs are in series they both have to have the same current. The maximum current will have to be set by whichever has the lower limit.
The current transfer ratio of that device is quite high - over 600 at IF = 1 mA. This means that you probably don't even need 20 mA in the LED.
Don't forget to calculate the power dissipated in R1. The 1k will have P = I2R &gt; 900 mW. Reducing the current to 5 mA would require a 4.1 kΩ and power would be 100 mW.