Jump to content
Tom Next - Daytrading Community

Selbsterstellter Index durch Amibroker möglich?


Tolli Molli

Recommended Posts

Hallo zusammen,

häufig hat es sich als sinnvoll erwiesen, den Trend des übergeordnete Index eines getradeten Marktes als Filter zu verwendet. Dabei ist soll der Index definitionsgemäß den Markt abdecken, d.h. er ist entsprechend der Marktkapitalisierung gewichtet. Meine Positionsgröße bestimme ich aber für alle Aktien gleichgewichtet als Anteil meines Kapitals.

Meine Idee ist, einen selbsberechneten, gleichgewichteten Index über die von mir zu handelnden Aktien zu erstellen, den ich dann als Filter verwende.

Ich habe versucht, dieses über AmiBroker zu programmieren, komme aber nicht über die Hürde, auf mehr als eine fremde Aktie zuzugreifen. "foreign" kann man nach meinen Versuchen nur einmal anwenden, d.h. ich kann nicht mehr als einen externen Zugriff tätigen, geschweige denn 30 oder 50.

Klar kann ich die Berechnung auch außerhalb von AmiBroker in Excel durchführen, aber der Aufwand mit Kursex- und -import ist sehr groß und muss dan täglich wiederholt werden.

 

Hat jemand eine Idee, wie man das Problem lösen könnte?

Link to comment
Share on other sites

Eine wirkliche Lösung habe ich auch nicht.

Das einzige was mir einfällt wo Du vielleicht mal schauen kannst ist der Code vom Relative Performance Chart.

 

Dort wird doch auch auf mehrere Werte zugegriffen.

In wie weit Du damit nachher Arbeiten kannst weiss ich leider nicht.

 

_N( TickerList = ParamStr("Tickers", "^DJI,MSFT,GE") );
NumBars = 20;
fvb = Status("firstvisiblebar");
Plot( 100 * ( C - C[ fvb ] ) / C[ fvb ], Name(), colorBlue );
for( i = 0; ( symbol = StrExtract( TickerList, i ) ) != ""; i++ )
{
fc = Foreign( symbol, "C" );

if( ! IsNull( fc[ 0 ] ) )
{
  Plot( 100 * ( fc - fc[ fvb ] )/ fc[ fvb ], symbol, colorLightOrange + ( (2*i) % 15 ), styleLine );
}
}
PlotGrid( 0, colorYellow );
_N( Title = "{{NAME}} - Relative Performance [%]: {{VALUES}}" );

 

Wäre aber nett wenn Du uns auf dem laufenden hälst

Link to comment
Share on other sites

"foreign" kann man nach meinen Versuchen nur einmal anwenden,

 

War grade auf dem Yahoo Groups.

 

Keine Ahnung was er will oder was er für Probleme hat,

steht aber zumindest mehre male das Foreign

 

Sorry, I forgot to say what it is I'm trying to do.

 

I would like to be able to display on the same pane, a number of indicators that might show divergences, by showing the following ratios:

- the SP-500 and the Russel 2000

- the SP-100 and the SP-600

- the Russel 1000 and the Russel 2000

 

I have the following code, but it overlays the plots on top of one another. Using separate panes would mean that I would need to use four separate AFLs - not a problem, but not so clean as having everything together:

 

SPX = Foreign("SP-500", "C");

RUT_SPX = Foreign("RUT-X", "C")/Foreign("SP-500","C");

OEX_SML = Foreign("OEX", "C")/Foreign("SML--X","C");

RUI_RUT = Foreign("RUI-X", "C")/Foreign("RUT-X","C");

 

Plot( SPX, "SPX", colorWhite );

Plot( RUT_SPX, "RUT-SPX", colorBrightGreen, styleLine | styleOwnScale );

Plot( OEX_SML, "OEX-SML", colorOrange, styleLine | styleOwnScale );

Plot( RUI_RUT, "RUI-RUT", colorLightBlue, styleLine | styleOwnScale );

Link to comment
Share on other sites

  • 1 year later...

@TolliMolli, ist zwar schon lange her, aber mit AddtoComposite() wäre das möglich.

http://www.amibroker.com/guide/afl/afl_view.php?addtocomposite

http://www.amibroker.com/guide/a_addtocomposite.html

http://www.amibroker.org/3rdparty/IntroToAtc.pdf

 

Beispiel

weight = 10; // default weight

if( Name() == "MSFT" ) weight = 20;
if( Name() == "AAPL" ) weight = 5;
if( Name() == "INTC" ) weight = 15;

/// and so on.

AddToComposite( weight * Close, "~MyComposite", "X" );
Plot ( Foreign("~MyComposite", "X"), "MyComposite", 6, 1);

 

http://www.wisestocktrader.com/indicators/119-weighted-index

  • Upvote 1
Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...