Stock Market Simulation Program - 10 Stocks
Stock # ***** Price/Share *** Holdings **** Value **** PriceChange *** Buy/Sell
#1
****
******
******
******
****
#2
****
******
******
******
****
#3
****
******
******
******
****
#4
****
******
******
******
****
#5
****
******
******
******
****
#6
****
******
******
******
****
#7
****
******
******
******
****
#8
****
******
******
******
****
#9
****
******
******
******
****
#10
***
******
******
******
****
* 1 ****** 2 ***** 3 ***** 4 ******* 5 ******* 6 ***** 7 ***** 8 ***** 9 ****** 10 **** 11 ****** 12 **** 13
Result #1:
= Total Assets in Stocks ** Click Here =>
Result #2:
= Total Assets in Cash
Result #3:
= Total Assets in Stocks & Cash
Cycles =>
= 150 Cycles
Set Timing (500 to 5000) =>
Originally you were deciding what to do
Then I decided to make it a simulation.
Starts out with 7 shares of each stock
And $25,000 Cash to Buy and Sell
When the Number of Shares goes to zero
or less than zero the Value goes to zero.
#6 = Trend Slope -.05 to +.05
#7 = Count Down to change Trend Slope
(Changes every 7 days/cycles)
#8 = zero or +10
#9 = zero or -10
#10 = Two Count Downs = Random #'s 1 to 9
(When they reach zero they set #8 & #9)
#8 & #9 increase or decrease a
random stock by 10 points
But not always only sometimes.
#11 = First # is Stock being bought or sold
Second # is Choosing First #
Here are some of the variables:
q1 = Price per Share
q2 = Holdings = # of Shares
q3 = Stock Value = q2 times q1
q4 = Price Change each cycle
q5 = Buy/Sell Orders +1 = Buy -1 = Sell
sa1 = Trend Line Slope up or down
x1 = A random decimal .1 to .9
I found this formula online - LOL.!
Loop for Price Changes:
for(i=1;i<=10;i++)
{
b1 = (Math.floor(sa1*q1[i]))/1 + x1[i]/1;
b2 = 6*(Math.random()*1)/1 + .5/1;
b3 = Math.floor(4/1 - b2/1) + b1/1;
b4 = (Math.floor((100*b3)/1 + .5/1))/100;
b5 = q1[i]/1 + b4/1;
p1[i] = q1[i]/1 - b5/1;
q1[i] = b5/1;
};
p1 = Price Change
Here is the loop to update the numbers:
for(i=1;i<=10;i++)
{
k1[i] = q1[i]*q5[i]/1 + q1[i]*q2[i]/1;
k2[i] = q2[i]/1 + q5[i]/1;
k3[i] = q1[i]*q5[i]/1;
t2 = t5/1 + k1[i]/1;
t5 = t2;
t1[i] = t2;
t10 = t2;
t7 = t6/1 + k3[i]/1;
t6 = t7/1;
q3[i] = k1[i];
q2[i] = k2[i];
q4[i] = -p1[i];
};