Hello, I am trying to combine the else if with the do while…
I currently have this code:
<td class="white dot">
<?php
$status = '';
$notesValue = '';
$stockValPrice1 = str_replace('$','',$result->swl_stock_price1); // Get stock price1
$stockValPrice2 = str_replace('$','',$result->swl_stock_price2); // Get stock price2
$tarValPrice1 = str_replace('$','',$result->swl_target1); // Get option entry price1
$tarValPrice2 = str_replace('$','',$result->swl_target2); // Get option entry price2
$stopValPrice = str_replace('$','',$result->swl_stop); // Get stop price
$lastValues = filter_var($lastValue, FILTER_VALIDATE_FLOAT);
$stockValsPrice1 = filter_var($stockValPrice1, FILTER_VALIDATE_FLOAT);
$stockValsPrice2 = filter_var($stockValPrice2, FILTER_VALIDATE_FLOAT);
$tarValsPrice1 = filter_var($tarValPrice1, FILTER_VALIDATE_FLOAT);
$tarValsPrice2 = filter_var($tarValPrice2, FILTER_VALIDATE_FLOAT);
$stopValsPrice = filter_var($stopValPrice, FILTER_VALIDATE_FLOAT);
if($lastValues >= $stockValsPrice1 && $lastValues <= $stockValsPrice2) // Check contion for stock entry price
{
echo "<img src=".plugins_url( '/images/green-dot.png', __FILE__ ).">";
$notesValue = "Stock/Option: ".$result->swl_symbol." Entry price / range of $".$stockValPrice1." to ".$stockValPrice2." has been met.";
}
else if($lastValues != ($lastValues >= $stockValsPrice1 && $lastValues <= $stockValsPrice2)) // if above condition is not true, then..
{
echo "Watching";
$notesValue = "Stock/Option: ".$result->swl_symbol." has been added to the Watchlist.";
}
else if($lastValues >= $tarValsPrice1 && $lastValues <= $tarValsPrice2) // Check contion for target price
{
echo "<img src=".plugins_url( '/images/yellow-dot.png', __FILE__ ).">";
$notesValue = "Stock/Option: ".$result->swl_symbol." Target price / range of $".$tarValPrice1." to ".$tarValPrice2." has been met.You should consider taking profits.";
}
else if($lastValues == $stopValsPrice) // Check contion for stop price
{
echo "<img src=".plugins_url( '/images/red-dot.png', __FILE__ ).">";
$notesValue = "Stock/Option: ".$result->swl_symbol." Stop price / range of $".$stopValPrice." has occurred.You should reevaluate or close this trade.";
}
?>
</td>
… and I am trying to combine it with this code:
<?php // Will keep the condition met permanently for green dot ($lastValues >= $stockValsPrice1 && $lastValues <= $stockValsPrice2) = 1; do { echo " <?php // Will keep the condition met permanently for yellow dot
($lastValues >= $tarValsPrice1 && $lastValues <= $tarValsPrice2) = 1;
do {
echo "<img src=".plugins_url( '/images/yellow-dot.png', __FILE__ ).">";
} while (($lastValues >= $tarValsPrice1 && $lastValues <= $tarValsPrice2) > 0);
?>
<?php // Will keep the condition met permanently for red dot
($lastValues == $stopValsPrice) = 1;
do {
echo "<img src=".plugins_url( '/images/red-dot.png', __FILE__ ).">";
} while (($lastValues == $stopValsPrice) > 0);
?>
I am not a programmer. I build things by asking questions… and I have no idea how to combine these two chunks of code. Any help…?