Zum Inhalt springen
View in the app

A better way to browse. Learn more.

#T/N/X/T

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Volumen berechnen

Geschrieben

Kurze Frage,

 

ich will für ein EA das Volumen/Lotgröße berechnen, sodass dieses bei SL genau den gewünschen Prozentsatz der Kontogröße riskiert.

 

Also Beispiel:

 

Kontogröße 8888€

SL = 77 Pips

Risiko% = 2%

Lot = ?

 

Wert eines Pips = Pipfaktor * Volumen / Kurs * 100000

Volumen = Pipveränderung(SL) / Kurs / Wert eines Pips

 

Die Formeln hab ich mir bisschen aus den Fingern gesaugt da liegt bestimmt auch der Fehler. Das Problem ist das die 2. Formel von der 1. abhängt aber in der 1. Formel das Volumen gefordert ist obwohl das anschließend in der 2. erst errechnet werden soll.!? Desweiteren frag ich mich bei der 100000, da nur für Standardlot gültig, was wenn Mini oder Mikro Lot, gibts da nicht eine automatische Erkennung durch der EA? Am besten alles automatisch auslesen ausser natürlich SL und Risiko%

 

Gruß

Bearbeitet von Forex1+

Featured Replies

Geschrieben

Hallo,

 

hier macht das diese Funktion, weiss gar nicht mehr wo ich die herhabe:

 

double calcLotSize(string symbol,double stopdiff,double riskAbs) {

//producing a valid lotsize

double lot_step= MarketInfo(symbol,MODE_LOTSTEP);

double minlot= MarketInfo(symbol,MODE_MINLOT);

double maxlot= MarketInfo(symbol,MODE_MAXLOT);

if (stopdiff > 0){

double lots=(riskAbs*MarketInfo(symbol,MODE_TICKSIZE))/(stopdiff*MarketInfo(symbol,MODE_TICKVALUE));

} else lots = minlot;

lots= MathFloor(lots/lot_step)*lot_step;

lots= MathMin(maxlot,lots); // no empty orders, not trading too much ;)

//Print ("Lots: ",lots);

if(lots > maxlots) lots = maxlots;

if(lots

return(lots);

}

 

Nicht ganz sauber programmiert, 'maxlots' fast am Ende ist extern definiert und kam mal später dazu nachdem der Script drumrum mit zu engem Stop mal freidrehte.

 

Als Anregung

 

Lutz

Geschrieben

Hallo,

[...]

//Print ("Lots: ",lots);

if(lots > maxlots) lots = maxlots;

if(lots

return(lots);

}

 

Nicht ganz sauber programmiert, 'maxlots' fast am Ende ist extern definiert und kam mal später dazu nachdem der Script drumrum mit zu engem Stop mal freidrehte.

 

Als Anregung

 

Lutz

 

Kann man auch so machen dann:

lots = MathMax(MathMin(lots, MarketInfo(Symbol(),MODE_MAXLOT)),minlot);

Dein Kommentar

Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.

Gast
Auf dieses Thema antworten...

Account

Navigation

Suche

Suche

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.