	<?php 
	include_once("classes/database.class.php");
	include_once("classes/oanda.php");
	include_once('classes/phpToPDF.php');


	if (isset($_GET['pdf'])) {
		# code...
		    include('pdf.php');
		    $my_html = ob_get_clean();
		    $getpdfname = $_GET['pdf'];

		    //Set Your Options -- we are saving the PDF as 'my_filename.pdf' to a 'my_pdfs' folder
		    $pdf_options = array(
		      "source_type" => 'html',
		      "source" => $my_html,
		      "action" => 'save',
		      "save_directory" => 'my_pdfs',
		      "file_name" => $getpdfname.'.pdf');

		    //Code to generate PDF file from options above
		    phptopdf($pdf_options);
	}
	


	$loggedIn = false;
	if(isset($_COOKIE['id']) && isset($_COOKIE['uid'])){
	  $userId = filter_input(INPUT_COOKIE, 'id');
	  $userUId = filter_input(INPUT_COOKIE, 'uid');
	  $db = new database();
	  $stmt = $db->db->prepare("SELECT * FROM users WHERE id = :id and uid = :uid");
	  $stmt->execute(array(':id' => $userId, ':uid' => $userUId));
	  $userDetails = $stmt->fetch(PDO::FETCH_OBJ);

	  $account = new oandaAPI();
	  $account->retrieveAccount($userDetails->accountId);
	  $loggedIn = true;

	  $fullN = $userDetails->name;

	  $splitname = explode(" ", $fullN);

	  $firstname = $splitname[0];

	  $lastname = $splitname[1];

	  $accType = $userDetails->acctype;

	  $starting_money = $userDetails->starting_money;

	  
	  $pdfname = uniqid();


	}


	 ?>

	<style type="text/css">
		.tabs-left, .tabs-right {
		  border-bottom: none;
		  padding-top: 2px;
	}
	.tabs-left {
	  border-right: 1px solid #ddd;
	}
	.tabs-right {
	  border-left: 1px solid #ddd;
	}
	.tabs-left>li, .tabs-right>li {
	  float: none;
	  margin-bottom: 2px;
	}
	.tabs-left>li {
	  margin-right: -1px;
	}
	.tabs-right>li {
	  margin-left: -1px;
	}
	.tabs-left>li.active>a,
	.tabs-left>li.active>a:hover,
	.tabs-left>li.active>a:focus {
	  border-bottom-color: #ddd;
	  border-right-color: transparent;
	}

	.tabs-right>li.active>a,
	.tabs-right>li.active>a:hover,
	.tabs-right>li.active>a:focus {
	  border-bottom: 1px solid #ddd;
	  border-left-color: transparent;
	}
	.tabs-left>li>a {
	  border-radius: 4px 0 0 4px;
	  margin-right: 0;
	  display:block;
	}
	.tabs-right>li>a {
	  border-radius: 0 4px 4px 0;
	  margin-right: 0;
	}
	.vertical-text {
	  margin-top:50px;
	  border: none;
	  position: relative;
	}
	.vertical-text>li {
	  height: 20px;
	  width: 120px !!important;
	  margin-bottom: 100px;
	}
	.vertical-text>li>a {
	  border-bottom: 1px solid #ddd;
	  border-right-color: transparent;
	  text-align: center;
	  border-radius: 4px 4px 0px 0px;
	}
	.vertical-text>li.active>a,
	.vertical-text>li.active>a:hover,
	.vertical-text>li.active>a:focus {
	  border-bottom-color: transparent;
	  border-right-color: #ddd;
	  border-left-color: #ddd;
	}
	.vertical-text.tabs-left {
	  left: -50px;
	}
	.vertical-text.tabs-right {
	  right: -50px;
	}
	.vertical-text.tabs-right>li {
	  -webkit-transform: rotate(90deg);
	  -moz-transform: rotate(90deg);
	  -ms-transform: rotate(90deg);
	  -o-transform: rotate(90deg);
	  transform: rotate(90deg);
	}
	.vertical-text.tabs-left>li {
	  -webkit-transform: rotate(-90deg);
	  -moz-transform: rotate(-90deg);
	  -ms-transform: rotate(-90deg);
	  -o-transform: rotate(-90deg);
	  transform: rotate(-90deg);
	}
	.tabs-left > li 
	{
		padding-top: 5px !important;
		padding-bottom: 5px !important;
	}
	.panel-heading
	{
		background-color: #F7614E !important;
		text-align: center;
		padding: 7px !important;
		font-size: 18px !important;
		font-weight: 500;
	}
	.panel-body
	{
		background-color: #0E162D !important;
		text-align: center;
		padding-top: 40px;
		padding-bottom: 40px;
		font-size: 48px !important;
	}
	.swal-modal
	{
		background-color: #202943;
	}
	.swal-title
	{
		color: #F7614E;
	}
	.swal-text
	{
		color: #fff;
	}
	.swal-icon--success:before, .swal-icon--success:after
	{
		background-color: #202943;	
	}
	.swal-icon--success__hide-corners {

		background-color: #202943;	
	}
	.lightTabs
	{
		background: #fff !important;
	}
	.lightTabs > li > a
	{
		color: #F7614E !important; 
	}
	#home
	{
		color: white;
		background: #1F2638 !important;
	}
	#rightTab, #rightTab > .crypt-tab-content
	{
		background-color: #1F2638;
	}
	.lightRightTab, .lightRightTab > div, .lightRightTab > div > #home, .lightRightTab >  .crypt-tab-content 
	{
		background-color: #fff !important;
	}
	.light-panel-body
	{
		background: #eee !important;
		color: #1F2638 !important;
	}
	.lightTableVersion, .lightTableVersion > thead, .lightTableVersion > thead > tr, .lightTableVersion > thead > tr > th, .lightTableVersion > tbody, .lightTableVersion > tbody > tr, .lightTableVersion > tbody > tr > td
	{
		background-color: #fff;
		color: #1F2638 !important;
		border: 1px solid #1F2638 !important;
	}
	.lightRightTab > div > #profile > form > div > label, .lightRightTab > div > #messages > form > div > div > label, .lightRightTab > div > #targets > form > div > div > label, .lightRightTab > div > #userSettings > #acc_type_row > form > div > label, .lightRightTab > div > #userSettings > #logRules > form > div > label
	{
		color: #1F2638 !important;
	}
	.lightRightTab > div > #profile > form > div > input, .lightRightTab > div > #profile > form > div > select, .lightRightTab > div > #messages > form > div > div > input, .lightRightTab > div > #targets > form > div > div > input, .lightRightTab > div > #userSettings > #acc_type_row > form > div > input, .lightRightTab > div > #userSettings > #logRules > form > div > input, .lightRightTab > div > #userSettings > #logRules > form > div > select
	{
		color: #1F2638 !important;
		background-color: #eee !important;	
	}
	.round {
  position: relative;
}

