For Example:
Probably Profit should be calculated in mAvg_cross_down scenario by simply subtracting Entry Price from Exit Price. We were in buy position and expect to make profit when Price of Futures goes up and thats what we expect when PCR comes below mAVG. Not entirely sure why -ve sign is put in front of in code snippet below ‘pro = -(Data[‘future’][i] - transaction_start_price)’. Can you please advise ?
“elif (mAvg_cross_down and flag==0 and (not sell_flag)):#…places “SELL” order if PCR crosses mAvg from high to low to close a trade
flag = 1
sell_flag = False
buy_flag = False
pro = -(Data[‘future’][i] - transaction_start_price)
order_details = [-1,“Sell” , “mAvg crossed (h to l)” , “0” , “position closed”]”
Should not profit in above just be:
pro = (Data[‘future’][i] - transaction_start_price)
(and if that is so , can you please check entire code and advise }