public function UpdateWatch($watchlistRecord, $lowOrEntry, $highOrRange)
 {
     // call pure virtual to get fields based on trade type
     $this->CalculateTargets($lowOrEntry, $highOrRange);
     $watchlistRecord->set_variable('watchlist_low', $lowOrEntry);
     $watchlistRecord->set_variable('watchlist_high', $highOrRange);
     $watchlistRecord->set_variable('watchlist_top', $this->topPrice);
     $watchlistRecord->set_variable('watchlist_bottom', $this->bottomPrice);
     $watchlistRecord->set_variable('watchlist_target0', $this->t0);
     $watchlistRecord->set_variable('watchlist_target1', $this->t1);
     $watchlistRecord->set_variable('watchlist_target2', $this->t2);
     $watchlistRecord->set_variable('watchlist_target3', $this->t3);
     $watchlistRecord->update();
     $watchId = $watchlistRecord->get_variable('watchlist_id');
     highlights::watchlistHighlight($watchId, W_ENTRY_ZONE, 0, highlights::EVENT_START_DAY);
 }
예제 #2
0
<?php

//Include the PS_Pagination class
require_once 'php/db_interface/autoload.php';
$login = new login(true);
if (isset($_POST['sendTweet'])) {
    comms::ListUpdatedSendMessages();
}
/// REMOVE SOMETHING
if (isset($_GET['delete_id'])) {
    $adminList = new adminControlWatchlist($_GET['delete_id']);
    $adminList->Remove();
    highlights::watchlistHighlight($_GET['delete_id'], W_ROW_DELETE, 0, highlights::EVENT_START_DAY);
}
// Create all new tickers
$counter = 1;
while (true) {
    if (!isset($_POST["ticker" . $counter]) || strlen(trim($_POST["ticker" . $counter])) <= 0) {
        break;
    }
    $tradeType = $_POST["type" . $counter];
    $tickerName = $_POST["ticker" . $counter];
    $tickerLow = floatval($_POST["low" . $counter]);
    $tickerHigh = floatval($_POST["high" . $counter]);
    $className = adminControlWatchlist::GetWatchClassName($tradeType);
    $newTicker = new $className();
    $newTicker->AddNewTickerAndWatch($tickerName, $tickerLow, $tickerHigh);
    $counter++;
}
// Load the information from the database
$tradeTypesToUseInDropdown = array(PULLBACK_TRADE, BACKDRAFT_TRADE, BREAKOUT_TRADE, BREAKDOWN_TRADE);
function processPullbacks()
{
    $watches = new watchlist();
    $watches->set_variable("watchlist_tradetype", PULLBACK_TRADE);
    while ($watches->loadNext()) {
        $tId = $watches->get_variable("watchlist_ticker_id");
        $wId = $watches->get_variable("watchlist_id");
        $calcHigh = $watches->get_variable("watchlist_high");
        $calcLow = $watches->get_variable("watchlist_low");
        $ticker = new ticker();
        $ticker->set_variable("ticker_id", $tId);
        if ($ticker->load()) {
            $dayHigh = $ticker->get_variable("today_high");
            $symbol = strtoupper($ticker->get_variable("ticker_symbol"));
            echo "Testing " . $symbol . " PrevHigh=" . $calcHigh . " DayHigh=" . $dayHigh . "<br>\n";
            if ($dayHigh > $calcHigh) {
                echo "          RECALC AND HIGHLIGHTING\n<br>";
                $className = adminControlWatchlist::GetWatchClassName(PULLBACK_TRADE);
                $watchlistAdmin = new $className($wId);
                $watchlistAdmin->Edit($calcLow, $dayHigh);
                // highlight the abandon price
                highlights::watchlistHighlight($wId, W_ENTRY_ZONE, 0, highlights::EVENT_START_DAY);
            }
        }
    }
}