Margin = 0 does not prevent trades. You must set Lots = 0 for this. And your comparisons make no sense. You're comparing a hour with a bar offset. You can compare hours with hours and offsets with offsets, but mixing both won't work.

For developing a strategy, start with a very simple version. Look if trades are entered at the proper time. Then step by step add more conditions and stop/profit distances, and test after every step. Do not start already with the final version with complicated entries and exits.