Hello,
I am learning programming expert advisor and I am a bit stuck on this component, so I was wondering if anyone here can help me out. I want to make a code where buy or sell is conditional in the next equation:

Buy
IF(Num1lt;Num2;-LRB-((Num1 Num2 Num3 Num3)/2)-Num3)
IF(Num1gt;Num2;-LRB-((Num1 Num4 Num3 Num4)/2)-Num3)
IF(Num1=Num2;-LRB-((Num1 Num4 Num3 Num1)/2)-Num3)

Sell
IF(Num1lt;Num2;-LRB-((Num1 Num2 Num3 Num3)/2)-Num3)
IF(Num1gt;Num2;-LRB-((Num1 Num4 Num3 Num4)/2)-Num3)
IF(Num1=Num2;-LRB-((Num1 Num4 Num3 Num1)/2)-Num3)

Can somebody help me out and write an example or explain me it? It will be much valued.

Thank you