public function AddNewTickerAndWatch($tickerName, $lowOrEntry, $highOrRange) { $tt = $this->GetTradeType(); // ADD THE TICKER FIRST $ticker = new ticker(); $ticker->set_variable('ticker_symbol', $tickerName); if (!$ticker->load()) { $tickerId = $ticker->createNew(); $ticker->load(); $ticker->updateFromYahoo(); } else { $tickerId = $ticker->get_variable('ticker_id'); } // ADD TO THE WATCHLIST NOW $watchlist = new watchlist(); $watchlist->set_variable('watchlist_ticker_id', $tickerId); // call pure virtual to get fields based on trade type $this->CalculateTargets($lowOrEntry, $highOrRange); $watchlist->set_variable('watchlist_low', $lowOrEntry); $watchlist->set_variable('watchlist_high', $highOrRange); $watchlist->set_variable('watchlist_top', $this->topPrice); $watchlist->set_variable('watchlist_bottom', $this->bottomPrice); $watchlist->set_variable('watchlist_target0', $this->t0); $watchlist->set_variable('watchlist_target1', $this->t1); $watchlist->set_variable('watchlist_target2', $this->t2); $watchlist->set_variable('watchlist_target3', $this->t3); $watchlist->set_variable('watchlist_tradetype', $tt); $watchId = $watchlist->createNew(); holdings::updateTickerSellPrices($tickerId, $this->bottomPrice, $tt, false); highlights::watchlistHighlight($watchId, W_ROW, 0, highlights::EVENT_START_DAY); }