Anzahl der Aktien beim kauf

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #189816 quote
    axmichi
    Participant
    Senior

    Hallo

     

    ich habe einen einfachen Code der so lautet

    if not longonmarket and my condition Then

    Buy 1 shares at market

    Es wird eine Aktie gekauft

    Ich möchte aber, das je nach Abstand vom Entryprice zum SL 100 $ riskiert werden sollen

    Der SL ist so:

    X=(AverageTrueRange[37](close))*10

    SET STOP LOSS X

    Ist also der SL 5 Dollar vom Tradeprice entfernt, sollen 20 Aktien gekauft werden.

     

    Ich hoffe das geht zu machen

    Vielen Dank!

    #189817 quote
    axmichi
    Participant
    Senior

    alternativ zu 100 $ kann es auch sein das die Anzahl der aktien sich nach dem Stand der equity richtet. heißt steht die equity höher also im gewinn dann werden auch mehr aktien gekauft so 5 % der equity.

     

    Danke sehr

    #189902 quote
    robertogozzi
    Moderator
    Master

    #1

    MyRisk = 100
    X=(AverageTrueRange[37](close))*10
    if not longonmarket and my condition Then
       N = MyRisk / X
       Buy N shares at market
    Endif

    #2

    ONCE MyCapital = 100
    ONCE MyProfit  = 0
    ONCE MyRisk    = 5              //5%
    MyEquity       = MyCapital + StrategyProfit
    X=(AverageTrueRange[37](close))*10
    if not longonmarket and my condition Then
       N = 1
       if MyEquity > MyCapital THEN
          N = (MyEquity * MyRisk / 100)
       ENDIF
       Buy N shares at market
    Endif
    #190573 quote
    axmichi
    Participant
    Senior

    Hallo,

     

    ich möchte den oberen Code gern so verändern, dass 100 Risk sich aus 3 % Risiko SL ergeben

    Ich hab das versucht aber das funktioniert nicht:

    MyRisk = 100
    X=Tradeprice*0.03

    N = MyRisk / X

    Buy N shares at market

    Danke sehr

     

    MyRisk = 100
    X=(AverageTrueRange[37](close))*10
    if not longonmarket and my condition Then
       N = MyRisk / X
       Buy N shares at market
    Endif
    #190646 quote
    robertogozzi
    Moderator
    Master
    #191089 quote
    axmichi
    Participant
    Senior

    Hallo, Nein,

     

    siehe das Bild

    bei einem sl von 3 % ist das risk 10 $ also sollen 10 Aktien gekauft werden !

    Vielen Dank

    #191245 quote
    robertogozzi
    Moderator
    Master

    Da ist er:

    ONCE MyRisk = 100    //100 €
    MyLots = MyRisk / close
    IF Not OnMarket THEN
       IF close CROSSES OVER Average[100,0](close) THEN
          BUY MyLots CONTRACTS AT MARKET
       ELSIF close CROSSES UNDER Average[100,0](close) THEN
          SELLSHORT MyLots CONTRACTS AT MARKET
       ENDIF
    ENDIF
    SET TARGET pPROFIT 100
    SET STOP   pLOSS   100
    #193612 quote
    axmichi
    Participant
    Senior
    ONCE MyCapital = 100
    ONCE MyProfit  = 0
    ONCE MyRisk    = 5              //5%
    MyEquity       = MyCapital + StrategyProfit
    X=close*3/100
    If not longonmarket and c1 and time=starttime then
    N = 1
    if MyEquity > MyCapital THEN
    N = (MyEquity * MyRisk / 100)
    ENDIF
    Buy N shares at market
    Endif
    

    Hallo,

    dieser code soll so viele aktien kaufen das der Stop loss =  close *3 % die 5% myrisk  der equity ergibt.

    Das heißt, wenn die equity bei 15 000 steht dann sind 5 % = 750 $, wenn der tradeprice 1000 beträgt und der sl 3% = 30

    dann wird gerechnet 750/30 = 25 aktien

     

    ich bekomme es nicht in den code rein..

    Danke euch

    #193613 quote
    axmichi
    Participant
    Senior

    ich habe es so versucht aber es geht nicht?!

     

    ONCE MyCapital = 1000
    ONCE MyProfit = 0
    ONCE MyRisk = 5 //5%
    MyEquity = MyCapital + StrategyProfit
    X=close*3/100
    If not longonmarket and c1 and time=starttime then
    N = 1
    if MyEquity > MyCapital THEN
    N = (MyEquity * MyRisk / 100)
    n1=N/x
    ENDIF
    Buy n1 shares at market
    Endif

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Anzahl der Aktien beim kauf


ProOrder: Automatischer Handel & Backtesting

New Reply
Author
author-avatar
axmichi @axmichi Participant
Summary

This topic contains 8 replies,
has 2 voices, and was last updated by axmichi
3 years, 8 months ago.

Topic Details
Forum: ProOrder: Automatischer Handel & Backtesting
Language: German
Started: 03/11/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...