.round label {
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 50%;
  cursor: pointer;
  height: 28px;
  left: 0;
  position: absolute;
  top: 0;
  width: 28px;
}

.round label:after {
  border: 2px solid #fff;
  border-top: none;
  border-right: none;
  content: "";
  height: 6px;
  left: 7px;
  opacity: 0;
  position: absolute;
  top: 8px;
  transform: rotate(-45deg);
  width: 12px;
}

.round input[type="checkbox"] {
  visibility: hidden;
}

.round input[type="checkbox"]:checked + label {
  background-color: #66bb6a;
  border-color: #66bb6a;
}

.round input[type="checkbox"]:checked + label:after {
  opacity: 1;
}
	</style>
	<p>
						<div class="alert alert-info alert-dismissible" role="alert" id="contactInfo" style="display:none;"></div>



						<div class="container">

							<div class="row">

								<div class="col-md-12 col-lg-12 col-xl-12">
									<h3 style="margin-top: 30px;text-align: center;">Account Details</h3>
								</div>
								
							</div>

							<div class="row">

								  <div class="col-xs-3 col-sm-3 col-lg-3">
							            <!-- required for floating -->
							            <!-- Nav tabs -->
							            <ul class="nav nav-tabs tabs-left" id="navTabsLeft" style="display: inline-block;width: 100%;">
							                <li class="active" style="width: 100%;"><a href="#home" data-toggle="tab">Account Information</a></li>
							                <li><a href="#profile" data-toggle="tab">Personal Information</a></li>
							                <li><a href="#messages" data-toggle="tab">Change Password</a></li>
							                <li><a href="#targets" data-toggle="tab">Update Targets</a></li>
							                <li><a href="#userSettings" data-toggle="tab">User Settings</a></li>
							                <li><a href="#tickerSettings" data-toggle="tab">Ticker Settings</a></li>
							                <li><a href="#tradeHistory" data-toggle="tab">Trade History</a></li>
							            </ul>
							        </div>
							        <div class="col-xs-9 col-sm-9 col-lg-9" id="rightTab" style="padding: 10px !important;width: 100% !important;">
							            <!-- Tab panes -->
							            <div class="tab-content crypt-tab-content" style="width: 100%;">
							                <div class="tab-pane active" id="home">
							                	
							                	<div class="row">

							                		<div class="col-md-12 col-lg-12">
							                			<p style="color: #F7614E;">Welcome <?=$fullN; ?>!</p>
							                		</div>
							                		
							                	</div>

							                	<div class="row">

							                		<div class="col-md-12 col-lg-12 col-sm-12" style="margin-bottom: 20px !important;">
							                			<canvas id="myChart" style="width: 100%;height: 300px;background-color: #0E162D !important;padding: 10px !important;"></canvas>
							                		</div>
							                		
							                	</div>


							                	<div class="row">

							                		<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading">Account Balance</div>
														    <div class="panel-body"><?=$account->balance; ?></div>
														  </div>

							                		</div>
							                		<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading" <?php if($account->marginUsed / $account->marginAvail > 0.55) { echo "style=background-color:orange !important;;"; }else{echo "style=\"background-color: #49C279 !important;\"";} ?> >Current Margin</div>
														    <div class="panel-body"><?=$account->marginUsed; ?></div>
														  </div>

							                		</div>
							                			<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading">Available Margin</div>
														    <div class="panel-body"><?=$account->marginAvail; ?></div>
														  </div>

							                		</div>
							                		
							                		
							                	</div>


							                	<div class="row" style="margin-top: 20px !important">

							                		<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading">Unrealized Earning</div>
														    <div class="panel-body"><?php echo round($account->unrealizedPl, 2); ?></div>
														  </div>

							                		</div>
							                		<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading">Open Trades</div>
														    <div class="panel-body"><?=$account->openTrades; ?></div>
														  </div>

							                		</div>
							                			<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading">Open Orders</div>
														    <div class="panel-body"><?=$account->openOrders; ?></div>
														  </div>

							                		</div>
							                		
							                		
							                	</div>

							                	<div class="row"  style="margin-top: 20px !important;">

							                		<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading">Daily Target</div>
														    <div class="panel-body"><?=$userDetails->daily_goal; ?></div>
														  </div>

							                		</div>
							                			<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading" style="background-color: #49C279 !important;">Monthly Target</div>
														    <div class="panel-body"><?=$userDetails->monthly_goal; ?></div>
														  </div>

							                		</div>
							                			<div class="col-md-4 col-sm-4 col-xs-12">
							                			
							                			  <div class="panel panel-default">
														    <div class="panel-heading">Annual Target</div>
														    <div class="panel-body"><?=$userDetails->annual_goal; ?></div>
														  </div>

							                		</div>
							                		
							                	</div>

							                	<div class="row" style="margin-top: 20px;">
							                		
							                		<div class="col-md-12 col-lg-12">

							                			<h5 style="color: #F7614E !important;">Trade Details</h5>
							                			
							                				<?php
										$account->retrieveTrades($account->accountId);
										?>
										<table class="table table-hover table-stripped table-rowed" id="pairTable">
											<thead>
											<th>Pair</th>
											<th>Type</th>
											<th>Units</th>
											<th>Price</th>
											<th>Date</th>
											<th>Profit</th>
											<th>Action</th>
											</thead>
										<tbody>



										<tr id="1">
											<td>1</td>
											<td>BUY</td>
											<td>US</td>
											<td>20</td>
											<td>3 August 2018</td>
											<td>5</td>
											<td><button data-toggle="modal" onclick="showTradeValues('1', 'BUY', 'Limit Order', '20')" data-target="#editTrade" class="btn btn-sm btn-warning"><i class="fa fa-wrench"></i></button><button class="btn btn-sm btn-danger" onclick="removeTrade('1')" style="margin-left: 5px;"><i class="fa fa-trash"></i></button></td>
										</tr>

										<tr id="2">
											<td>3</td>
											<td>SELL</td>
											<td>US</td>
											<td>50</td>
											<td>3 August 2018</td>
											<td>6</td>
											<td><button data-toggle="modal" onclick="showTradeValues('3', 'SELL', 'LIMIT ORDER', '50')" data-target="#editTrade" class="btn btn-sm btn-warning"><i class="fa fa-wrench"></i></button><button class="btn btn-sm btn-danger" onclick="removeTrade('2')" style="margin-left: 5px;"><i class="fa fa-trash"></i></button></td>
										</tr>


										<?php foreach($account->openTrade as $trade) { 
												if($trade['initialUnits'] < 0){ $trade['side'] = "Sell"; }
												else { $trade['side'] = "Buy"; }
												if($trade['unrealizedPL'] < 0) { $colorPL = "red"; }
												else { $colorPL = 'lime'; }
											?>
										<tr data-row-id="<?php echo $trade['id']; ?>">
											<td><?php echo $trade['instrument']; ?></td>
											<td><?php echo $trade['side']; ?></td>
											<td><?php echo $trade['initialUnits']; ?></td>
											<td><?php echo $trade['price']; ?></td>
											<td><?php echo substr($trade['openTime'], 0, 10); ?></td>
											<td style="color:<?php echo $colorPL; ?>"><?php echo round($trade['unrealizedPL'], 2); ?></td>
											<td><i style="color:red;cursor:pointer;" class="fa fa-window-close-o closeSingleTrade"></i>&nbsp;&nbsp;&nbsp;<i style="color:#00ffb1;" class="fa fa-sticky-note modifySingleTrade"></i></td>
										</tr>





										<?php 	} ?>
											</tbody>
										</table>

							                		</div>

							                	</div>


							                </div>
							                <div class="tab-pane" id="profile" style="color: white;padding-top: 20px !important;padding-bottom: 20px !important;">
							                	<!-- <?php 

							                	if (isset($_POST['submit'])) {
							                		# code...
							                		$fname = $_POST['fname'];
							                		$lname = $_POST['lname'];
							                		$fullname = $fname." ".$lname;
							                		$email = $_POST['email'];
							                		$phone = $_POST['phone'];
							                		$pcar = $_POST['pcar'];

							                		$update = "UPDATE users SET name = '$fullname', email = '$email', phone = '$phone', pcarrier = '$pcar' WHERE id = '$userId'";

							                		$userUpdate = $db->db->prepare($update);

							                		$userUpdate->execute();

							                		?>
							                		<div class="alert alert-success alert-dismissible">
							                			You have successfully updated your information
							                		</div>
							                		<script type="text/javascript">
							                			location.href = location.href;
							                		</script>
							                		<?php 
							                	}

							                	?> -->
							                	<form method="post" action="">

							                	<div class="col-md-12">
													<label> First Name </label>
													<input type="text" class="form form-control newformcontrol" id="fnamepi" name="fname" value="<?php echo $firstname; ?>" placeholder="Name" required />
												</div>
												<div class="col-md-12">
													<label> Last Name </label>
													<input type="text" class="form form-control newformcontrol" name="lname" id="lnamepi" value="<?php echo $lastname; ?>" placeholder="Name" required />
												</div>

												<div class="col-md-12" style="margin-top: 10px;">
													<label> User ID </label>
													<input type="text" class="form form-control newformcontrol" name="userid" id="useridpi" value="<?php echo $userUId; ?>" placeholder="Email" required />
												</div>

												<div class="col-md-12" style="margin-top: 10px;">
													<label> Email </label>
													<input type="text" class="form form-control newformcontrol" id="emailpi" name="email" value="<?php echo $userDetails->email; ?>" placeholder="Email" required />
												</div>
												<div class="col-md-12" style="margin-top: 10px;">
													<label> Phone Number </label>
													<input type="text" class="form form-control newformcontrol" id="phnumberpi" name="phone" value="<?php echo $userDetails->phone; ?>" placeholder="Phone" required />
												</div>
												<div class="col-md-12" style="margin-top: 10px;">
													<label>Phone Carrier</label>
													<select class="form-control" style="width: 100%;height: 50px;" id="pcar" name="pcar">
														<option value="0">Select Your Phone Carrier</option>
														<option value="@txt.att.net">AT&T</option>
														<option value="@tmomail.net">T-Mobile</option>
														<option value="@vtext.com">Verizon</option>
														<option value="@messaging.sprintpcs.com">number@messaging.sprintpcs.com</option>
														<option value="@vtext.com">XFinity Mobile</option>
														<option value="@vmobl.com">Virgin Mobile</option>
														<option value="@mmst5.tracfone.com">Tracfone</option>
														<option value="@mymetropcs.com">Metro PCS</option>
														<option value="@sms.myboostmobile.com">Boost Mobile</option>
														<option value="@sms.cricketwireless.net">Cricket</option>
														<option value="@text.republicwireless.com">Republic Wireless</option>
														<option value="@msg.fi.google.com">Google Fi</option>
														<option value="@email.uscc.net">U.S. Cellular</option>
														<option value="@message.ting.com">Ting</option>
														<option value="@mailmymobile.net">Consumer Cellular</option>
														<option value="@cspire1.com">C-Spire</option>
														<option value="@vtext.com">Page Plus</option>
													</select>
												</div>
												<div class="col-md-4">
													<button type="button" id="updatepibtn" onclick="updatepersonal()" class="btn btn-md btn-success" style="border-radius: 0px !important;margin-top: 10px !important;background-color: #F7614E !important;border: none !important;width: 100% !important;color: #fff;">Update Details</button>
												</div>
											</form>
							                </div>
							                <div class="tab-pane" id="messages">
							                	
							                	<?php 

							                	if (isset($_POST['newpass'])) {
							                		# code...
							                		$newpass = $_POST['newpass'];


							                		$sql = "UPDATE users SET password = '$newpass' WHERE id = '$userId'";

							                		$stmtupdate = $db->db->prepare($sql);

							                		$stmtupdate->execute();

							                		?>
							                		<div class="alert alert-success alert-dismissible">
							                			You have successfully changed your password
							                		</div>
							                		<?php 


							                	}

							                	?>

							                	<form method="post" action="" style="padding-top: 30px !important;padding-bottom: 30px !important;" id="changepasswordform">

							                		<div class="row">
							                			<div class="col-md-12">
															<label style="color: #fff"> Enter Your Old Password </label>
															<input type="text" class="form form-control newformcontrol" id="opass" name="oldpassword" value="" required />
															<p style="color: #F7614E;font-size: 10px !important;" id="showerror1"></p>
														</div>
															<div class="col-md-12">
															<label style="color: #fff"> Enter Your New Password </label>
															<input type="text" class="form form-control newformcontrol" id="newpass" name="newpass" value="" required />
															<p style="color: #F7614E;font-size: 10px !important;" id="showerror2"></p>
														</div>
														<div class="col-md-12">
															<label style="color: #fff"> Enter Your New Password Again </label>
															<input type="text" class="form form-control newformcontrol" id="newpassagain" name="newpassagain" value="" required />
															<p style="color: #F7614E;font-size: 10px !important;" id="showerror3"></p>
														</div>

														<div class="col-md-3">
															<a onclick="submitorm()" class="btn btn-md btn-success" style="border-radius: 0px !important;margin-top: 10px !important;background-color: #F7614E !important;border: none !important;width: 100% !important;color: #fff;">Change Your Password</a>
														</div>
							                			
							                		</div>

							                		
							                	</form>



							                </div>













							                <div class="tab-pane" id="targets">
							                	
							                	<?php 

							                	if (isset($_POST['targetsubmit'])) {
							                		# code..

							                		$anngoal = $_POST['annual_goal'];
							                		$dailygoal = $_POST['daily_goal'];
							                		$monthlygoal = $_POST['monthly_goal'];

							                		$sql2 = "UPDATE users SET daily_goal = '$dailygoal', monthly_goal = '$monthlygoal', annual_goal = '$anngoal' WHERE id = '$userId'";

							                		$stmtupdate2 = $db->db->prepare($sql2);

							                		$stmtupdate2->execute();

							                		?>
							                		<div class="alert alert-success alert-dismissible">
							                			You have successfully changed your password
							                		</div>
							                		<script type="text/javascript">
							                			location.href = "https://invata.io/account.php";
							                		</script>
							                		<?php 


							                	}

							                	?>

							                	<form method="post" action="" style="padding-top: 30px !important;padding-bottom: 30px !important;" id="changepasswordform">

							                		<div class="row">
							                			<div class="col-md-12">
															<label style="color: #fff"> Daily Target </label>
															<input type="number" class="form form-control newformcontrol" name="daily_goal" value="<?php echo $userDetails->daily_goal; ?>" placeholder="Daily Goal" required />
															
														</div>
															<div class="col-md-12">
															<label style="color: #fff"> Monthly Target </label>
															<input type="number" class="form form-control newformcontrol" name="monthly_goal" value="<?php echo $userDetails->monthly_goal; ?>" placeholder="Monthly Goal" required />
															
														</div>
														<div class="col-md-12">
															<label style="color: #fff"> Annual Target </label>
															<input type="number" class="form form-control newformcontrol" name="annual_goal" value="<?php echo $userDetails->annual_goal; ?>" placeholder="Annual Goal" required />
															
														</div>

														<div class="col-md-3">
															<input name="targetsubmit" type="submit" class="btn btn-md btn-success" style="border-radius: 0px !important;margin-top: 10px !important;background-color: #F7614E !important;border: none !important;width: 100% !important;color: #fff;" value="Update Targets">
														</div>
							                			
							                		</div>

							                		
							                	</form>



							                </div>







							                <!-- User Setting Start -->

							            	<div class="tab-pane" id="userSettings">


							            		<?php 

							            			$getRules = $db->db->prepare("SELECT *, COUNT(id) AS total FROM algovalues WHERE userid = '$userId'");

							            			$getRules->execute();

							            			$rulesValues = $getRules->fetch(PDO::FETCH_OBJ);

							            			$rulesCheck = 0;

							            			$maxMarginVal = "";
							            			$maxMarginPerAccount = "";
							            			$algoType = "";
							            			$MaxDrawDown = "";
							            			$MaxHoldtime = "";
							            			$MinHoldTime = "";
							            			

							            			if ($rulesValues->total >= 1) {
							            				# code...
							            				$rulesCheck = 1;
							            				$maxMarginVal = $rulesValues->maxMargin;
							            				$maxMarginPerAccount = $rulesValues->maxMarginPerAccount;
							            				$algoType = $rulesValues->algoType;
							            				$MaxDrawDown = $rulesValues->maxDrawdown;
							            				$MaxHoldtime = $rulesValues->maxHoldTime;
							            				$MinHoldTime = $rulesValues->minHoldTime;
							            				$man_auto = $rulesValues->man_auto;

							            				if ($man_auto == '0') {
							            					# code...
							            					$rulesCheck = 1;
							            					
							            				}else{
							            					$rulesCheck = 0;
							            				}
							            			}


							            			if (isset($_POST['Algosubmit'])) {
							            				# code...
							            				$m_m = $_POST['maxMargin'];
							            				$m_m_p_a = $_POST['maxMarginPerAccount'];
							            				$algo = $_POST['algotype'];
							            				$m_d = $_POST['MaxDrawDown'];
							            				$min_h = $_POST['MinHoldTime'];
							            				$max_h = $_POST['MaxHoldtime'];


							            				

							            				if ($rulesCheck == 1) {
							            					# code...
							            					$updateRules = "UPDATE algovalues SET maxMargin = '$m_m', maxMarginPerAccount = '$m_m_p_a', algoType = '$algo', maxDrawDown = '$m_d', maxHoldTime = '$max_h', minHoldTime = '$min_h' WHERE userid = '$userId'";	
							            				}else{

							            					$updateRules = "INSERT INTO algovalues(userid, maxMargin, maxMarginPerAccount, algoType, maxDrawDown, maxHoldTime, minHoldTime) VALUES ('$userId' ,'$m_m', '$m_m_p_a', '$algo', '$m_d', '$max_h', '$min_h')";


							            				}

							            				$stmtAlgo = $db->db->prepare($updateRules);

							            				if ($stmtAlgo->execute()) {
							            					# code...
							            					?>

							            					<script type="text/javascript">
							            						location.href = location.href;
							            					</script>
							            					<?php 
							            				}

							            				

							            			}
							            		?>

							            		<div class="row">

							            			<div class="col-md-6">
							            				<fieldset>
														  <label>Account Type</label>
														  <div class="switch-toggle switch-candy">


														    <input id="real" name="accType" type="radio" value="real" onchange="accType(value)" <?php if ($accType == 0) {
														    	# code...
														    	echo "checked";
														    } ?>>
														    <label for="real" onclick="" style="padding-top: 7px;padding-bottom: 7px;">Real</label>

														    <input id="demo" name="accType" type="radio" value="demo" onchange="accType(value)" <?php if ($accType == 1) {
														    	# code...
														    	echo "checked";
														    } ?>>
														    <label for="demo" onclick="" style="padding-top: 7px;padding-bottom: 7px;">Demo</label>
														    <a></a>
														  </div>
														</fieldset>
							            			</div>
							            			
							            		</div>



							            		<div id="acc_type_row" <?php if ($accType == 0) {
							            			# code...
							            			?>
							            			style="display: none;"
							            			<?php 
							            		}else{

							            			?>
							            			style="margin-top: 30px;"
							            			<?php 
							            		} ?>>

							            		<?php 


							            			if (isset($_POST['AccTypeSubmit'])) {
							            				# code...
							            				$startingMoney = $_POST['startingMoney'];

							            				$startingStmt = $db->db->prepare("UPDATE users SET starting_money = '$startingMoney' WHERE id = '$userId'");

							            				if ($startingStmt->execute()) {
							            					# code...
							            					?>
							            					<script type="text/javascript">
							            						location.href = location.href;
							            					</script>
							            					<?php 
							            				}

							            			}


							            		?>

							            			<form method="post" action="" class="row">

							                			<div class="col-md-12">
															<label style="color: #fff;"> Starting Money </label>
															<input type="number" class="form form-control newformcontrol" name="startingMoney" value="<?=$starting_money; ?>" placeholder="Starting Money" required />
														</div>

														<div class="col-md-5">
															<input name="AccTypeSubmit" type="submit" class="btn btn-md btn-success" style="border-radius: 0px !important;margin-top: 10px !important;background-color: #F7614E !important;border: none !important;width: 100% !important;color: #fff;" value="Update Starting Money">
														</div>

													</form>

							            			
							            		</div>




							                	
							                	<div class="row" style="margin-top: 30px;">

							                		<div class="col-md-6">
							                			<fieldset>
														  <label>Algorithm Rules</label>
														  <div class="switch-toggle switch-candy">


														    <input id="week" name="view" type="radio" value="auto" onchange="algorules(value)" <?php if ($rulesCheck == 0) {
														    	# code...
														    	echo "checked";
														    } ?>>
														    <label style="padding-top: 7px;padding-bottom: 7px;" for="week" onclick="">Auto</label>

														    <input id="month" name="view" type="radio" value="manual" onchange="algorules(value)" <?php if ($rulesCheck == 1) {
														    	# code...
														    	echo "checked";
														    } ?>>
														    <label style="padding-top: 7px;padding-bottom: 7px;" for="month" onclick="">Manual</label>

														    <a></a>
														  </div>
														</fieldset>
							                		</div>
							                		
							                	</div>






							                	<div id="logRules" <?php if ($rulesCheck == 0) {
							                		# code...
							                		?>
							                		style="display: none";
							                		<?php 
							                	} ?>>

							                			<form method="post" action="" class="row">

							                			<div class="col-md-12">
															<label style="color: #fff"> Max Margin </label>
															<input type="text" class="form form-control newformcontrol" name="maxMargin" value="<?=$maxMarginVal; ?>" placeholder="Max Margin" required />
														</div>

														<div class="col-md-12">
															<label style="color: #fff"> Max Margin Per Account</label>
															<input type="text" class="form form-control newformcontrol" name="maxMarginPerAccount" value="<?=$maxMarginPerAccount; ?>" placeholder="Max Margin Per Account" required />
														</div>

														<div class="col-md-12">
															<label style="color: #fff"> Algo Type </label>
															<select name="algotype" class="form-control newformcontrol">
																<?php 

																if ($algoType != "") {
																	# code...
																	?>
																	<option value="<?=$algoType; ?>"><?=$algoType; ?></option>
																	<?php 
																}

																?>

																<?php 

																if ($algoType == "") {
																	# code...
																	?>
																	<option value="Agressive">Agressive</option>
																	<option value="Safe">Safe</option>
																	<option value="Normal">Normal</option>
																	
																	<?php 
																}

																if ($algoType == "Agressive") {
																	# code...
																	?>
																	<option value="Normal">Normal</option>
																	<option value="Safe">Safe</option>
																	
																	<?php 
																}

																if ($algoType == "Normal") {
																	# code...
																	?>
																	<option value="Agressive">Agressive</option>
																	<option value="Safe">Safe</option>
																	<?php 
																}

																if ($algoType == "Safe") {
																	# code...
																	?>
																	<option value="Agressive">Agressive</option>
																	<option value="Normal">Normal</option>
																	
																	<?php 
																}


																?>

																
															</select>
														</div>

														<div class="col-md-12">
															<label style="color: #fff"> Max DrawDown </label>
															<input type="text" class="form form-control newformcontrol" name="MaxDrawDown" value="<?=$MaxDrawDown; ?>" placeholder="Max Draw Down" required />
														</div>

														<div class="col-md-12">
															<label style="color: #fff"> Max Hold Time </label>
															<input type="text" class="form form-control newformcontrol" name="MaxHoldtime" value="<?= $MaxHoldtime; ?>" placeholder="Max Hold Time" required />
														</div>

														<div class="col-md-12">
															<label style="color: #fff"> Min Hold Time </label>
															<input type="text" class="form form-control newformcontrol" name="MinHoldTime" value="<?=$MinHoldTime; ?>" placeholder="Min Hold Time" required />
														</div>
							             				
														<div class="col-md-5">
															<input name="Algosubmit" type="submit" class="btn btn-md btn-success" style="border-radius: 0px !important;margin-top: 10px !important;background-color: #F7614E !important;border: none !important;width: 100% !important;color: #fff;" value="Update Algorithm Values">
														</div>
							             				</form>   		
							                	</div>



							                </div>



							                <!-- User Setting Ends -->






							                <!-- Ticker Start Here --> 



							                <div class="tab-pane" id="tickerSettings">


							                	<?php 

							                	if (isset($_POST['tSubmit'])) {
							                		# code...
							                		$tickCur = $_POST['tickCur'];

							                		$tickCur = serialize($tickCur);

							                		$getUserTik = $db->db->prepare("SELECT * FROM tickers WHERE userid = '$userId'");
							                		$getUserTik->execute();

							                		$get_user_tickers = $getUserTik->fetch();

							                		if (empty($get_user_tickers)) {
							                			# code...
							                			$tckrs = $db->db->prepare("INSERT INTO tickers(userid, tickers) VALUES('$userId', '$tickCur')");	
							                		}else{



							                			$tckrs = $db->db->prepare("UPDATE tickers SET tickers = '$tickCur' WHERE userid = '$userId'");
							                		}

							                		

							                		if ($tckrs->execute()) {
							                			# code...
							                			

							                		?>
							                		<script type="text/javascript">
							                			location.href = location.href;
							                		</script>
							                		<?php
							                	}
							                	}


							                	
							                	




							                	?>





							                	
							                		
							                	

							                	<div class="row" style="margin-top: 30px;">

							                		<div class="col-md-6">
							                			<fieldset>
														  <label>Tickers</label>
														  <div class="switch-toggle switch-candy">

														  	 <input id="hide" name="ticker" type="radio" value="hide" onchange="tickerSetting(value)" <?php 
														  	 if ($tickerAvail == false) {
														  	 	# code...
														  	 	echo "checked";
														  	 }
														  	 ?>
														  	 >
														    <label style="padding-top: 7px;padding-bottom: 7px;" for="hide" onclick="">Disable</label>

														    <input id="show" name="ticker" type="radio" value="show" onchange="tickerSetting(value)" <?php 
														  	 if ($tickerAvail == true) {
														  	 	# code...
														  	 	echo "checked";
														  	 }
														  	 ?>>
														    <label style="padding-top: 7px;padding-bottom: 7px;" for="show" onclick="">Enable</label>

														   

														    <a></a>
														  </div>
														</fieldset>
							                		</div>
							                		
							                	</div>


							                	<form method="post" action="" id="tickerForm" <?php if ($tickerAvail == false): ?>
							                		style="display: none;";
							                	<?php endif ?>>


							                	<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">EUR</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_USD" <?php if (in_array('EUR_USD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?> 

						                			  >
						                			  EUR/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_AUD" <?php if (in_array('EUR_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  EUR/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_GBP" <?php if (in_array('EUR_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  EUR/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_NZD" <?php if (in_array('EUR_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  EUR/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_CAD" <?php if (in_array('EUR_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  EUR/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_CHF" <?php if (in_array('EUR_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  EUR/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_JPY" <?php if (in_array('EUR_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  EUR/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_HKD" <?php if (in_array('EUR_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  EUR/HKD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="EUR_SGD" <?php if (in_array('EUR_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  EUR/SGD
							                		</div>
							                		
							                	</div>








							                	<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">USD</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_EUR" <?php if (in_array('USD_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_AUD" <?php if (in_array('USD_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_GBP" <?php if (in_array('USD_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_NZD" <?php if (in_array('USD_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_CAD" <?php if (in_array('USD_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_CHF" <?php if (in_array('USD_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_JPY" <?php if (in_array('USD_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_HKD" <?php if (in_array('USD_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/HKD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="USD_SGD" <?php if (in_array('USD_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  USD/SGD
							                		</div>
							                		
							                	</div>




							                	<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">AUD</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_EUR" <?php if (in_array('AUD_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_USD" <?php if (in_array('AUD_USD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_GBP" <?php if (in_array('AUD_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_NZD" <?php if (in_array('AUD_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_CAD" <?php if (in_array('AUD_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_CHF" <?php if (in_array('AUD_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_JPY" <?php if (in_array('AUD_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_HKD" <?php if (in_array('AUD_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/HKD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="AUD_SGD" <?php if (in_array('AUD_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  AUD/SGD
							                		</div>
							                		
							                	</div>








							                	<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">GBP</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_EUR" <?php if (in_array('GBP_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_USD" <?php if (in_array('GBP_USD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_AUD" <?php if (in_array('GBP_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_NZD" <?php if (in_array('GBP_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_CAD" <?php if (in_array('GBP_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_CHF" <?php if (in_array('GBP_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_JPY" <?php if (in_array('GBP_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_HKD" <?php if (in_array('GBP_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/HKD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="GBP_SGD" <?php if (in_array('GBP_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  GBP/SGD
							                		</div>
							                		
							                	</div>










							                	<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">NZD</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_EUR" <?php if (in_array('NZD_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_AUD" <?php if (in_array('NZD_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_AUD" <?php if (in_array('NZD_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_GBP" <?php if (in_array('NZD_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_CAD" <?php if (in_array('NZD_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_CHF" <?php if (in_array('NZD_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_JPY" <?php if (in_array('NZD_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_HKD" <?php if (in_array('NZD_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/HKD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="NZD_SGD" <?php if (in_array('NZD_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  NZD/SGD
							                		</div>
							                		
							                	</div>









							                		<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">CAD</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_EUR" <?php if (in_array('CAD_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_AUD" <?php if (in_array('CAD_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_AUD" <?php if (in_array('CAD_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_GBP" <?php if (in_array('CAD_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_NZD" <?php if (in_array('CAD_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_CHF" <?php if (in_array('CAD_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_JPY" <?php if (in_array('CAD_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_HKD" <?php if (in_array('CAD_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/HKD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CAD_SGD" <?php if (in_array('CAD_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CAD/SGD
							                		</div>
							                		
							                	</div>









							                			<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">CHF</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_EUR" <?php if (in_array('CHF_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_USD" <?php if (in_array('CHF_USD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_AUD" <?php if (in_array('CHF_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_GBP" <?php if (in_array('CHF_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_NZD" <?php if (in_array('CHF_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_CAD" <?php if (in_array('CHF_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_JPY" <?php if (in_array('CHF_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_HKD" <?php if (in_array('CHF_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/HKD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="CHF_SGD" <?php if (in_array('CHF_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  CHF/SGD
							                		</div>
							                		
							                	</div>









							                			<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">JPY</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_EUR" <?php if (in_array('JPY_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_USD" <?php if (in_array('JPY_USD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_AUD" <?php if (in_array('JPY_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_GBP" <?php if (in_array('JPY_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_NZD" <?php if (in_array('JPY_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_CAD" <?php if (in_array('JPY_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_CHF" <?php if (in_array('JPY_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_HKD" <?php if (in_array('JPY_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/HKD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="JPY_SGD" <?php if (in_array('JPY_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  JPY/SGD
							                		</div>
							                		
							                	</div>













							                			<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">HKD</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_EUR" <?php if (in_array('HKD_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_USD" <?php if (in_array('HKD_USD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_AUD" <?php if (in_array('HKD_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_GBP" <?php if (in_array('HKD_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_NZD" <?php if (in_array('HKD_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_CAD" <?php if (in_array('HKD_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_CHF" <?php if (in_array('HKD_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_JPY" <?php if (in_array('HKD_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="HKD_SGD" <?php if (in_array('HKD_SGD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  HKD/SGD
							                		</div>
							                		
							                	</div>





							                				<div class="row" style="margin-top: 30px;">
							                		<div class="col-md-12">
							                			<p style="color: #F7614E;font-size: 24px;font-weight: 700">SGD</p>
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_EUR" <?php if (in_array('SGD_EUR', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/EUR
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_AUD" <?php if (in_array('SGD_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/USD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_AUD" <?php if (in_array('SGD_AUD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/AUD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_GBP" <?php if (in_array('SGD_GBP', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/GBP
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_NZD" <?php if (in_array('SGD_NZD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/NZD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_CAD" <?php if (in_array('SGD_CAD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/CAD
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_CHF" <?php if (in_array('SGD_CHF', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/CHF
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_JPY" <?php if (in_array('SGD_JPY', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/JPY
							                		</div>
							                		<div class="col-md-2 form-group" style="color: #F7614E;font-weight: 700;font-size: 14px;">
						                			  <input type="checkbox" name="tickCur[]" value="SGD_HKD" <?php if (in_array('SGD_HKD', $activeTikers) || empty($activeTikers)): ?>
						                			  	checked
						                			  <?php endif ?>>
						                			  SGD/HKD
							                		</div>
							                		
							                	</div>




							                	<div class="row" style="margin-top: 20px;">

							                		<div class="col-md-4">
							                			
							                			<button type="submit" name="tSubmit" class="btn  btn-md btn-success" style="width: 100%;">Update Ticker</button>

							                		</div>
							                		
							                	</div>



							                	</form>

							                </div>





							                <!-- Ticker Ends Here -->




							                <!-- Trade History -->

							                <div class="tab-pane" id="tradeHistory">

							                	<div class="row">
													<div class="col-md-12">
														<h3 style="color: #F7614E;">Trade History</h3>
													</div>
													<div class="col-md-4 col-sm-6 col-xs-12" style="margin-top: 10px;margin-bottom: 30px;">
														<button onclick="exportpdf('<?=$pdfname; ?>')" class="btn btn-sm btn-success">Export As Pdf</button>
													</div>							                		
							                	</div>


							                	<div class="row">

							                		<div class="col-md-12 col-lg-12 col-sm-12" style="margin-bottom: 20px !important;">
							                			<canvas id="tdHistoryGraph" style="width: 100%;height: 300px;background-color: #0E162D !important;padding: 10px !important;"></canvas>
							                		</div>
							                		
							                	</div>


							                </div>






							                
							            </div>
							        </div>
								
							</div>
							
						</div>
					</div>
					</p>






















	  <!-- Add Tracker Modal -->
	  <div class="modal fade" id="editTrade" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
	    <div class="modal-dialog modal-dialog-centered" role="document">
	      <div class="modal-content">
	        <div class="modal-header">
	          <h5 class="modal-title" id="exampleModalLongTitle">Modify Position</h5>
	          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
	            <span aria-hidden="true">&times;</span>
	          </button>
	        </div>
	        <div class="modal-body">
	          <form action="#" class="form" id="addTrackerForm"> 
	             <div class="col-md-12">
	              <label> Action </label>
	                <select placeholder="Identifier" required class="form form-control newformcontrol" name="tradeAction" id="tradeAction" >
	                    <option value="BUY">BUY</option>
	                    <option value="SELL">SELL</option>
	                  </select>
	             </div>
	             <div class="col-md-12">
	              <label> Order Type </label>
	                <select placeholder="Identifier" required class="form form-control newformcontrol" name="tracker_symbol" >
	                    <option value="Limit Order">Limit Order</option>
	                  </select>
	             </div> 
	             <div class="col-md-12">
	              <label>Limit Price $</label>
	                <input type="text" id="limitPrice" class="form form-control" required name="limitPrice" style="height: 50px;" />
	             </div>
	          </form>
	        </div>
	        <div class="modal-footer">
	          <button type="button" class="btn btn-secondary" data-dismiss="modal" style="background-color: #F7614E;">Update Position</button><button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
	        </div>
	      </div>
	    </div>
	  </div>
	  <!-- END Modal -->


	<script type="text/javascript">
		function showTradeValues(id, action, order, price)
		{
			$("#limitPrice").val(price);
			$("#tradeAction").val(action).change();
		}
	</script>






	<script>
		$('.closeSingleTrade').on('click', function(e){
			e.preventDefault();
			var main = this;
			var id = $(this).closest('tr').attr('data-row-id');
			$.post('/controller/calculate.controller.php', { action : 'deleteSingle' , id : id})
				.done(function(data){
					alert(data);
					$(main).closest('tr').remove();
				});
		});
		$('.modifySingleTrade').on('click', function(e){
			e.preventDefault();
			var main = this;
			var id = $(this).closest('tr').attr('data-row-id');
			console.log(id);
			$.post('/view/modify-trade.view.php', { id : id})
				.done(function(data){
					$('#tradeModal').modal('show');
					$('#tradeModal').find('.modal-body').html(data);
				});
		});
	</script>
	<script type="text/javascript">
		function submitorm()
		{
			/*$("#changepasswordform").submit();*/
			var oldpass1 = "<?=$userDetails->password; ?>";
			var oldpass2 = $("#opass").val();
			var newpass = $("#newpass").val();
			var newpassagain = $("#newpassagain").val(); 

			if (oldpass2 == "") {

				$("#showerror1").html('Please enter your old password');
			}else if (oldpass1 != oldpass2) {
				$("#showerror1").html('Your password didn\'t matched with your current password');
			}else if (newpass == "") {
				$("#showerror2").html('Please fill this field');
			}else if (newpassagain == "") {
				$("#showerror3").html('Please fill this field');
			}else if (newpass != newpassagain) {
				$("#showerror3").html('Your both password doesn\'t match');
			}else{
				$("#changepasswordform").submit();
			}

		}
	</script>


	<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>






	<script type="text/javascript">
		
		var ctx = document.getElementById('tdHistoryGraph');
var myChart = new Chart(ctx, {
    type: 'line',
    data: {
        labels: ['April', 'May', 'June', 'July', 'August', 'September'],
        datasets: [{
            label: 'Account Balance History',
            data: [12, 19, 3, 5, 2, 3],
            backgroundColor: [
                'rgba(255, 99, 132, 0.2)',
                'rgba(54, 162, 235, 0.2)',
                'rgba(255, 206, 86, 0.2)',
                'rgba(75, 192, 192, 0.2)',
                'rgba(153, 102, 255, 0.2)',
                'rgba(255, 159, 64, 0.2)'
            ],
            borderColor: [
                'rgba(255, 99, 132, 1)',
                'rgba(54, 162, 235, 1)',
                'rgba(255, 206, 86, 1)',
                'rgba(75, 192, 192, 1)',
                'rgba(153, 102, 255, 1)',
                'rgba(255, 159, 64, 1)'
            ],
            borderWidth: 3
        }]
    },
    options: {
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero: true
                }
            }]
        }
    }
});
</script>







	<script type="text/javascript">
		var ctx = document.getElementById('myChart').getContext('2d');
		var data1 = "<?=round($account->unrealizedPl, 2); ?>";
		var data2 = "<?=$account->openTrades; ?>";
		var data3 = "<?=$account->openOrders; ?>";

		var fulldata = [data1, data2, data3];
	var chart = new Chart(ctx, {
	    // The type of chart we want to create
	    type: 'bar',

	    // The data for our dataset
	    data: {
	        labels: ['Unrealized Earning', 'Open Trades', 'Open Orders'],
	        datasets: [{
	        	label:'Account Details',
	            backgroundColor: 'rgb(255, 99, 132)',
	            borderColor: 'rgb(255, 99, 132)',
	            data: fulldata
	        }]
	    },

	    // Configuration options go here
	    options: {}
	});
	</script>

	<script type="text/javascript">
		function accType(values)
		{
			var acccounttype = '';
			if (values == 'real') {

				acccounttype = '0';

				$("#acc_type_row").hide();

			}else{
				acccounttype = '1';

				$("#acc_type_row").show();
			}



			var uid = "<?=$userId; ?>";


			$.ajax({
			    type: 'POST',
			    url: '<?=$url;?>/controller/algo.controller.php', 
			    data: {action:'actionAccountType', uid:uid, type:acccounttype},
			    success: function(res){

			    }
			});


		}
	</script>

	<script type="text/javascript">
		function algorules(values)
		{


			var uid = "<?=$userId; ?>";

			if (values == 'manual') {

				$("#logRules").show();

				$.ajax({
	                type: 'POST',
	                url: '<?=$url;?>/controller/algo.controller.php', 
	                data: {action:'algo', uid:uid, vl:values},
	                success: function(res){

	                	var result = JSON.parse(res);
	                	var resu = result.res;
	                	

	                }
	            });



			}else{
				

				$("#logRules").hide();

				$.ajax({
	                type: 'POST',
	                url: '<?=$url;?>/controller/algo.controller.php', 
	                data: {action:'algo', uid:uid, vl:values},
	                success: function(res){

	                	var result = JSON.parse(res);
	                	var resu = result.res;
	                	

	                }
	            });




			}
		}
	</script>




 




	<script type="text/javascript">
		
		function tickerSetting(values)
		{
			var ticker = '0';
			if (values == 'hide') {
				ticker = '0';
				$("#tickerForm").hide();
				$("#tcontainer").hide();
			}else{
				ticker = '1';
				$("#tickerForm").show();
				$("#tcontainer").show();
			}

			var uid = "<?=$userId; ?>";


			$.ajax({
				type: 'POST',
				url: 'controller/ticker.controller.php', 
				data: {action:'tickersetting', uid:uid, vl:ticker},
				success: function(res){

				}
			});





		}

	</script>
	<script type="text/javascript">
		function exportpdf(name)
		{
			location.href = location.href+"?pdf="+name;
		}
	</script>
