I’m trying to make a back trading class. but I don’t really get how spread works for example if you buy in 1.06649 how will spread works here? and in the same trade if I exit in my intended take profit where will it stop? I’m also confuse with how spread works in stoploss
def calculate_take_profit_buy(self, current_price, point_value, take_profit_points, spread):
return current_price + (take_profit_points * point_value)
def calculate_stop_loss_buy(self, current_price, point_value, stop_loss_points, spread):
return current_price - (stop_loss_points * point_value)
def calculate_take_profit_sell(self, current_price, point_value, take_profit_points, spread):
return current_price - (take_profit_points * point_value)
def calculate_stop_loss_sell(self, current_price, point_value, stop_loss_points, spread):
return current_price + (stop_loss_points * point_value)
I tried to chat gpt it seems more confusing. I found a forum from 2006 that I should add the spread in entry when buying and add spread on exit when selling. not sure if it’s true until today