Itβs very bold to jump right into the deep waters, but I would suggest first to learn the basics. You say that you "cleaned the Internet for help", but you tried the built-in Mathematica documentation center? It has thousands of help pages, just one keystroke.
, , :
- $.
,
SellSignal =
[MeanPrice]-[StandardDeviation$]*2, . , ,,False If[CurrentPrice>SellSignal,"Sell",False], .DatePlus, , ..- , . , ';' ( )
- . , . a * b, a b, a 2, 2 a 2a ( ) .
- , , , . .
- , , Mathematica ( ).
- , . , , , .
- . , , .
- , NYSE.
- , :
StartDate = DatePlus[Date[], {-3, "Month"}];
NYSEMem = Select[FinancialData["NYSE", "Members"], (\[Not] StringMatchQ[
"^" ~~ ___] &)]; (* Throw away indices *)
Do[
currentPrice = Check[FinancialData[stock, "Price"], $Failed];
historicalPrice =
Check[FinancialData[stock, {StartDate, Date[]}], $Failed];
If[currentPrice == $Failed || historicalPrice == $Failed ||
currentPrice == Missing["NotAvailable"] ||
historicalPrice == Missing["NotAvailable"],
Continue[]]; (* Shamefully inadequate error handling *)
standardDeviationPrice = StandardDeviation[historicalPrice[[All, 2]]];
meanPrice = Mean[historicalPrice[[All, 2]]];
(* Mean of the second column of the data matrix *)
sellSignal = meanPrice + 2 standardDeviationPrice;
(* swapped + and - in these two lines, plug your own method here *)
buySignal = meanPrice - 2 standardDeviationPrice;
Print[stock, ": ",
If[currentPrice > sellSignal, "Sell",
If[currentPrice < buySignal, "Buy", "Neutral"]]];
, {stock, NYSEMem}
]
, Stackoverflow , , , . , . : Mathematica ( ).