OmniTrader Professional Forum - OmniScripts
Read Weights from internal list

^ Top
Boris Lund

Posts: 59

Joined: 12/9/2021

User Profile
 
Subject : Read Weights from internal list
Posted : 1/10/2022 11:37 AM
Post #31828

'Reads from listed symbols and their outstanding shares.
'Calculates Market Cap for each and sums it up in a Total Market Cap.
'Second run it calculates each weight: Price*Shares / Total Market Cap
Example is done with a very simple list for verification.
SymbolShares = "AAPL,1,ABBV,2,ABT,3,"

From the DebugMSG
AAPL 170.33 Shares 1 MarketCap 170.33 Weight 0.2012524
ABBV 135.15 Shares 2 MarketCap 270.3 Weight 0.3193714
ABT 135.24 Shares 3 MarketCap 405.72 Weight 0.4793762
MarketCapTotal 846.35

Now it is possible to look at several symbols summarized, weighted or how many did x or y.
Example, how many from this list have hit their highest high within x-peiods (from the fear/greed index)


Thank you Jim for the pointers :)
Attached file : ReadWeigths.txt (2KB - 267 downloads)

^ Top
Boris Lund

Posts: 59

Joined: 12/9/2021

User Profile
 
Subject : RE: Read Weights from internal list
Posted : 1/10/2022 12:29 PM
Post #31829 - In reply to #31828

Here is the SP&100 list

Attached file : SP100 and Shares.txt (0KB - 271 downloads)

^ Top
Boris Lund

Posts: 59

Joined: 12/9/2021

User Profile
 
Subject : RE: Read Weights from internal list
Posted : 1/10/2022 9:01 PM
Post #31830 - In reply to #31829

Correlated Weighted Moves.
An attempt of weighing the price movement of the spy by the total correlation of the underlying symbols. The idea being that the more correlated the underlying signals are, the more significant a directional move is.

It became clear that using weights was the same as just using the top 10 symbols. So no need to read all 100 into the loop. 100 symbols on 100 bars is too much on RT. But room to play around with different setups.

The plot shows price difference from yesterday so green>0 shows an upward price move. Weighted by the total correlation.

Attached file : Correlated Weighted Direction.txt (4KB - 266 downloads)
Attached file : CorrelatedWeightedDirectionPlot.png (59KB - 270 downloads)



https://www.omnitrader.com/currentclients/proforum/thread-view.asp?threadid=8006&posts=3