Layman's If and then conditions to be coded in amibroker

Preconditions of Range, pH, pL, H & L are already defined in the code


Gb = Range + pH;
Wb = Range - pL;

G = Range + H;
W = Range - L;


Now want to write a code in amibroker for below conditions:


if (G AND W) > Wb then this condition should be called as D2
if (G AND W) < Wb then this condition should be called as D3


if D2 condition is true then, B = G
if D3 condition is true then, B = Gb


After getting the B value want to find the value of nB 

nB = Range + B

the syntax of the if condition in amibroker afl is 

if, else Statement

if( expression )

The if keyword executes statement1 if expression is true (nonzero); if else is present and expression is false (zero), it executes statement2. After executing statement1 or statement2, control passes to the next statement.

Example 1

if ( i > 0 )
    y = x / i;
    x = i;
    y = abs( x );

Thats right sir.
But i am not able to put my condition in this if else code.
Can u please spare some time and code for me with the condition that i have mentioned in my question