Jump to content

Recommended Posts

this is my sorted array and

$sortedArray = array($value_one_fin,$value_two_fin,$value_three_fin,$value_four_fin,$value_five_fin,$value_six_fin,$value_seven_fin,$value_eight_fin,$value_nine_fin,$value_ten_fin,$value_eleven_fin,$value_twelve_fin,$value_thirteen_fin,$value_fourteen_fin,$value_fifteen_fin,$value_sixteen_fin,$value_seventeen_fin,$value_eighteen_fin,$value_nineteen_fin,$value_twenty_fin,$value_twentyone_fin,$value_twentytwo_fin,$value_twentythree_fin,$value_twentyfour_fin);

$result=findClosest($sortedArray,$num1); 

 

this is the variable where i store my entered number

$num1

 

what i want to do is to display values from sorted array in the manner Buy at / above: 102.51 Targets: 105,107.58,110.19,112.83

Stoploss : 100

 

in the above example i have entered 100 as $num1. as per calc the $result is also 100 so it has to display next greater closest number which is 102.51 and in stop loss it shuld display next smaller closest number

 

CONDITION

 

1>if entered number $num1 is greater than $result then display the next greater closest number from sorted array

2>if entered number $num1 is equal to $result then display the next greater closest number from sorted array

 

pls help me with this how can i do this im doing this

 

Buy At/Above ";if ($num1>$result) {echo "$result ";}if ($num1=$result) {echo "$result ";}if ($num1<$result) {echo "$result ";}echo "for Targets"; if ($result<$value_one_fin){echo " $value_one_fin,";}
if ($result<$value_two_fin){echo " $value_two_fin,";}
if ($result<$value_three_fin){echo " $value_three_fin,";}
if ($result<$value_four_fin){echo " $value_four_fin,";}
if ($result<$value_five_fin){echo " $value_five_fin,";}
if ($result<$value_six_fin){echo " $value_six_fin,";}
if ($result<$value_seven_fin){echo " $value_seven_fin,";}
if ($result<$value_eight_fin){echo " $value_eight_fin,";}
if ($result<$value_nine_fin){echo " $value_nine_fin,";}
if ($result<$value_ten_fin){echo " $value_ten_fin,";}
if ($result<$value_eleven_fin){echo " $value_eleven_fin,";}
if ($result<$value_twelve_fin){echo " $value_twelve_fin,";}
if ($result<$value_thirteen_fin){echo " $value_thirteen_fin,";}
if ($result<$value_fourteen_fin){echo " $value_fourteen_fin,";}
if ($result<$value_fifteen_fin){echo " $value_fifteen_fin,";}
if ($result<$value_sixteen_fin){echo " $value_sixteen_fin,";}
if ($result<$value_seventeen_fin){echo " $value_seventeen_fin,";}
if ($result<$value_eighteen_fin){echo " $value_eighteen_fin,";}
if ($result<$value_nineteen_fin){echo " $value_nineteen_fin,";}
if ($result<$value_twenty_fin){echo " $value_twenty_fin,";}
if ($result<$value_twentyone_fin){echo " $value_twentyone_fin,";}
if ($result<$value_twentytwo_fin){echo " $value_twentytwo_fin,";}
if ($result<$value_twentythree_fin){echo " $value_twentythree_fin,";}
if ($result<$value_twentyfour_fin){echo " $value_twentyfour_fin";} 

 

but its not working and also how to display STOP LOSS

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.