VTengineer
07-14-2008, 09:00 AM
Have been using VBA for 10+ years and I have no idea what's going on here. Look at the code below. The StopLong comparison in the first IF statement does not work. When I step through this in debug mode and StopLong reaches 0.085, it passes right over it. Logic involving the other two variables works just fine. I have change the value to different numbers and nothing works. I have renamed the variable, nothing works.
For BuyLim = 0.001 To 0.07 Step 0.002
For GainSell = 0.001 To 0.08 Step 0.003
For StopLong = 0.001 To 0.09 Step 0.003
If StopLong = 0.085 Then
If GainSell = 0.001 Then
If BuyLim = 0.001 Then
condition = true
End If
End If
End If
Next
Next
Next
For BuyLim = 0.001 To 0.07 Step 0.002
For GainSell = 0.001 To 0.08 Step 0.003
For StopLong = 0.001 To 0.09 Step 0.003
If StopLong = 0.085 Then
If GainSell = 0.001 Then
If BuyLim = 0.001 Then
condition = true
End If
End If
End If
Next
Next
Next