$emaTrend = 'Cross Over';
} else {
    $crossOver = 0;
    $crossUnder = 1;
    $emaTrend = 'Cross Under';
}
//get ATH & ATL for stop loss calculations
$recordedATH = $candleData->get_recorded_ATH();
//ATH = all time high
$recordedATL = $candleData->get_recorded_ATL();
//ATL = all time low
//adjust the ATH and ATL by 0.5%
$ATH = $recordedATH + $recordedATH * 0.005;
$ATL = $recordedATL - $recordedATL * 0.005;
//get overall trend for 24 candles (12 hours)
$percentDiff = $candleData->get_percent_diff();
//determine if trend is pump or dump
$percentDiff = number_format($percentDiff, 4);
//get active positions id
$activePos = $bitfinexAPI->active_positions();
$position = $activePos[0];
$posAmt = abs($position['amount']);
//must be positive #
$posAmt = number_format($posAmt, 4);
//don't need to trade many decimals
$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