Python Forum
Logic is not working as it should work
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Logic is not working as it should work
#1
    if ((SPREAD >= 2 and SPREAD < 20) and not Long_On_Spread):
        Long_On_Spread = True
        print ('Buy  Mini - Sell  Mega')
        
    elif ((SPREAD <=-2 and SPREAD > 20) and not Shorting_Spread):
        Shorting_Spread = True
        print ('Sell  Mini - Buy Mega')
        
    elif (abs(SPREAD) < 0.1 and (Long_On_Spread or Shorting_Spread)):
        Long_On_Spread = False
        Shorting_Spread = False
        print ('Exit Position')
        
The second and third condition is not working. While the condition is satisfying.
Reply
#2
(SPREAD <=-2 and SPREAD > 20): how could SPREAD be less or equal to -2 and in the same more than 20?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020