I believe the answer is
9! = 362880.
Proof:
The values in the individual triangles are important only in so far as they determine (or are determined by) the total value in each square, since all the given conditions are about sums of square values. So first of all let us write a,b,c,d,e,f,g,h,i for the total values in the nine squares in "reading order".
(Actually, first of all let's remark that the sum of all the numbers equals 1+2+...+17+18 = 171 and also equals 3X, so X = 57.)
We have 12 sums that have to equal 57: three rows, three columns, three \ diagonals, three / diagonals. That's 12 conditions on 9 numbers, but of course they're redundant. We can instead write them as: sum of all the numbers, then two each of rows, columns, \, /. That's a total of nine linear (well, affine) relations on nine numbers, and I'm pretty sure they're linearly independent. That means that the only solution is that a=b=c=d=e=f=g=h=i=19.
The only way to do that is to pair up 1,18 and 2,17 and 3,16 and so on. Having done that, thought, we can put 'em in any order. Therefore the total number of solutions is 9! = 362880.
Small hole:
I haven't actually proved linear independence of those constraints. If asked, I can either supply a proof or confess that I goofed :-).