//new stop losses
 if ($position['amount'] < 0) {
     //short
     if ($latestPrice < $position['base']) {
         $trade_signal = 'short_sl_exit';
         $stopLow = $latestPrice;
     }
 } else {
     //long
     if ($latestPrice > $position['base']) {
         $trade_signal = 'long_sl_exit';
         $stopHigh = $latestPrice;
     }
 }
 $last_action_data = array('last_action' => 'bitfinex_sl_exit', 'last_price' => $position['base'], 'trade_signal' => $trade_signal, 'currency' => $currency);
 $candleData->update_last_action($last_action_data);
 $tradeAmt = $marginUSD / $latestPrice;
 //how many coins are tradeable
 $tradeAmt = $tradeAmt * $bitfinexBalance / 100;
 //don't use the entire balance
 $tradeAmt = number_format($tradeAmt, 4);
 //don't need to trade many decimals
 $output .= ' | Green Zone';
 if ($isSideTrend == 0) {
     //if there is a trend, trade more
     $trade_signal = 'green';
     if ($position['amount'] < 0) {
         //short
         $newTrade = $bitfinexAPI->margin_short_pos($symbol, $latestPrice, $tradeAmt);
         $action = 'Sell';
     } else {